@@ -42,6 +42,7 @@ describe('Wallets - encryptionVersion threading', function () {
4242 . returns ( { result : sinon . stub ( ) . resolves ( { acceptedWalletShares : [ ] , walletShareUpdateErrors : [ ] } ) } ) ,
4343 } ) ,
4444 getECDHKeychain : sinon . stub ( ) . resolves ( { encryptedXprv : 'encXprv' } ) ,
45+ verifyPassword : sinon . stub ( ) . resolves ( true ) ,
4546 setRequestTracer : sinon . stub ( ) ,
4647 url : sinon . stub ( ) . returns ( '/test/url' ) ,
4748 } ;
@@ -145,18 +146,34 @@ describe('Wallets - encryptionVersion threading', function () {
145146 assert . strictEqual ( call . args [ 1 ] , undefined ) ;
146147 } ) ;
147148
148- it ( 'accepts a UMKR-only batch without fetching the ECDH keychain' , async function ( ) {
149- mockBitGo . getECDHKeychain . resolves ( new Error ( 'missing' ) ) ;
150-
149+ it ( 'validates the login password without fetching the ECDH keychain for a UMKR-only batch' , async function ( ) {
151150 await wallets . bulkAcceptShare ( {
152151 walletShareIds : [ 'share-id' ] ,
153152 userLoginPassword : 'login-password' ,
154153 } ) ;
155154
156155 assert . strictEqual ( mockBitGo . getECDHKeychain . called , false ) ;
156+ assert . deepStrictEqual ( mockBitGo . verifyPassword . firstCall . args , [ { password : 'login-password' } ] ) ;
157157 assert . strictEqual ( mockBitGo . put . called , true ) ;
158158 } ) ;
159159
160+ it ( 'rejects a UMKR-only batch when the login password is incorrect' , async function ( ) {
161+ mockBitGo . verifyPassword . resolves ( false ) ;
162+
163+ await assert . rejects (
164+ wallets . bulkAcceptShare ( {
165+ walletShareIds : [ 'share-id' ] ,
166+ userLoginPassword : 'incorrect-password' ,
167+ } ) ,
168+ { message : 'Incorrect password. Please try again.' }
169+ ) ;
170+
171+ assert . strictEqual ( mockBitGo . getECDHKeychain . called , false ) ;
172+ assert . strictEqual ( mockBitGo . createEncryptionSession . called , false ) ;
173+ assert . strictEqual ( mockKeychains . create . called , false ) ;
174+ assert . strictEqual ( mockBitGo . put . called , false ) ;
175+ } ) ;
176+
160177 it ( 'still requires the ECDH keychain when the batch also holds a share with a keychain' , async function ( ) {
161178 mockBitGo . get . returns ( {
162179 result : sinon . stub ( ) . resolves ( {
@@ -187,6 +204,7 @@ describe('Wallets - encryptionVersion threading', function () {
187204 { message : 'encryptedXprv was not found on sharing keychain' }
188205 ) ;
189206 assert . strictEqual ( mockBitGo . getECDHKeychain . calledOnce , true ) ;
207+ assert . strictEqual ( mockBitGo . verifyPassword . called , false ) ;
190208 } ) ;
191209
192210 it ( 'processes shares in batches of 16 to avoid WASM memory exhaustion' , async function ( ) {
0 commit comments