1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use crate*;
use fmt;
use Display;
/// ## Version 2: Sodium Original
///
/// See [the version 2 specification](https://github.com/paseto-standard/paseto-spec/blob/master/docs/01-Protocol-Versions/Version2.md) for details. At a glance:
///
/// * **`v2.local`**: Symmetric Encryption:
/// * XChaCha20-Poly1305 (192-bit nonce, 256-bit key, 128-bit authentication tag)
/// * Encrypting: `sodium_crypto_aead_xchacha20poly1305_ietf_encrypt()`
/// * Decrypting: `sodium_crypto_aead_xchacha20poly1305_ietf_decrypt()`
/// * The nonce is calculated from `sodium_crypto_generichash()` of the message,
/// with a BLAKE2b key provided by `random_bytes(24)` and an output length of 24,
/// during encryption only
/// * Reference implementation in [Version2.php](https://github.com/paragonie/paseto/blob/master/src/Protocol/Version2.php):
/// * See `aeadEncrypt()` for encryption
/// * See `aeadDecrypt()` for decryption
/// * **`v2.public`**: Asymmetric Authentication (Public-Key Signatures):
/// * Ed25519 (EdDSA over Curve25519)
/// * Signing: `sodium_crypto_sign_detached()`
/// * Verifying: `sodium_crypto_sign_verify_detached()`
/// * Reference implementation in [Version2.php](https://github.com/paragonie/paseto/blob/master/src/Protocol/Version2.php):
/// * See `sign()` for signature generation
/// * See `verify()` for signature verification
;