View Source jose_chacha20_poly1305 behaviour (JOSE v1.11.9)
Summary
Types
-type additional_authenticated_data() :: binary().
-type chacha20_key() :: <<_:256>>.
-type chacha20_nonce() :: <<_:96>>.
-type cipher_text() :: binary().
-type message() :: binary().
-type plain_text() :: binary().
-type poly1305_mac() :: <<_:128>>.
Callbacks
-callback authenticate(Message, Key, Nonce) -> MAC when Message :: message(), Key :: chacha20_key(), Nonce :: chacha20_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 :: chacha20_nonce(), Key :: chacha20_key(), PlainText :: binary().
-callback encrypt(PlainText, AAD, IV, Key) -> {CipherText, CipherTag} when PlainText :: plain_text(), AAD :: additional_authenticated_data(), IV :: chacha20_nonce(), Key :: chacha20_key(), CipherText :: cipher_text(), CipherTag :: poly1305_mac().
-callback verify(MAC, Message, Key, Nonce) -> boolean() when MAC :: poly1305_mac(), Message :: message(), Key :: chacha20_key(), Nonce :: chacha20_nonce().