Skip to content

Commit cb1667d

Browse files
committed
Prepare for release
1 parent 5209114 commit cb1667d

File tree

6 files changed

+64
-8
lines changed

6 files changed

+64
-8
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 0.1.0 Initial Release
4+
5+
- 🔥

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2021 Nick Vernij
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,21 @@ def deps do
2727
end
2828
```
2929

30-
And add the Firebase auth issuer name for your project to your `config.exs`.
30+
## Usage
31+
32+
Add the Firebase auth issuer name for your project to your `config.exs`. This is required to make sure only your project's firebase tokens are accepted.
3133

3234
```elixir
3335
config :ex_firebase_auth, :issuer, "https://securetoken.google.com/hoody-16c66"
3436
```
3537

38+
Verifying a token
39+
40+
```elixir
41+
ExFirebaseAuth.Token.verify_token("Some token string")
42+
iex> {:ok, "userid", %{}}
43+
```
44+
3645
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
3746
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
3847
be found at [https://hexdocs.pm/ex_firebase_auth](https://hexdocs.pm/ex_firebase_auth).

lib/token.ex

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ defmodule ExFirebaseAuth.Token do
55

66
@spec verify_token(binary) ::
77
{:error, binary} | {:ok, binary(), JOSE.JWT.t()}
8-
@doc """
8+
@doc ~S"""
99
Verifies a token agains google's public keys. Returns {:ok, user_id, claims} if successful. {:error, _} otherwise.
1010
1111
## Examples
12-
iex> ExFirebaseAuth.Token.verify_token("ey.some.token")
13-
{:ok, "user id", %{}}
1412
15-
iex> ExFirebaseAuth.Token.verify_token("ey.some.token")
16-
{:error, "Invalid JWT header, `kid` missing"}
13+
iex> ExFirebaseAuth.Token.verify_token("ey.some.token")
14+
{:ok, "user id", %{}}
15+
16+
iex> ExFirebaseAuth.Token.verify_token("ey.some.token")
17+
{:error, "Invalid JWT header, `kid` missing"}
1718
"""
1819
def verify_token(token_string) do
1920
issuer = Application.fetch_env!(:ex_firebase_auth, :issuer)

mix.exs

+19-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ defmodule ExFirebaseAuth.MixProject do
77
version: "0.1.0",
88
elixir: "~> 1.11",
99
start_permanent: Mix.env() == :prod,
10-
deps: deps()
10+
deps: deps(),
11+
package: package(),
12+
docs: [
13+
main: "readme",
14+
extras: ["README.md"]
15+
]
1116
]
1217
end
1318

@@ -25,7 +30,19 @@ defmodule ExFirebaseAuth.MixProject do
2530
[
2631
{:jose, "~> 1.10"},
2732
{:finch, "~> 0.3.1"},
28-
{:jason, "~> 1.2.2"}
33+
{:jason, "~> 1.2.2"},
34+
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false}
35+
]
36+
end
37+
38+
defp package do
39+
[
40+
description: "Handling Firebase Auth 'ID tokens' in Elixir",
41+
links: %{
42+
"github" => "https://github.com/Nickforall/ExFirebaseAuth",
43+
"documentation" => "https://hexdocs.pm/ex_firebase_auth"
44+
},
45+
licenses: ["MIT"]
2946
]
3047
end
3148
end

mix.lock

+5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
%{
22
"castore": {:hex, :castore, "0.1.8", "1b61eaba71bb755b756ac42d4741f4122f8beddb92456a84126d6177ec0af1fc", [:mix], [], "hexpm", "23ab8305baadb057bc689adc0088309f808cb2247dc9a48b87849bb1d242bb6c"},
3+
"earmark_parser": {:hex, :earmark_parser, "1.4.12", "b245e875ec0a311a342320da0551da407d9d2b65d98f7a9597ae078615af3449", [:mix], [], "hexpm", "711e2cc4d64abb7d566d43f54b78f7dc129308a63bc103fbd88550d2174b3160"},
4+
"ex_doc": {:hex, :ex_doc, "0.23.0", "a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a16"},
35
"finch": {:hex, :finch, "0.3.2", "993dddb23cd9b50ad395ed994b317c7ce2c095e6017ffd5a5b65abdb5b7e5d1c", [:mix], [{:castore, "~> 0.1.5", [hex: :castore, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.2.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "85be155ad3f6a1d806610f2b83e054d3201dc2fd1c4e97d47f40687ad877193a"},
46
"jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
57
"jose": {:hex, :jose, "1.11.1", "59da64010c69aad6cde2f5b9248b896b84472e99bd18f246085b7b9fe435dcdb", [:mix, :rebar3], [], "hexpm", "078f6c9fb3cd2f4cfafc972c814261a7d1e8d2b3685c0a76eb87e158efff1ac5"},
8+
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},
9+
"makeup_elixir": {:hex, :makeup_elixir, "0.15.0", "98312c9f0d3730fde4049985a1105da5155bfe5c11e47bdc7406d88e01e4219b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "75ffa34ab1056b7e24844c90bfc62aaf6f3a37a15faa76b07bc5eba27e4a8b4a"},
610
"mint": {:hex, :mint, "1.2.0", "65e9d75c60c456a5fb1b800febb88f061f56157d103d755b99fcaeaeb3e956f3", [:mix], [{:castore, "~> 0.1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "19cbb3a5be91b7df4a35377ba94b26199481a541add055cf5d1d4299b55125ab"},
711
"nimble_options": {:hex, :nimble_options, "0.2.1", "7eac99688c2544d4cc3ace36ee8f2bf4d738c14d031bd1e1193aab096309d488", [:mix], [], "hexpm", "ca48293609306791ce2634818d849b7defe09330adb7e4e1118a0bc59bed1cf4"},
12+
"nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"},
813
"nimble_pool": {:hex, :nimble_pool, "0.1.0", "ffa9d5be27eee2b00b0c634eb649aa27f97b39186fec3c493716c2a33e784ec6", [:mix], [], "hexpm", "343a1eaa620ddcf3430a83f39f2af499fe2370390d4f785cd475b4df5acaf3f9"},
914
"telemetry": {:hex, :telemetry, "0.4.2", "2808c992455e08d6177322f14d3bdb6b625fbcfd233a73505870d8738a2f4599", [:rebar3], [], "hexpm", "2d1419bd9dda6a206d7b5852179511722e2b18812310d304620c7bd92a13fcef"},
1015
}

0 commit comments

Comments
 (0)