pub struct MasterKeypair { /* private fields */ }Expand description
An Ed25519 master keypair for signing BitRouter JWTs.
The private key is 64 bytes: 32-byte seed concatenated with 32-byte public key (standard Ed25519 keypair format). The public key alone is 32 bytes.
Implementations§
Source§impl MasterKeypair
impl MasterKeypair
Sourcepub fn from_keypair_bytes(bytes: &[u8; 64]) -> Result<Self, JwtError>
pub fn from_keypair_bytes(bytes: &[u8; 64]) -> Result<Self, JwtError>
Reconstruct from the 64-byte keypair bytes (seed + public key).
Sourcepub fn to_keypair_bytes(&self) -> [u8; 64]
pub fn to_keypair_bytes(&self) -> [u8; 64]
Serialize to the 64-byte keypair format (seed + public key).
Sourcepub fn signing_key(&self) -> &SigningKey
pub fn signing_key(&self) -> &SigningKey
Return the signing key (for JWT signing).
Sourcepub fn verifying_key(&self) -> VerifyingKey
pub fn verifying_key(&self) -> VerifyingKey
Return the verifying (public) key.
Sourcepub fn public_key_b64(&self) -> String
pub fn public_key_b64(&self) -> String
The 32-byte public key, base64url-encoded (no padding).
This is the value used as the iss claim in JWTs.
Sourcepub fn public_key_prefix(&self) -> String
pub fn public_key_prefix(&self) -> String
A short prefix of the public key for display and directory naming. Returns the first 16 characters of the base64url-encoded public key.
Sourcepub fn to_json(&self) -> MasterKeyJson
pub fn to_json(&self) -> MasterKeyJson
Serialize to the JSON format stored in master.json.
Sourcepub fn from_json(json: &MasterKeyJson) -> Result<Self, JwtError>
pub fn from_json(json: &MasterKeyJson) -> Result<Self, JwtError>
Deserialize from the JSON format stored in master.json.
Trait Implementations§
Source§impl Clone for MasterKeypair
impl Clone for MasterKeypair
Source§fn clone(&self) -> MasterKeypair
fn clone(&self) -> MasterKeypair
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MasterKeypair
impl RefUnwindSafe for MasterKeypair
impl Send for MasterKeypair
impl Sync for MasterKeypair
impl Unpin for MasterKeypair
impl UnsafeUnpin for MasterKeypair
impl UnwindSafe for MasterKeypair
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more