mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-05 05:06:14 +01:00
chore: remove unwraps from nut13
This commit is contained in:
@@ -55,6 +55,11 @@ pub enum Error {
|
||||
#[error("`{0}`")]
|
||||
Secret(#[from] super::secret::Error),
|
||||
#[error("`{0}`")]
|
||||
NUT02(#[from] crate::nuts::nut02::Error),
|
||||
#[cfg(feature = "nut13")]
|
||||
#[error("`{0}`")]
|
||||
Bip32(#[from] bip32::Error),
|
||||
#[error("`{0}`")]
|
||||
ParseInt(#[from] std::num::ParseIntError),
|
||||
/// Custom error
|
||||
#[error("`{0}`")]
|
||||
|
||||
@@ -11,10 +11,9 @@ impl Secret {
|
||||
pub fn from_seed(mnemonic: &Mnemonic, keyset_id: Id, counter: u64) -> Result<Self, Error> {
|
||||
let path = DerivationPath::from_str(&format!(
|
||||
"m/129372'/0'/{}'/{}'/0",
|
||||
u64::try_from(keyset_id).unwrap(),
|
||||
u64::try_from(keyset_id)?,
|
||||
counter
|
||||
))
|
||||
.unwrap();
|
||||
))?;
|
||||
|
||||
let xpriv = XPrv::derive_from_path(mnemonic.to_seed(""), &path).unwrap();
|
||||
|
||||
@@ -26,12 +25,11 @@ impl SecretKey {
|
||||
pub fn from_seed(mnemonic: &Mnemonic, keyset_id: Id, counter: u64) -> Result<Self, Error> {
|
||||
let path = DerivationPath::from_str(&format!(
|
||||
"m/129372'/0'/{}'/{}'/1",
|
||||
u64::try_from(keyset_id).unwrap(),
|
||||
u64::try_from(keyset_id)?,
|
||||
counter
|
||||
))
|
||||
.unwrap();
|
||||
))?;
|
||||
|
||||
let signing_key = XPrv::derive_from_path(mnemonic.to_seed(""), &path).unwrap();
|
||||
let signing_key = XPrv::derive_from_path(mnemonic.to_seed(""), &path)?;
|
||||
|
||||
let private_key = signing_key.private_key();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user