pub struct Key(_);
Expand description

Represents “k256::SecretKey” and “k256::ecdsa::SigningKey”.

Implementations§

Generates a private key from random bytes.

Loads the private key from the raw scalar bytes.

Converts the private key to raw scalar bytes.

Hex-encodes the raw private key to string with “0x” prefix (e.g., Ethereum).

Loads the private key from a hex-encoded string (e.g., Ethereum).

Encodes the raw private key to string with “PrivateKey-” prefix (e.g., Avalanche).

Loads the private key from a CB58-encoded string (e.g., Avalanche). Once decoded and with its “PrivateKey-” prefix removed, the length must be 32-byte.

Derives the public key from this private key.

Converts to Info.

Signs the 32-byte SHA256 output message with the ECDSA private key and the recoverable code. “github.com/decred/dcrd/dcrec/secp256k1/v3/ecdsa.SignCompact” outputs 65-byte signature. ref. “avalanchego/utils/crypto.PrivateKeySECP256K1R.SignHash” ref. https://github.com/rust-bitcoin/rust-secp256k1/blob/master/src/ecdsa/recovery.rs

TODO: remove this after upstream “ethers-core” migrates to “k256” >= 0.12

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
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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
Signs the 32-byte SHA256 output message with the ECDSA private key and the recoverable code. “github.com/decred/dcrd/dcrec/secp256k1/v3/ecdsa.SignCompact” outputs 65-byte signature. ref. “avalanchego/utils/crypto.PrivateKeySECP256K1R.SignHash” 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

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.

Converts to this type from a reference to the input type.
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Wrap the input message T in a tonic::Request
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
Converts the given value to a String. 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.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more