Lightning.Tokens.CredentialTransferToken (Lightning v2.19.0-pre)
View SourceA short-lived, ownership-bound token for confirming a credential transfer.
The owner, credential and receiver are baked into the signed payload, so
they cannot be swapped by editing the confirmation URL. The token is
stateless: revocation and single-use are enforced by the credential's
transfer_status (a cancelled or completed transfer fails the pending and
ownership guards in Lightning.Credentials.confirm_transfer/2), not by the
token itself.
The sub uses a credential_transfer: prefix rather than user: so these
tokens are rejected by Lightning.Tokens.verify/1 and cannot double as API
bearer tokens.
Summary
Functions
Combines generate_claims/1 and encode_and_sign/2
Same as generate_and_sign/2 but raises if error
Combines verify/2 and validate/2
Same as verify_and_validate/2 but raises if error
Functions
@spec generate_and_sign(Joken.claims(), Joken.signer_arg()) :: {:ok, Joken.bearer_token(), Joken.claims()} | {:error, Joken.error_reason()}
Combines generate_claims/1 and encode_and_sign/2
@spec generate_and_sign!(Joken.claims(), Joken.signer_arg()) :: Joken.bearer_token()
Same as generate_and_sign/2 but raises if error
@spec verify_and_validate(Joken.bearer_token(), Joken.signer_arg(), term()) :: {:ok, Joken.claims()} | {:error, Joken.error_reason()}
Combines verify/2 and validate/2
@spec verify_and_validate!(Joken.bearer_token(), Joken.signer_arg(), term()) :: Joken.claims()
Same as verify_and_validate/2 but raises if error