pub struct Key {
    pub secret_key: Option<SecretKey>,
    pub public_key: Option<PublicKey>,
    pub mnemonic_phrase: Option<String>,
    pub private_key: String,
    pub private_key_hex: String,
    pub short_address: Id,
    pub eth_address: String,
}

Fields

secret_key: Option<SecretKey>public_key: Option<PublicKey>mnemonic_phrase: Option<String>

Mnemonic phrase (optional).

private_key: String

AVAX wallet compatible private key. NEVER save mainnet-funded wallet keys here.

private_key_hex: String

Used for importing keys in MetaMask and subnet-cli. ref. https://github.com/ava-labs/subnet-cli/blob/5b69345a3fba534fb6969002f41c8d3e69026fed/internal/key/key.go#L238-L258 NEVER save mainnet-funded wallet keys here.

short_address: Id

ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/utils/hashing#PubkeyBytesToAddress

eth_address: String

ref. https://pkg.go.dev/github.com/ethereum/go-ethereum/common#Address

Implementations

Generates a new Secp256k1 key.

Loads the specified Secp256k1 key with CB58 encoding. Takes the “private_key” field in the “Key” struct.

Loads the specified Secp256k1 key with CB58 encoding. Takes the “private_key” field in the “Key” struct.

Loads the specified Secp256k1 key with hex encoding. Takes the “private_key” field in the “Key” struct.

source

pub fn private_key_info_entry(
    &self,
    network_id: u32
) -> Result<PrivateKeyInfoEntry>

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

ref. https://doc.rust-lang.org/std/str/trait.FromStr.html

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

ref. https://doc.rust-lang.org/book/ch10-02-traits.html

Implements “crypto.PublicKeySECP256K1R.Address()” and “formatting.FormatAddress”. “human readable part” (hrp) must be valid output from “constants.GetHRP(networkID)”. ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/utils/constants Read more

Serialize this value into the given Serde serializer. Read more

Signs the message with the ECDSA secret key and appends the recovery code to the signature. ref. https://github.com/rust-bitcoin/rust-secp256k1/blob/master/src/ecdsa/recovery.rs ref. https://docs.rs/secp256k1/latest/secp256k1/struct.SecretKey.html#method.sign_ecdsa ref. https://docs.rs/secp256k1/latest/secp256k1/struct.Message.html ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/utils/crypto#PrivateKeyED25519.SignHash Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.