Serialize an Erlang term to signed encrypted binary and deserialize it back ensuring it's not been forged.
Some code extracted from https://github.com/mochi/mochiweb/blob/master/src/mochiweb_session.erl.check_expired/1 | |
decode/2 | Given a result of encode/2, i.e. |
decode_base64/2 | |
encode/2 | Serialize Term, encrypt and sign the result with Secret. |
encode_base64/2 | |
expires_by/2 | |
expiring/2 | |
issue_token/2 | |
issue_token/3 | |
verify_token/2 |
check_expired(Term) -> any()
decode(Cipher::binary(), Secret::binary()) -> {ok, Term::any()} | {error, forged} | {error, badarg}
Given a result of encode/2, i.e. a signed encrypted binary, check the signature, uncrypt and deserialize into original term. -----------------------------------------------------------------------------
decode_base64(Bin, Secret) -> any()
encode(Term::any(), Secret::binary()) -> Cipher::binary()
Serialize Term, encrypt and sign the result with Secret. Return binary(). -----------------------------------------------------------------------------
encode_base64(Term, Secret) -> any()
expires_by(Term, When) -> any()
expiring(Term, Ttl) -> any()
issue_token(Term::any(), Secret::binary()) -> Token::binary()
issue_token(Term::any(), Secret::binary(), Ttl::non_neg_integer()) -> Token::binary()
verify_token(Token::binary(), Secret::binary()) -> {ok, Term::any()} | {error, forged} | {error, badarg} | {error, expired}
Generated by EDoc