@@ -70,7 +70,7 @@ impl<const N: usize> IndexConstPath<N> {
7070 root_derivation_path
7171 }
7272
73- pub fn derive_priv_for_seed (
73+ pub fn derive_priv_for_master_seed (
7474 & self ,
7575 seed : & [ u8 ] ,
7676 add_derivation_path : DerivationPath ,
@@ -82,16 +82,26 @@ impl<const N: usize> IndexConstPath<N> {
8282 sk. derive_priv ( & secp, & path)
8383 }
8484
85- pub fn derive_pub_for_seed (
85+ pub fn derive_pub_for_master_seed (
8686 & self ,
8787 seed : & [ u8 ] ,
8888 add_derivation_path : DerivationPath ,
8989 network : Network ,
9090 ) -> Result < ExtendedPubKey , Error > {
9191 let secp = Secp256k1 :: new ( ) ;
92- let sk = self . derive_priv_for_seed ( seed, add_derivation_path, network) ?;
92+ let sk = self . derive_priv_for_master_seed ( seed, add_derivation_path, network) ?;
9393 Ok ( ExtendedPubKey :: from_priv ( & secp, & sk) )
9494 }
95+
96+ pub fn derive_pub_for_master_extended_public_key (
97+ & self ,
98+ master_extended_public_key : ExtendedPubKey ,
99+ add_derivation_path : DerivationPath ,
100+ ) -> Result < ExtendedPubKey , Error > {
101+ let secp = Secp256k1 :: new ( ) ;
102+ let path = self . append_path ( add_derivation_path) ;
103+ master_extended_public_key. derive_pub ( & secp, & path)
104+ }
95105}
96106
97107// Constants for feature purposes and sub-features
@@ -104,7 +114,7 @@ pub const FEATURE_PURPOSE_IDENTITIES_SUBFEATURE_REGISTRATION: u32 = 1;
104114pub const FEATURE_PURPOSE_IDENTITIES_SUBFEATURE_TOPUP : u32 = 2 ;
105115pub const FEATURE_PURPOSE_IDENTITIES_SUBFEATURE_INVITATIONS : u32 = 3 ;
106116pub const FEATURE_PURPOSE_DASHPAY : u32 = 15 ;
107- pub const IDENTITY_REGISTRATION_PATH : IndexConstPath < 4 > = IndexConstPath {
117+ pub const IDENTITY_REGISTRATION_PATH_MAINNET : IndexConstPath < 4 > = IndexConstPath {
108118 indexes : [
109119 ChildNumber :: Hardened { index : FEATURE_PURPOSE } ,
110120 ChildNumber :: Hardened { index : DASH_COIN_TYPE } ,
@@ -127,7 +137,7 @@ pub const IDENTITY_REGISTRATION_PATH_TESTNET: IndexConstPath<4> = IndexConstPath
127137} ;
128138
129139// Identity Top-Up Paths
130- pub const IDENTITY_TOPUP_PATH : IndexConstPath < 4 > = IndexConstPath {
140+ pub const IDENTITY_TOPUP_PATH_MAINNET : IndexConstPath < 4 > = IndexConstPath {
131141 indexes : [
132142 ChildNumber :: Hardened { index : FEATURE_PURPOSE } ,
133143 ChildNumber :: Hardened { index : DASH_COIN_TYPE } ,
@@ -150,7 +160,7 @@ pub const IDENTITY_TOPUP_PATH_TESTNET: IndexConstPath<4> = IndexConstPath {
150160} ;
151161
152162// Identity Invitation Paths
153- pub const IDENTITY_INVITATION_PATH : IndexConstPath < 4 > = IndexConstPath {
163+ pub const IDENTITY_INVITATION_PATH_MAINNET : IndexConstPath < 4 > = IndexConstPath {
154164 indexes : [
155165 ChildNumber :: Hardened { index : FEATURE_PURPOSE } ,
156166 ChildNumber :: Hardened { index : DASH_COIN_TYPE } ,
@@ -173,7 +183,7 @@ pub const IDENTITY_INVITATION_PATH_TESTNET: IndexConstPath<4> = IndexConstPath {
173183} ;
174184
175185// Authentication Keys Paths
176- pub const IDENTITY_AUTHENTICATION_PATH : IndexConstPath < 4 > = IndexConstPath {
186+ pub const IDENTITY_AUTHENTICATION_PATH_MAINNET : IndexConstPath < 4 > = IndexConstPath {
177187 indexes : [
178188 ChildNumber :: Hardened { index : FEATURE_PURPOSE } ,
179189 ChildNumber :: Hardened { index : DASH_COIN_TYPE } ,
0 commit comments