object
paseto
Facade for PASETO v4 JSON claims encryption, signing, authentication, validation, and key selection.
logtalk_load(paseto(loader))static, context_switching_callsPublic predicates
encrypt/4
Encrypts a JSON claims object as a v4.local token.
staticencrypt(Claims,Key,Token,Options)encrypt(+term,+list(byte),-atom,+list(compound)) - one_or_errorClaims is not a JSON object or contains duplicate members:domain_error(paseto_json_object,Claims)Key is not a list of 32 bytes:type_error(list(byte,32),Key)kid conflicts with the key_id/1 option:domain_error(paseto_footer_key_id,Existing-KeyId)Options is a variable:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is a variable:instantiation_errorOption of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)decrypt/4
Authenticates and decrypts a v4.local claims token using a key or key set.
staticdecrypt(Token,KeyOrKeySet,Claims,Options)decrypt(+atom,+term,-term,+list(compound)) - zero_or_one_or_errorToken is not a canonical v4.local token:domain_error(paseto_v4_token,Token)KeyOrKeySet is an invalid key set:domain_error(paseto_key_set,KeyOrKeySet)KeyOrKeySet:existence_error(paseto_key,local-KeyId)domain_error(paseto_json_object,Claims)domain_error(paseto_claims,Reason)Options is a variable:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is a variable:instantiation_errorOption of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)decrypt/5
Authenticates and decrypts a v4.local claims token and returns its authenticated footer JSON object.
staticdecrypt(Token,KeyOrKeySet,Claims,Footer,Options)decrypt(+atom,+term,-term,-term,+list(compound)) - zero_or_one_or_errorToken is not a canonical v4.local token:domain_error(paseto_v4_token,Token)KeyOrKeySet is an invalid key set:domain_error(paseto_key_set,KeyOrKeySet)KeyOrKeySet:existence_error(paseto_key,local-KeyId)domain_error(paseto_json_object,JSON)domain_error(paseto_claims,Reason)Options is a variable:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is a variable:instantiation_errorOption of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)sign/4
Signs a JSON claims object as a v4.public token using an Ed25519 seed.
staticsign(Claims,Seed,Token,Options)sign(+term,+list(byte),-atom,+list(compound)) - one_or_errorClaims is not a JSON object or contains duplicate members:domain_error(paseto_json_object,Claims)Seed is not a list of 32 bytes:type_error(list(byte,32),Seed)kid conflicts with the key_id/1 option:domain_error(paseto_footer_key_id,Existing-KeyId)Options is a variable:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is a variable:instantiation_errorOption of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)verify/4
Authenticates and validates a v4.public claims token using a public key or key set.
staticverify(Token,KeyOrKeySet,Claims,Options)verify(+atom,+term,-term,+list(compound)) - zero_or_one_or_errorToken is not a canonical v4.public token:domain_error(paseto_v4_token,Token)KeyOrKeySet is an invalid key set:domain_error(paseto_key_set,KeyOrKeySet)KeyOrKeySet:existence_error(paseto_key,(public-KeyId))domain_error(paseto_json_object,Claims)domain_error(paseto_claims,Reason)Options is a variable:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is a variable:instantiation_errorOption of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)verify/5
Authenticates and validates a v4.public claims token and returns its authenticated footer JSON object.
staticverify(Token,KeyOrKeySet,Claims,Footer,Options)verify(+atom,+term,-term,-term,+list(compound)) - zero_or_one_or_errorToken is not a canonical v4.public token:domain_error(paseto_v4_token,Token)KeyOrKeySet is an invalid key set:domain_error(paseto_key_set,KeyOrKeySet)KeyOrKeySet:existence_error(paseto_key,(public-KeyId))domain_error(paseto_json_object,JSON)domain_error(paseto_claims,Reason)Options is a variable:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is a variable:instantiation_errorOption of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)claims/2
Decodes claims from a v4.public token without authenticating them. Rejects local tokens. The result must not be trusted.
staticclaims(Token,Claims)claims(+atom,-term) - one_or_errorToken is a variable:instantiation_errorToken is neither a variable nor an atom:type_error(atom,Token)Token is not a canonical v4.public token:domain_error(paseto_v4_token,Token)Token has a malformed public payload:domain_error(paseto_v4_public_payload,Token)Token payload is not a JSON object:domain_error(paseto_json_object,Claims)claim/3
Looks up a value in a claims object.
staticclaim(Claims,Name,Value)claim(+term,+atom,-term) - zero_or_onevalidate_claims/3
Validates a claims object using a policy list and options.
staticvalidate_claims(Claims,Policy,Options)validate_claims(+term,+list(compound),+list(compound)) - one_or_errorClaims is not a JSON object or contains duplicate members:domain_error(paseto_json_object,Claims)Claims is missing a required claim Name:domain_error(paseto_claims,missing(Name))Policy contains an invalid claim policy:domain_error(paseto_claim_policy,ClaimPolicy)type_error(time_number,Name-Value)Options is a variable:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is a variable:instantiation_errorOption of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)validate_claim/3
Validates one claim policy.
staticvalidate_claim(Claims,ClaimPolicy,Options)validate_claim(*,*,*)validate_claim(+term,+compound,+list(compound)) - one_or_errorClaims is missing the required claim Name:domain_error(paseto_claims,missing(Name))Name does not satisfy the policy:domain_error(paseto_claim(Name),Value)ClaimPolicy is not a supported claim policy:domain_error(paseto_claim_policy,ClaimPolicy)domain_error(paseto_time_claim_kind,Kind)type_error(time_number,Name-Value)Options is a variable:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is a variable:instantiation_errorOption of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)peek_key_id/2
Reads a kid value from the unauthenticated token footer for key selection. The result must not be trusted.
staticpeek_key_id(Token,KeyId)peek_key_id(+atom,-atom) - zero_or_one_or_errorToken is a variable:instantiation_errorToken is neither a variable nor an atom:type_error(atom,Token)Token is not a canonical v4 token:domain_error(paseto_v4_token,Token)Token footer is not a JSON object:domain_error(paseto_json_object,Footer)validate_key_set/1
Validates a native PASETO key_set/1 term.
staticvalidate_key_set(KeySet)validate_key_set(+compound) - one_or_errorKeySet is not a valid key_set/1 term:domain_error(paseto_key_set,KeySet)KeySet contains an invalid key record Record:domain_error(paseto_key_record,Record)Protected predicates
(no local declarations; see entity ancestors if any)
Private predicates
(no local declarations; see entity ancestors if any)
Operators
(none)