44// Load order: sjcl.js → crypto_utils.js → bip39_utils.js → bip39.js
55//
66const bip39_const = {
7- "test_phrase" : "army van defense carry jealous true garbage claim echo media make crunch" , // random phrase used for test derive
8- "expected_seed" : "5b56c417303faa3fcba7e57400e120a0ca83ec5a4fc9ffba757fbe63fbd77a89a1a3be4c67196f57c39a88b76373733891bfaba16ed27a813ceed498804c0570" , // expected seed used for test derive
9- "expected_address" : "1HQ3rb7nyLPrjnuW85MUknPekwkn7poAUm" , // expected addres used for test derive
7+ "test_phrase" : bip39_utils_const . test_phrase , // random phrase used for test derive
8+ "expected_seed" : bip39_utils_const . expected_seed , // expected seed used for test derive
9+ "expected_address" : bip39_utils_const . expected_address , // expected addres used for test derive
1010 "c_derive" : {
1111 "bitcoin" : true ,
1212 "litecoin" : true ,
@@ -83,10 +83,7 @@ $(document).ready(function() {
8383 backup_continue ( ) ;
8484 //check_phrase
8585 //get_mnemonic_phrase
86- //validate_mnemonic
87- //find_invalid_word
8886 //verify_phrase
89- //shuffle_array
9087 verify_words ( ) ;
9188 //update_address_lists
9289 continue_seed ( ) ;
@@ -100,15 +97,8 @@ $(document).ready(function() {
10097
10198 // ** Key Derivation Core: **
10299 //hmac_encrypt
103- //mnemonic_to_seed
104- //parse_seed
105- //generate_mnemonic
106- //to_mnemonic
107100
108101 // ** BIP32 Derivation: **
109- //objectify_extended
110- //derive_x
111- //derive_child_key
112102 //keypair_array
113103 //ext_keys
114104 //xpub_obj
@@ -120,8 +110,6 @@ $(document).ready(function() {
120110 //derive_new_address
121111 //get_latest_index
122112 //key_cc
123- //key_cc_xpub
124- //get_rootkey
125113 //derive_all_init
126114 //derive_all
127115 //derive_add_address
@@ -840,16 +828,6 @@ function get_mnemonic_phrase() {
840828 return clean_string ( $ ( "#bip39phrase" ) . text ( ) ) ;
841829}
842830
843- // Validates BIP39 mnemonic using SHA256 hash comparison (delegated to library)
844- function validate_mnemonic ( mnemonic ) {
845- return Bip39Utils . validate_mnemonic ( mnemonic ) ;
846- }
847-
848- // Returns first word from input array not found in BIP39 wordlist (delegated to library)
849- function find_invalid_word ( word_list ) {
850- return Bip39Utils . find_invalid_word ( word_list ) ;
851- }
852-
853831// Creates UI elements for verifying selected words from seed phrase
854832function verify_phrase ( word_list , word_count ) {
855833 const word_indices = word_list . map ( ( word , i ) => ( {
@@ -869,11 +847,6 @@ function verify_phrase(word_list, word_count) {
869847 } ) ;
870848}
871849
872- // Implements Fisher-Yates shuffle algorithm for array randomization (delegated to library)
873- function shuffle_array ( array ) {
874- return Bip39Utils . shuffle_array ( array ) ;
875- }
876-
877850// Handles word verification input and triggers appropriate callbacks
878851function verify_words ( ) {
879852 $ ( document ) . on ( "input" , "#seed_verify_box input" , function ( e ) {
@@ -1115,44 +1088,6 @@ function hmac_encrypt(key) {
11151088 } ;
11161089}
11171090
1118- // Converts mnemonic to seed using PBKDF2 (delegated to library)
1119- function mnemonic_to_seed ( mnemonic , passphrase ) {
1120- return Bip39Utils . mnemonic_to_seed ( mnemonic , passphrase ) ;
1121- }
1122-
1123- // Normalizes mnemonic and passphrase for seed generation (delegated to library)
1124- function parse_seed ( mnemonic , input_passphrase ) {
1125- return Bip39Utils . parse_seed ( mnemonic , input_passphrase ) ;
1126- }
1127-
1128- // Generates random mnemonic phrase of specified length (delegated to library)
1129- function generate_mnemonic ( word_count ) {
1130- return Bip39Utils . generate_mnemonic ( word_count ) ;
1131- }
1132-
1133- // Converts random bytes to mnemonic using wordlist (delegated to library)
1134- function to_mnemonic ( byte_array ) {
1135- return Bip39Utils . to_mnemonic ( byte_array ) ;
1136- }
1137-
1138- // ** BIP32 Derivation: **
1139- // Note: Core BIP32 functions are now provided by assets_js_lib_bip39_utils.js
1140-
1141- // Parses extended key format into component parts (delegated to library)
1142- function objectify_extended ( extended_key ) {
1143- return Bip39Utils . objectify_extended ( extended_key ) ;
1144- }
1145-
1146- // Performs BIP32 hierarchical key derivation (delegated to library)
1147- function derive_x ( derive_params , from_private ) {
1148- return Bip39Utils . derive_x ( derive_params , from_private ) ;
1149- }
1150-
1151- // Derives child keys using BIP32 algorithm (delegated to library)
1152- function derive_child_key ( parent_key , chain_code , child_index , is_public , is_hardened ) {
1153- return Bip39Utils . derive_child_key ( parent_key , chain_code , child_index , is_public , is_hardened ) ;
1154- }
1155-
11561091// Generates array of derived key pairs for given range
11571092function keypair_array ( seed , indices , start_index , derive_path , bip32_config , key , chain_code , coin , version ) {
11581093 const derived_pairs = [ ] ;
@@ -1365,16 +1300,6 @@ function key_cc() {
13651300 return false
13661301}
13671302
1368- // Extracts key and chaincode components from xpub string (delegated to library)
1369- function key_cc_xpub ( xpub ) {
1370- return Bip39Utils . key_cc_xpub ( xpub ) ;
1371- }
1372-
1373- // Generates master root key from seed using HMAC-SHA512 (delegated to library)
1374- function get_rootkey ( seed ) {
1375- return Bip39Utils . get_rootkey ( seed ) ;
1376- }
1377-
13781303// Sets initial account settings and derives addresses for all currencies
13791304function derive_all_init ( phrase , seed_id , extra ) {
13801305 derive_all ( phrase , seed_id , extra ) ;
0 commit comments