-
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.
- Loading branch information
1 parent
ae04427
commit 0d0cb55
Showing
9 changed files
with
199 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,36 @@ | ||
# defmodule Hipdster.Auth.JWT do | ||
# defmodule Internal do | ||
# use Rustler, otp_app: :hipdster, crate: "hipdster_auth_jwt_internal" | ||
|
||
# # Temp to satisfy Rustler | ||
# def add(_a, _b), do: :erlang.nif_error(:nif_not_loaded) | ||
# end | ||
# end | ||
defmodule Hipdster.Auth.JWT do | ||
defmodule Internal do | ||
use Rustler, otp_app: :hipdster, crate: "hipdster_auth_jwt_internal" | ||
|
||
def generate_k256_jwt(_account_did, _service_did, _subject, _key), | ||
do: :erlang.nif_error(:nif_not_loaded) | ||
def generate_hs256_jwt(_account_did, _subject, _hs256_key, _time_in_minutes), | ||
do: :erlang.nif_error(:nif_not_loaded) | ||
def verify_hs256_jwt(_jwt, _key), do: :erlang.nif_error(:nif_not_loaded) | ||
end | ||
|
||
import Hipdster.Helpers | ||
|
||
@spec interservice(Hipdster.User.t(), Hipdster.Identity.did(), String.t()) :: {:ok, binary()} | {:error, String.t()} | ||
def interservice( | ||
%Hipdster.User{ | ||
signing_key: %Hipdster.K256.PrivateKey{ | ||
privkey: <<>> <> signing_key_bytes | ||
}, | ||
did: user_did | ||
}, | ||
service_did, | ||
subject \\ "" | ||
) do | ||
Hipdster.Auth.JWT.Internal.generate_k256_jwt( | ||
user_did, | ||
service_did, | ||
subject, | ||
signing_key_bytes | ||
) | ||
end | ||
|
||
def! interservice(user, service_did, subject) | ||
def! interservice(user, service_did) | ||
|
||
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
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
Oops, something went wrong.