Expand description
Encryption utilities for secure sync.
Provides end-to-end encryption for snippet data using AES-256-GCM with Argon2 key derivation. All snippets are encrypted before transmission and decrypted upon receipt.
§Security Model
- Encryption: AES-256-GCM (authenticated encryption)
- Key Derivation: Argon2id from API key + random salt
- Nonce: Random 12-byte nonce per encryption (stored with ciphertext)
§Example
use snip_it::encryption::{decrypt, encrypt};
let api_key = "your-api-key";
let encrypted = encrypt(api_key, "sensitive data").unwrap();
let decrypted = decrypt(api_key, &encrypted).unwrap();
assert_eq!(decrypted, "sensitive data");Structs§
- Encrypted
Payload - Encrypted data container with salt, nonce, and ciphertext.
Enums§
Functions§
- clear_
key_ cache - Clear the session key cache. Should be called at the end of a sync operation.
- decrypt
- encrypt