Struct PrivateCode

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

Represents the private side of a payment code, as seen from the perspective of the sender. This is what the sender will use in conjunction with a receiver’s public payment code in order to be able to send funds.

Implementations§

Source§

impl PrivateCode

Source

pub fn from_seed( seed: &[u8], account: u32, network: Network, ) -> Result<Self, Error>

Constructs a new payment code from the private side using a BIP32 seed.

Source

pub fn from_seed_ephemeral( seed: &[u8], account: u32, network: Network, ephemeral_index: u32, ) -> Result<Self, Error>

Constructs a new ephemeral payment code at the given index from the private side using a BIP32 seed.

Source

pub fn v1_public_code( &self, bitmessage: Option<BitMessagePreference>, ) -> PublicCode

Generates a version 1 public payment code matching this private payment code, optionally with bitmessage.

Source

pub fn v2_public_code(&self) -> PublicCode

Generates a version 2 public payment code matching this private payment code.

Source

pub fn private_key( &self, sender_code: &PublicCode, i: u32, ) -> Result<PrivateKey, Error>

Derives a receive private key at the given index, with respect to a public payment code. Used for spending purposes. If the index is invalid, it should be incremented.

Source

pub fn address( &self, sender_code: &PublicCode, i: u32, segwit: bool, ) -> Result<Address, Error>

Derives a receive address at the given index. If the index is invalid, it should be incremented.

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.