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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Allow deprecated error types within this module - these are used internally
// but deprecated for external users who should migrate to `crate::Error`.
//! The **core** architectural layer and feature contains only paseto primitives for lightweight
//! encrypting / decrypting or signing / verification
//!
//! 
//!
//! The **core** feature requires you to specify the version and purpose
//! ```toml
//! ## Includes only v4 modern sodium cipher crypto core and local (symmetric)
//! ## key types with NO claims, defaults or validation, just basic PASETO
//! ## encrypt/signing and decrypt/verification.
//!
//! rusty_paseto = {version = "latest", features = ["core", "v4_local"] }
//!
//! ```
//! # Example usage
//! ```
//! # #[cfg(feature = "v4_local")]
//! # {
//! # use serde_json::json;
//! use rusty_paseto::core::*;
//!
//! let key = PasetoSymmetricKey::<V4, Local>::from(Key::<32>::try_from("707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f")?);
//! let nonce = Key::<32>::try_from("0000000000000000000000000000000000000000000000000000000000000000")?;
//! // generate a random nonce with
//! // let nonce = Key::<32>::try_new_random()?;
//! let nonce = PasetoNonce::<V4, Local>::from(&nonce);
//!
//! let payload = json!({"data": "this is a secret message", "exp":"2022-01-01T00:00:00+00:00"}).to_string();
//! let payload = payload.as_str();
//! let payload = Payload::from(payload);
//!
//! //create a public v4 token
//! let token = Paseto::<V4, Local>::builder()
//! .set_payload(payload)
//! .try_encrypt(&key, &nonce)?;
//!
//! //validate the test vector
//! assert_eq!(token.to_string(), "v4.local.AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAr68PS4AXe7If_ZgesdkUMvSwscFlAl1pk5HC0e8kApeaqMfGo_7OpBnwJOAbY9V7WU6abu74MmcUE8YWAiaArVI8XJ5hOb_4v9RmDkneN0S92dx0OW4pgy7omxgf3S8c3LlQg");
//!
//! //now let's try to decrypt it
//! let json = Paseto::<V4, Local>::try_decrypt(&token, &key, None, None)?;
//! assert_eq!(payload, json);
//! }
//! # Ok::<(),anyhow::Error>(())
//! ```
pub use PasetoError;
pub use Footer;
pub use Header;
pub use ImplicitAssertion;
pub use ;
pub use Paseto;
pub use Payload;
pub use ;
pub use ;
pub use ;
pub use UntrustedToken;
pub use *;