Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(iota-keys): Support the Shimmer coin type for the derivation path validation #1742

Merged
merged 5 commits into from
Aug 13, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion crates/iota-keys/src/key_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use iota_types::{
use slip10_ed25519::derive_ed25519_private_key;

pub const DERIVATION_PATH_COIN_TYPE: u32 = 4218;
pub const DERIVATION_PATH_COIN_TYPE_SHIMMER: u32 = 4219;
pub const DERVIATION_PATH_PURPOSE_ED25519: u32 = 44;
pub const DERVIATION_PATH_PURPOSE_SECP256K1: u32 = 54;
pub const DERVIATION_PATH_PURPOSE_SECP256R1: u32 = 74;
Expand Down Expand Up @@ -82,8 +83,11 @@ pub fn validate_path(
if let &[purpose, coin_type, account, change, address] = p.as_ref() {
if Some(purpose)
== ChildNumber::new(DERVIATION_PATH_PURPOSE_ED25519, true).ok()
&& Some(coin_type)
&& (Some(coin_type)
== ChildNumber::new(DERIVATION_PATH_COIN_TYPE, true).ok()
|| Some(coin_type)
== ChildNumber::new(DERIVATION_PATH_COIN_TYPE_SHIMMER, true)
.ok())
thibault-martinez marked this conversation as resolved.
Show resolved Hide resolved
&& account.is_hardened()
&& change.is_hardened()
&& address.is_hardened()
Expand Down
Loading