This repository has been archived by the owner on Oct 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added ucan token validate function
- Loading branch information
Showing
4 changed files
with
38 additions
and
6 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,10 +1,20 @@ | ||
defmodule ExUcan.Core.Plugins do | ||
Check warning on line 1 in lib/ex_ucan/core/plugins.ex GitHub Actions / Build and test (1.15.7, 26.0.2)
|
||
alias ExUcan.Plugins.Ed25519.Crypto | ||
# TODO: docs | ||
|
||
@spec verify_issuer_alg(String.t(), String.t()) :: boolean() | ||
def verify_issuer_alg(did, jwt_alg) do | ||
end | ||
|
||
@spec verify_signature(String.t(), String.t(), String.t()) :: boolean() | ||
def verify_signature(did, data, signature) do | ||
{:ok, public_key} = Crypto.did_to_publickey(did) | ||
IO.inspect(public_key) | ||
IO.inspect(data) | ||
IO.inspect(signature) | ||
:public_key.verify(data, :ignored, signature, {:ed_pub, :ed25519, public_key}) | ||
end | ||
|
||
@spec parseDidMethod(String.t()) :: String.t() | ||
defp parseDidMethod(did) do | ||
parts = String.split(did, ":") | ||
|
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