View Source jose_xchacha20_poly1305 behaviour (JOSE v1.11.10)
Summary
Types
-type additional_authenticated_data() :: binary().
-type cipher_text() :: binary().
-type message() :: binary().
-type plain_text() :: binary().
-type poly1305_mac() :: <<_:128>>.
-type xchacha20_key() :: <<_:256>>.
-type xchacha20_nonce() :: <<_:192>>.
Callbacks
-callback authenticate(Message, Key, Nonce) -> MAC when Message :: message(), Key :: xchacha20_key(), Nonce :: xchacha20_nonce(), MAC :: poly1305_mac().
-callback decrypt(CipherText, CipherTag, AAD, IV, Key) -> PlainText | error when CipherText :: cipher_text(), CipherTag :: poly1305_mac(), AAD :: additional_authenticated_data(), IV :: xchacha20_nonce(), Key :: xchacha20_key(), PlainText :: binary().
-callback encrypt(PlainText, AAD, IV, Key) -> {CipherText, CipherTag} when PlainText :: plain_text(), AAD :: additional_authenticated_data(), IV :: xchacha20_nonce(), Key :: xchacha20_key(), CipherText :: cipher_text(), CipherTag :: poly1305_mac().
-callback verify(MAC, Message, Key, Nonce) -> boolean() when MAC :: poly1305_mac(), Message :: message(), Key :: xchacha20_key(), Nonce :: xchacha20_nonce().