File tree Expand file tree Collapse file tree
sdk-core/src/bitgo/keychain Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -341,6 +341,37 @@ describe('V2 Keychains', function () {
341341 const keys = await keychains . updatePassword ( { oldPassword : oldPassword , newPassword : newPassword } ) ;
342342 validateKeys ( keys , newPassword , 1 ) ;
343343 } ) ;
344+
345+ it ( 'should update multi-user-ofc keys' , async function ( ) {
346+ nock ( bgUrl )
347+ . get ( '/api/v2/tltc/key' )
348+ . query ( true )
349+ . reply ( 200 , {
350+ keys : [
351+ {
352+ id : 'randomid1' ,
353+ encryptedPrv : bitgo . encrypt ( { input : 'xprv1' , password : oldPassword } ) ,
354+ coinSpecific : {
355+ ofc : {
356+ features : [ 'multi-user-key' ] ,
357+ } ,
358+ } ,
359+ } ,
360+ {
361+ id : 'randomid2' ,
362+ encryptedPrv : bitgo . encrypt ( { input : 'xprv2' , password : otherPassword } ) ,
363+ coinSpecific : {
364+ ofc : {
365+ features : [ 'multi-user-key' ] ,
366+ } ,
367+ } ,
368+ } ,
369+ ] ,
370+ } ) ;
371+
372+ const keys = await keychains . updatePassword ( { oldPassword : oldPassword , newPassword : newPassword } ) ;
373+ validateKeys ( keys , newPassword , 1 ) ;
374+ } ) ;
344375 } ) ;
345376
346377 describe ( 'Create TSS Keychains' , function ( ) {
Original file line number Diff line number Diff line change @@ -119,7 +119,11 @@ export class Keychains implements IKeychains {
119119 newPassword : params . newPassword ,
120120 } ) ;
121121 if ( updatedKeychain . encryptedPrv ) {
122- const changedKeyIdentifier = updatedKeychain . type === 'tss' ? updatedKeychain . id : updatedKeychain . pub ;
122+ // Both TSS and multi-user-ofc keys have multiple public keys in their key document and thus need to use objectID
123+ const changedKeyIdentifier =
124+ updatedKeychain . type === 'tss' || Keychains . isMultiUserKey ( updatedKeychain )
125+ ? updatedKeychain . id
126+ : updatedKeychain . pub ;
123127 if ( changedKeyIdentifier ) {
124128 changedKeys [ changedKeyIdentifier ] = updatedKeychain . encryptedPrv ;
125129 }
You can’t perform that action at this time.
0 commit comments