pub struct MasterKey(/* private fields */);Expand description
A 32-byte AES-256 master key.
Construct via MasterKey::from_bytes, MasterKey::from_file,
MasterKey::from_keyring, MasterKey::resolve, or
MasterKey::generate.
Implementations§
Source§impl MasterKey
impl MasterKey
Sourcepub const fn from_bytes(bytes: [u8; 32]) -> Self
pub const fn from_bytes(bytes: [u8; 32]) -> Self
Construct from explicit bytes. The agent must keep the bytes
confidential; the wrapper offers no extra protection beyond not
implementing Debug or Display.
Sourcepub fn from_keyring() -> Result<Self>
pub fn from_keyring() -> Result<Self>
Look up the master key in the OS keyring under
(vibesurfer, default). Reads the entry as a hex string so it
round-trips through cross-platform secret stores that don’t
tolerate raw bytes.
Sourcepub fn resolve(fallback_path: impl AsRef<Path>) -> Result<Self>
pub fn resolve(fallback_path: impl AsRef<Path>) -> Result<Self>
Try the OS keyring first; fall back to path. Errors only if
both fail.
Sourcepub fn write_to_file(&self, path: impl AsRef<Path>) -> Result<()>
pub fn write_to_file(&self, path: impl AsRef<Path>) -> Result<()>
Persist the key as 32 raw bytes at path. Caller is responsible
for chmod-ing the file (typically 0600) and for ensuring the
destination directory exists.
Sourcepub fn write_to_keyring(&self) -> Result<()>
pub fn write_to_keyring(&self) -> Result<()>
Persist the key into the OS keyring as a hex string.