pub struct JsHydraPrivate { /* private fields */ }
Expand description
Private keys of a Hydra account in a vault.
@see HydraPlugin.priv
Implementations§
Source§impl JsHydraPrivate
impl JsHydraPrivate
Sourcepub fn public(&self) -> JsHydraPublic
pub fn public(&self) -> JsHydraPublic
Access to the public keys of the account. Same as {@link HydraPlugin.pub} would return.
Sourcepub fn key(&mut self, idx: i32) -> Result<JsBip44Key, JsValue>
pub fn key(&mut self, idx: i32) -> Result<JsBip44Key, JsValue>
Calculates the receiving address having the given index and takes note that the address was already generated in the account.
@see Bip44Account.key, Bip44Account.chain
Sourcepub fn key_by_pk(&self, id: &JsSecpPublicKey) -> Result<JsBip44Key, JsValue>
pub fn key_by_pk(&self, id: &JsSecpPublicKey) -> Result<JsBip44Key, JsValue>
Finds the {@link Bip44Key} private api that belongs to the given {@link SecpPublicKey}. You can check the index of the key or get the actual {@link SecpPrivateKey} from the returned object.
Throws an error if the public key is not in this account, which can also happen when the key was derived outside the vault and therefore the vault does not know it was already used. In that case, make sure to “touch” the last key index used by calling {@link key} before calling this method.
Sourcepub fn xpub(&self) -> Result<String, JsValue>
pub fn xpub(&self) -> Result<String, JsValue>
The extended public key for auditing the whole Bip44 account or deriving new public keys outside the vault.
Sourcepub fn xprv(&self) -> String
pub fn xprv(&self) -> String
The extended private key for the whole account. This is only for exporting into other BIP32 compatible wallets.
This is a secret that must not be kept unencrypted in transit or in rest!
Sourcepub fn receive_keys(&self) -> Result<u32, JsValue>
pub fn receive_keys(&self) -> Result<u32, JsValue>
How many receive addresses have been used in this {@link Bip44Account}
Sourcepub fn change_keys(&self) -> Result<u32, JsValue>
pub fn change_keys(&self) -> Result<u32, JsValue>
How many change addresses have been used in this {@link Bip44Account}
Sourcepub fn sign_hydra_transaction(
&self,
hyd_addr: &str,
tx: &JsValue,
) -> Result<JsValue, JsValue>
pub fn sign_hydra_transaction( &self, hyd_addr: &str, tx: &JsValue, ) -> Result<JsValue, JsValue>
Signs the Hydra transaction with the private key that belongs to the given P2PKH address.
Fills in signature and id fields, so those can be missing in the unsigned input, but the public key needs to be already properly set to the one matching the signer address.
Throws an error if the address is not in this account, which can also happen when the key was derived outside the vault and therefore the vault does not know it was already used. In that case, make sure to “touch” the last key index used by calling {@link key} before calling this method.
Trait Implementations§
Source§impl From<JsHydraPrivate> for JsValue
impl From<JsHydraPrivate> for JsValue
Source§fn from(value: JsHydraPrivate) -> Self
fn from(value: JsHydraPrivate) -> Self
Source§impl From<Private> for JsHydraPrivate
impl From<Private> for JsHydraPrivate
Source§impl FromWasmAbi for JsHydraPrivate
impl FromWasmAbi for JsHydraPrivate
Source§impl IntoWasmAbi for JsHydraPrivate
impl IntoWasmAbi for JsHydraPrivate
Source§impl LongRefFromWasmAbi for JsHydraPrivate
impl LongRefFromWasmAbi for JsHydraPrivate
Source§impl OptionFromWasmAbi for JsHydraPrivate
impl OptionFromWasmAbi for JsHydraPrivate
Source§impl OptionIntoWasmAbi for JsHydraPrivate
impl OptionIntoWasmAbi for JsHydraPrivate
Source§impl RefFromWasmAbi for JsHydraPrivate
impl RefFromWasmAbi for JsHydraPrivate
Source§type Anchor = RcRef<JsHydraPrivate>
type Anchor = RcRef<JsHydraPrivate>
Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for JsHydraPrivate
impl RefMutFromWasmAbi for JsHydraPrivate
Source§impl TryFromJsValue for JsHydraPrivate
impl TryFromJsValue for JsHydraPrivate
Source§impl VectorFromWasmAbi for JsHydraPrivate
impl VectorFromWasmAbi for JsHydraPrivate
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[JsHydraPrivate]>
Source§impl VectorIntoJsValue for JsHydraPrivate
impl VectorIntoJsValue for JsHydraPrivate
fn vector_into_jsvalue(vector: Box<[JsHydraPrivate]>) -> JsValue
Source§impl VectorIntoWasmAbi for JsHydraPrivate
impl VectorIntoWasmAbi for JsHydraPrivate
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[JsHydraPrivate]>) -> Self::Abi
Source§impl WasmDescribeVector for JsHydraPrivate
impl WasmDescribeVector for JsHydraPrivate
Source§impl Wraps<Private> for JsHydraPrivate
impl Wraps<Private> for JsHydraPrivate
impl SupportsConstructor for JsHydraPrivate
impl SupportsInstanceProperty for JsHydraPrivate
impl SupportsStaticProperty for JsHydraPrivate
Auto Trait Implementations§
impl Freeze for JsHydraPrivate
impl !RefUnwindSafe for JsHydraPrivate
impl !Send for JsHydraPrivate
impl !Sync for JsHydraPrivate
impl Unpin for JsHydraPrivate
impl !UnwindSafe for JsHydraPrivate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abi
Source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.