pub enum UserKey {
X25519(Identity),
Pq(Identity),
}Expand description
One user’s encryption key (the private half).
Variants§
X25519(Identity)
An age X25519 key: the default.
Pq(Identity)
age’s hybrid ML-KEM-768 + X25519 key, for quantum-safe repositories.
Implementations§
Source§impl UserKey
impl UserKey
Sourcepub fn generate(level: Level) -> Result<UserKey, UserKeyError>
pub fn generate(level: Level) -> Result<UserKey, UserKeyError>
A new user key for repositories of level.
Sourcepub fn public(&self) -> String
pub fn public(&self) -> String
The public half: what a members line and the server hold
(age1…, or age1pq1…).
Sourcepub fn identity(&self) -> &dyn Identity
pub fn identity(&self) -> &dyn Identity
As an age identity: what opens a repository’s key ring.
Sourcepub fn wrap_to(&self, recipient: &dyn Recipient) -> Result<String, UserKeyError>
pub fn wrap_to(&self, recipient: &dyn Recipient) -> Result<String, UserKeyError>
Wrap this key to one unlock method’s age recipient: one armored age file, to be stored on the server as the method’s wrap.
Sourcepub fn wrap_to_security_key(
&self,
recipient: &str,
) -> Result<String, UserKeyError>
pub fn wrap_to_security_key( &self, recipient: &str, ) -> Result<String, UserKeyError>
Wrap this key to a security key’s recipient (the age1… string
security_key::recipient gave at enrolment).
Sourcepub fn wrap_to_recovery_code(&self, code: &str) -> Result<String, UserKeyError>
pub fn wrap_to_recovery_code(&self, code: &str) -> Result<String, UserKeyError>
Wrap this key to a printed recovery code: age’s scrypt stanza at the
FIXED work factor recovery_code::LOG_N (scrypt N = 2^18, r = 8,
p = 1: about 256 MiB and a second), on top of the code’s 160 random bits.
Sourcepub fn wrap_to_ssh(&self, public_key: &str) -> Result<String, UserKeyError>
pub fn wrap_to_ssh(&self, public_key: &str) -> Result<String, UserKeyError>
Wrap this key to an SSH public key line (ssh-ed25519 …, ssh-rsa …).
Sourcepub fn wrap_to_pq(&self, public_key: &str) -> Result<String, UserKeyError>
pub fn wrap_to_pq(&self, public_key: &str) -> Result<String, UserKeyError>
Wrap this key to an age1pq1… key (a key file made by
gunnar crypt keygen).