Seed Keeper Core is a small Rust library for managing a seed phrase and deriving keys from it.
```rust use seedkeepercore::{randseed, Seed, Secret, ExposeSecret, derivekey}; use seedkeepercore::wrap::{encrypt, decrypt};
// Generate a secure random seed of 32 bytes:
let seed: Secret
// Derive key material from a username (salt) and password:
let password = "some random words that you made up, for sure!".to_string(); let salt = b"some@email.com"; // Salt should be unique per password
let key = derive_key(&password, salt).unwrap();
asserteq!( key.exposesecret(), &Seed::new([ 164, 103, 254, 113, 126, 241, 57, 240, 100, 56, 243, 125, 155, 224, 40, 242, 178, 136, 222, 133, 220, 141, 127, 10, 88, 199, 181, 11, 241, 91, 149, 249 ]) );
// Protect your new seed by encrypting it with the password and salt key:
let encrypted = encrypt( (key.exposesecret()).tryinto().unwrap(), // Deref &Seed to [u8; 32] seed.exposesecret(), ); let decrypted = decrypt((key.exposesecret()).tryinto().unwrap(), &encrypted); asserteq!(**seed.exposesecret(), *decrypted.asslice()); ```