Skip to main content

LocalKey

Struct LocalKey 

Source
pub struct LocalKey { /* private fields */ }
Expand description

A secp256k1 key held in memory, from a key file’s text (32-byte hex, sign.mjs loadKey). Nothing here prints or displays the key.

Implementations§

Source§

impl LocalKey

Source

pub fn new(key: SecretKey) -> Self

From a secret key.

Source

pub fn from_bytes(bytes: &[u8; 32]) -> Result<Self>

From 32 bytes.

Source

pub fn from_hex(text: &str) -> Result<Self>

From a key file’s text: 64 hex characters, surrounding whitespace ignored (sign.mjs loadKey).

Source

pub fn pubkey_hex(&self) -> String

The x-only public key as 64 lowercase hex characters.

Trait Implementations§

Source§

impl BlockSigner for LocalKey

Source§

fn pubkey(&self) -> XOnlyPublicKey

The x-only key that sits in the federation’s leaf.
Source§

fn sign_partial(&self, request: &PartialRequest<'_>) -> Result<Signature>

A BIP-340 signature over a block template’s tapscript sighash.
Source§

fn sign_pegout_input( &self, request: &PegoutSignRequest<'_>, ) -> Result<Signature>

A BIP-340 signature over one peg-out input’s tapscript sighash.
Source§

impl Debug for LocalKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Signer for LocalKey

Source§

fn pubkey_hex(&self) -> Result<String>

The x-only public key every event from this signer carries, as 64 lowercase hex characters.
Source§

fn sign(&self, request: &SignRequest<'_>) -> Result<[u8; 64]>

A BIP-340 signature over SignRequest::id, or a refusal.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> RoundSigner for T
where T: Signer + BlockSigner + ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V