Struct terra_rust_api::PrivateKey
source · [−]pub struct PrivateKey {
pub account: u32,
pub index: u32,
pub coin_type: u32,
/* private fields */
}
Expand description
The Private key structure that is used to generate signatures and public keys WARNING: No Security Audit has been performed
Fields
account: u32
index: u32
coin_type: u32
Implementations
sourceimpl PrivateKey
impl PrivateKey
sourcepub fn new<C: Signing + Context>(
secp: &Secp256k1<C>
) -> Result<PrivateKey, TerraRustAPIError>
pub fn new<C: Signing + Context>(
secp: &Secp256k1<C>
) -> Result<PrivateKey, TerraRustAPIError>
Generate a new private key
sourcepub fn new_seed<C: Signing + Context>(
secp: &Secp256k1<C>,
seed_phrase: &str
) -> Result<PrivateKey, TerraRustAPIError>
pub fn new_seed<C: Signing + Context>(
secp: &Secp256k1<C>,
seed_phrase: &str
) -> Result<PrivateKey, TerraRustAPIError>
generate a new private key with a seed phrase
sourcepub fn from_words<C: Signing + Context>(
secp: &Secp256k1<C>,
words: &str,
account: u32,
index: u32
) -> Result<PrivateKey, TerraRustAPIError>
pub fn from_words<C: Signing + Context>(
secp: &Secp256k1<C>,
words: &str,
account: u32,
index: u32
) -> Result<PrivateKey, TerraRustAPIError>
for private key recovery. This is also used by wallet routines to re-hydrate the structure
sourcepub fn from_words_seed<C: Signing + Context>(
secp: &Secp256k1<C>,
words: &str,
seed_pass: &str
) -> Result<PrivateKey, TerraRustAPIError>
pub fn from_words_seed<C: Signing + Context>(
secp: &Secp256k1<C>,
words: &str,
seed_pass: &str
) -> Result<PrivateKey, TerraRustAPIError>
for private key recovery with seed phrase
sourcepub fn public_key<C: Signing + Context>(&self, secp: &Secp256k1<C>) -> PublicKey
pub fn public_key<C: Signing + Context>(&self, secp: &Secp256k1<C>) -> PublicKey
generate the public key for this private key
sourcepub fn sign<C: Signing + Context>(
&self,
secp: &Secp256k1<C>,
blob: &str
) -> Result<StdSignature, TerraRustAPIError>
pub fn sign<C: Signing + Context>(
&self,
secp: &Secp256k1<C>,
blob: &str
) -> Result<StdSignature, TerraRustAPIError>
signs a blob of data and returns a StdSignature
Trait Implementations
sourceimpl Clone for PrivateKey
impl Clone for PrivateKey
sourcefn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnwindSafe for PrivateKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more