Skip to content

Commit

Permalink
feat: add to hex functions
Browse files Browse the repository at this point in the history
Signed-off-by: bkioshn <bkioshn@gmail.com>
  • Loading branch information
bkioshn committed Nov 5, 2024
1 parent d1a67e7 commit cbe61e4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ anyhow = "1.0.91"
bip39 = "2.0.0"
sha2 = "0.10"
bip32 = "0.5.1"
hex = "0.4.3"

[lints.rust]
warnings = "deny"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ impl Bip32Ed25519XPrivateKey {
Bip32Ed25519XPrivateKey(xprv_bytes)
}

/// Convert to a hex string.
#[frb(sync)]
pub fn to_hex(&self) -> String {
hex::encode(&self.0)
}

/// Get the inner bytes.
#[frb(getter, sync)]
pub fn get_inner(&self) -> [u8; 96] {
Expand Down Expand Up @@ -200,6 +206,12 @@ impl Bip32Ed25519XPublicKey {
Bip32Ed25519XPublicKey(xpub_bytes)
}

/// Convert to a hex string.
#[frb(sync)]
pub fn to_hex(&self) -> String {
hex::encode(&self.0)
}

/// Get the inner bytes.
#[frb(getter, sync)]
pub fn get_inner(&self) -> [u8; 64] {
Expand Down Expand Up @@ -276,6 +288,12 @@ impl Bip32Ed25519Signature {
Bip32Ed25519Signature(sig_bytes)
}

/// Convert to a hex string.
#[frb(sync)]
pub fn to_hex(&self) -> String {
hex::encode(&self.0)
}

/// Get the inner bytes.
#[frb(getter, sync)]
pub fn get_inner(&self) -> [u8; 64] {
Expand Down

0 comments on commit cbe61e4

Please sign in to comment.