pub struct MasterKeypair { /* private fields */ }Expand description
A master keypair for signing BitRouter JWTs across chains.
Stores a 32-byte seed that deterministically derives:
- Ed25519 keypair (Solana) via
solana-keypair - secp256k1 keypair (EVM) via
alloy-signer-local
Implementations§
Source§impl MasterKeypair
impl MasterKeypair
Sourcepub fn solana_pubkey_b58(&self) -> String
pub fn solana_pubkey_b58(&self) -> String
Solana public key as a base58-encoded string.
Sourcepub fn evm_signer(&self) -> Result<PrivateKeySigner, JwtError>
pub fn evm_signer(&self) -> Result<PrivateKeySigner, JwtError>
Construct an alloy PrivateKeySigner from the seed.
Sourcepub fn evm_address(&self) -> Result<Address, JwtError>
pub fn evm_address(&self) -> Result<Address, JwtError>
Derive the EVM address (checksummed hex with 0x prefix).
Sourcepub fn evm_address_string(&self) -> Result<String, JwtError>
pub fn evm_address_string(&self) -> Result<String, JwtError>
EVM address as a checksummed hex string (e.g. "0xAb5801...").
Sourcepub fn caip10(&self, chain: &Chain) -> Result<Caip10, JwtError>
pub fn caip10(&self, chain: &Chain) -> Result<Caip10, JwtError>
Derive the CAIP-10 account identifier for a given chain.
Sourcepub fn public_key_prefix(&self) -> String
pub fn public_key_prefix(&self) -> String
A short prefix for display and directory naming.
Uses the first 16 characters of the Solana base58 public key.
Sourcepub fn sign_ed25519(&self, message: &[u8]) -> Vec<u8> ⓘ
pub fn sign_ed25519(&self, message: &[u8]) -> Vec<u8> ⓘ
Sign a byte slice using Ed25519 (Solana / SOL_EDDSA) via the Solana SDK.
Returns the 64-byte Ed25519 signature.
Sourcepub fn sign_eip191(&self, message: &[u8]) -> Result<Vec<u8>, JwtError>
pub fn sign_eip191(&self, message: &[u8]) -> Result<Vec<u8>, JwtError>
Sign a byte slice using EIP-191 prefixed secp256k1 (EVM / EIP191K).
The alloy signer applies the "\x19Ethereum Signed Message:\n{len}"
prefix, hashes with keccak256, and signs with secp256k1 ECDSA.
Returns the 65-byte signature (r[32] + s[32] + v[1]).
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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more