Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gravityblast/signed_request
signed request encoder/decoder for elixir
https://github.com/gravityblast/signed_request
elixir elixir-lang signed-requests signed-url
Last synced: about 8 hours ago
JSON representation
signed request encoder/decoder for elixir
- Host: GitHub
- URL: https://github.com/gravityblast/signed_request
- Owner: gravityblast
- License: mit
- Created: 2017-05-08T10:37:32.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-11-22T18:59:12.000Z (almost 3 years ago)
- Last Synced: 2024-03-14T19:18:21.408Z (8 months ago)
- Topics: elixir, elixir-lang, signed-requests, signed-url
- Language: Elixir
- Size: 7.81 KB
- Stars: 10
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SignedRequest
SignedRequest is an Elixir module created to sign request query strings using HMAC.
## Installation
```elixir
def deps do
[{:signed_request, "~> 0.1.0"}]
end
```## Configuration
```elixir
config :signed_request, :secret_key, "foo"
```## Encoding query
```elixir
iex> SignedRequest.SignedURI.encode_query(%{size: 512})
"sig=7dc5fc28fa59ff89dff64bed05920978471f10ced63aca98452b54574a3aef0e&size=512"
```## Decoding query string
```elixir
iex> SignedRequest.SignedURI.decode_query("sig=7dc5fc28fa59ff89dff64bed05920978471f10ced63aca98452b54574a3aef0e&size=512")
{:ok, %{
"sig" => "7dc5fc28fa59ff89dff64bed05920978471f10ced63aca98452b54574a3aef0e",
"size" => "512"}
}iex> SignedRequest.SignedURI.decode_query("sig=invalid&size=512")
{:error, :invalid_hmac}
```