@@ -95,6 +95,39 @@ test('Encrypt using AES-256-GCM', t => {
9595
9696} ) ;
9797
98+ test ( "DynamicExtractKey using AES-256-ECB" , t => {
99+ t . plan ( 2 )
100+
101+ let user_key = JSON . parse ( '{"encrypted_passphrase":"3wIJtPoC8KO6S7x6LtrN0g==","public_key":"02f87f787bffb30396984cb6b3a9d6830f32d5b656b3e39b0abe4f3b3c35d99323","algorithm":{"pbkdf2_salt":"","pbkdf2_iterations":2048,"pbkdf2_hash_function":"SHA256","pbkdf2_phase1_key_length":16,"pbkdf2_phase2_key_length":32,"aes_iv":null,"aes_cipher":"AES-256-ECB","aes_auth_tag":null,"aes_auth_data":null}}' ) ;
102+
103+ t . doesNotThrow ( ( ) => {
104+ let key = CryptoHelper . dynamicExtractKey ( user_key , "deadbeef" ) ;
105+ t . equal ( key . pub . toString ( 'hex' ) , user_key . public_key , 'must return correct public key' ) ;
106+ } , undefined , 'does not throw any Errors' ) ;
107+ } ) ;
108+
109+ test ( "DynamicExtractKey using AES-256-CBC" , t => {
110+ t . plan ( 2 )
111+
112+ let user_key = JSON . parse ( '{"encrypted_passphrase":"LExu1rUAtIBOekslc328Lw==","public_key":"02f87f787bffb30396984cb6b3a9d6830f32d5b656b3e39b0abe4f3b3c35d99323","algorithm":{"pbkdf2_salt":"922445847c173e90667a19d90729e1fb","pbkdf2_iterations":500000,"pbkdf2_hash_function":"SHA256","pbkdf2_phase1_key_length":16,"pbkdf2_phase2_key_length":32,"aes_iv":"11bc22166c8cf8560e5fa7e5c622bb0f","aes_cipher":"AES-256-CBC","aes_auth_tag":null,"aes_auth_data":null}}' ) ;
113+
114+ t . doesNotThrow ( ( ) => {
115+ let key = CryptoHelper . dynamicExtractKey ( user_key , "deadbeef" ) ;
116+ t . equal ( key . pub . toString ( 'hex' ) , user_key . public_key , 'must return correct public key' ) ;
117+ } , undefined , 'does not throw any Errors' ) ;
118+ } ) ;
119+
120+ test ( "DynamicExtractKey using AES-256-GCM" , t => {
121+ t . plan ( 2 )
122+
123+ let user_key = JSON . parse ( '{"encrypted_passphrase":"ELV56Z57KoA=","public_key":"02f87f787bffb30396984cb6b3a9d6830f32d5b656b3e39b0abe4f3b3c35d99323","algorithm":{"pbkdf2_salt":"922445847c173e90667a19d90729e1fb","pbkdf2_iterations":500000,"pbkdf2_hash_function":"SHA256","pbkdf2_phase1_key_length":16,"pbkdf2_phase2_key_length":32,"aes_iv":"a57414b88b67f977829cbdca","aes_cipher":"AES-256-GCM","aes_auth_tag":"adeb7dfe53027bdda5824dc524d5e55a","aes_auth_data":""}}' ) ;
124+
125+ t . doesNotThrow ( ( ) => {
126+ let key = CryptoHelper . dynamicExtractKey ( user_key , "deadbeef" ) ;
127+ t . equal ( key . pub . toString ( 'hex' ) , user_key . public_key , 'must return correct public key' ) ;
128+ } , undefined , 'does not throw any Errors' ) ;
129+ } ) ;
130+
98131test ( 'Satoshis from value string' , t => {
99132 t . plan ( 4 ) ;
100133
0 commit comments