Magic.Token (magic_admin v0.9.0) View Source
Provides methods to interact with the DID Token.
Link to this section Summary
Types
A map of claims made by the DID Token
A DID Token generated by a Magic user on the client-side.
Decentralized identifier which encapsulates a unique user ID
Cryptographic public address of the Magic User.
Functions
Parses public_address and extracts issuer
Decodes a DID Token from a Base64 string into a tuple of its individual components: proof and claim. This method allows you decode the DID Token and inspect the token
Decodes a DID Token from a Base64 string into a tuple of its individual components: proof and claim. This method allows you decode the DID Token and inspect the token
Parses did_token and extracts issuer
Parses did_token and extracts cryptographic public_address
Validates did_token
Validates did_token
Link to this section Types
Specs
claim() :: %{ add: String.t(), aud: String.t(), ext: integer(), iat: integer(), iss: String.t(), nbf: integer(), sub: String.t(), tid: String.t() }
A map of claims made by the DID Token
Specs
did_token() :: String.t()
A DID Token generated by a Magic user on the client-side.
Specs
issuer() :: String.t()
Decentralized identifier which encapsulates a unique user ID
Specs
public_address() :: String.t()
Cryptographic public address of the Magic User.
Link to this section Functions
Specs
construct_issuer_with_public_address(public_address()) :: issuer()
Parses public_address and extracts issuer
Returns issuer info
Specs
decode(did_token()) :: {:ok, %{proof: String.t(), claim: claim(), message: String.t()}} | {:error, {:did_token_error, String.t()}}
Decodes a DID Token from a Base64 string into a tuple of its individual components: proof and claim. This method allows you decode the DID Token and inspect the token
Returns an :ok tuple with a map containing proof, claim and message or an error tuple
Specs
Decodes a DID Token from a Base64 string into a tuple of its individual components: proof and claim. This method allows you decode the DID Token and inspect the token
Returns A map containing proof, claim and message or raise an error
Specs
Parses did_token and extracts issuer
Returns issuer info
Specs
get_public_address(did_token()) :: public_address()
Parses did_token and extracts cryptographic public_address
Returns cryptographic public address of the Magic User who generated the supplied DID Token.
Specs
Validates did_token
Returns :ok or an error tuple
Specs
validate!(did_token()) :: true
Validates did_token
Returns true or raises an error