Skip to main content

WalletDescriptor

Struct WalletDescriptor 

Source
pub struct WalletDescriptor {
    pub group_pubkey: [u8; 32],
    pub external_descriptor: String,
    pub internal_descriptor: String,
    pub network: String,
    pub created_at: u64,
    pub device_registrations: Vec<DeviceRegistration>,
    pub policy_hash: [u8; 32],
    pub version: u32,
    pub previous_descriptor_hash: Option<[u8; 32]>,
    pub policy: Option<Value>,
}
Expand description

A finalized wallet descriptor associated with a FROST group.

Fields§

§group_pubkey: [u8; 32]

The FROST group public key this descriptor belongs to.

§external_descriptor: String

The external (receive) descriptor string.

§internal_descriptor: String

The internal (change) descriptor string.

§network: String

The Bitcoin network (e.g. “bitcoin”, “testnet”, “signet”, “regtest”).

§created_at: u64

Unix timestamp when the descriptor was created.

§device_registrations: Vec<DeviceRegistration>

Hardware signers that have registered this wallet.

§policy_hash: [u8; 32]

Hash of the wallet policy that produced this descriptor. Required for canonical descriptor hashing (matches the on-wire descriptor_hash computed as length-framed sha256(len(ext) || ext || len(int) || int || policy_hash)).

§version: u32

Monotonic version of the descriptor for this group. Starts at 1 for the initial descriptor and increments on each migration. Records persisted before versioning materialize as 1 via #[serde(default)] + default_descriptor_version.

§previous_descriptor_hash: Option<[u8; 32]>

Canonical hash of the descriptor this one supersedes, when this is a migration. None for the initial descriptor.

§policy: Option<Value>

The wallet policy that produced this descriptor, persisted as an opaque JSON value so keep-core does not depend on keep-frost-net. Callers reconstruct WalletPolicy via serde_json::from_value. Older records without this field deserialize with None.

Implementations§

Source§

impl WalletDescriptor

Source

pub fn device_registration( &self, signer_pubkey: &[u8; 32], ) -> Option<&DeviceRegistration>

Return the registration record for a signer pubkey, if any.

Source

pub fn upsert_device_registration(&mut self, reg: DeviceRegistration)

Insert or update the registration for a signer pubkey.

Source

pub fn canonical_hash(&self) -> [u8; 32]

Canonical descriptor hash with length framing to avoid collisions when the split between external/internal shifts: sha256(u64_le(ext.len) || ext || u64_le(int.len) || int || policy_hash [|| "keep/descriptor/version" || u32_le(version) when version > 1]).

The version suffix is only folded in for v2+ so v1 hashes remain bit-identical to records written before descriptor versioning existed (mirroring the conditional fold in hash_policy). TODO: drop the conditional suffix in vN+1 once all v1 records are migrated.

Must match the on-wire descriptor_hash used by the FROST PSBT coordination protocol.

Source

pub fn try_canonical_hash(&self) -> Result<[u8; 32], CanonicalHashError>

Fallible variant of [canonical_hash] that returns an error rather than panicking when version == 0. Prefer this in code paths that hash freshly-deserialized inputs without re-validating the version invariant.

Trait Implementations§

Source§

impl Clone for WalletDescriptor

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WalletDescriptor

Source§

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

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

impl<'de> Deserialize<'de> for WalletDescriptor

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for WalletDescriptor

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more