-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Boulevard/lnikkila/token-structs
Return and consume tokens as structs
- Loading branch information
Showing
7 changed files
with
117 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
defmodule ExQuickBooks.Token do | ||
@moduledoc """ | ||
OAuth 1.0a token/secret pair for authenticating API calls. | ||
See `ExQuickBooks.OAuth` for documentation on how to obtain these tokens. | ||
## Structure | ||
The token is technically a public/private key pair: | ||
- `:token` - The public key binary. | ||
- `:token_secret` - The private key binary. | ||
The token is sent with API requests, but the secret is only used to calculate | ||
the request signatures. | ||
## Storing the token | ||
You can store the token as is if your storage supports maps (in a Postgres | ||
`jsonb` column, for example) or store the keys individually. | ||
If you’re storing the token in a user’s session, make sure the session | ||
storage is encrypted. | ||
""" | ||
|
||
@type t :: %__MODULE__{ | ||
token: binary, | ||
token_secret: binary | ||
} | ||
|
||
@enforce_keys [ | ||
:token, | ||
:token_secret | ||
] | ||
|
||
defstruct @enforce_keys | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters