Skip to content

Commit 071658c

Browse files
Merge pull request #7564 from BitGo/WP-6903/fix-multi-key-user-key
fix: typo in multi-key-user-key feature
2 parents e03c706 + 1e31467 commit 071658c

File tree

4 files changed

+28
-32
lines changed

4 files changed

+28
-32
lines changed

modules/bitgo/test/v2/unit/wallet.ts

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,7 +2070,7 @@ describe('V2 Wallet:', function () {
20702070
getKeyNock.isDone().should.be.True();
20712071
});
20722072

2073-
describe('OFC Multi-User-Key Wallet Sharing', function () {
2073+
describe('OFC multi-key-user-Key Wallet Sharing', function () {
20742074
const userId = '123';
20752075
const email = '[email protected]';
20762076
const permissions = 'view,spend';
@@ -2081,7 +2081,7 @@ describe('V2 Wallet:', function () {
20812081
before(function () {
20822082
const ofcCoin = bitgo.coin('ofc');
20832083

2084-
// Regular OFC wallet without multi-user-key feature
2084+
// Regular OFC wallet without multi-key-user-key feature
20852085
const regularOfcWalletData = {
20862086
id: '5b34252f1bf349930e3400c00000000',
20872087
coin: 'ofc',
@@ -2096,24 +2096,20 @@ describe('V2 Wallet:', function () {
20962096
} as any;
20972097
ofcWallet = new Wallet(bitgo, ofcCoin, regularOfcWalletData);
20982098

2099-
// OFC wallet with multi-user-key feature
2099+
// OFC wallet with multi-key-user-key feature
21002100
const multiUserKeyWalletData = {
21012101
id: '5b34252f1bf349930e3400d00000000',
21022102
coin: 'ofc',
2103-
keys: [
2104-
'5b3424f91bf349930e34018400000000',
2105-
'5b3424f91bf349930e34018500000000',
2106-
'5b3424f91bf349930e34018600000000',
2107-
],
2103+
keys: ['5b3424f91bf349930e34018400000000'],
21082104
coinSpecific: {
2109-
features: ['multi-user-key'],
2105+
features: ['multi-key-user-key'],
21102106
},
21112107
multisigType: 'onchain',
21122108
type: 'hot',
21132109
} as any;
21142110
ofcMultiUserKeyWallet = new Wallet(bitgo, ofcCoin, multiUserKeyWalletData);
21152111

2116-
// Non-multi-user-key wallet for backwards compatibility tests
2112+
// Non-multi-key-user-key wallet for backwards compatibility tests
21172113
const nonMultiUserKeyWalletData = {
21182114
id: '5b34252f1bf349930e34020a00000003',
21192115
coin: 'ofc',
@@ -2132,7 +2128,7 @@ describe('V2 Wallet:', function () {
21322128
});
21332129

21342130
describe('createShare method', function () {
2135-
describe('multi-user-key wallets', function () {
2131+
describe('multi-key-user-key wallets', function () {
21362132
it('should exclude keychain property from API request', async function () {
21372133
const createShareParams = {
21382134
user: userId,
@@ -2168,7 +2164,7 @@ describe('V2 Wallet:', function () {
21682164

21692165
await ofcMultiUserKeyWallet
21702166
.createShare(createShareParams)
2171-
.should.be.rejectedWith('keychain property must not be provided for multi-user-key wallets');
2167+
.should.be.rejectedWith('keychain property must not be provided for multi-key-user-key wallets');
21722168
});
21732169

21742170
it('should omit keychain from request even when empty object is provided', async function () {
@@ -2193,7 +2189,7 @@ describe('V2 Wallet:', function () {
21932189
});
21942190
});
21952191

2196-
describe('non-multi-user-key wallets', function () {
2192+
describe('non-multi-key-user-key wallets', function () {
21972193
it('should include keychain property in API request when provided', async function () {
21982194
const createShareParams = {
21992195
user: userId,
@@ -2229,7 +2225,7 @@ describe('V2 Wallet:', function () {
22292225
});
22302226

22312227
describe('shareWallet method', function () {
2232-
describe('multi-user-key wallets', function () {
2228+
describe('multi-key-user-key wallets', function () {
22332229
it('should skip keychain preparation and set skipKeychain=true in API request', async function () {
22342230
const getSharingKeyNock = nock(bgUrl)
22352231
.post('/api/v1/user/sharingkey', { email })
@@ -2284,7 +2280,7 @@ describe('V2 Wallet:', function () {
22842280
});
22852281
});
22862282

2287-
describe('non-multi-user-key wallets', function () {
2283+
describe('non-multi-key-user-key wallets', function () {
22882284
it('should include keychain when wallet passphrase is provided', async function () {
22892285
const toKeychain = utxoLib.bip32.fromSeed(Buffer.from('deadbeef02deadbeef02deadbeef02deadbeef02', 'hex'));
22902286
const path = 'm/999999/1/1';
@@ -2307,7 +2303,7 @@ describe('V2 Wallet:', function () {
23072303
});
23082304

23092305
const createShareStub = sinon.stub(nonMultiUserKeyWallet, 'createShare').callsFake(async (options) => {
2310-
// For non-multi-user-key wallets, keychain should be present when spend permissions are included
2306+
// For non-multi-key-user-key wallets, keychain should be present when spend permissions are included
23112307
options!.keychain!.should.not.be.undefined();
23122308
options!.keychain!.pub!.should.equal(pub);
23132309
return undefined;
@@ -2322,15 +2318,15 @@ describe('V2 Wallet:', function () {
23222318
});
23232319
});
23242320

2325-
describe('multi-user-key detection', function () {
2326-
it('should detect multi-user-key wallet via coinSpecific.features array', async function () {
2321+
describe('multi-key-user-key detection', function () {
2322+
it('should detect multi-key-user-key wallet via coinSpecific.features array', async function () {
23272323
const ofcCoin: any = bitgo.coin('ofc');
23282324
const walletWithMultiUserKeyFeature = new Wallet(bitgo, ofcCoin, {
23292325
id: '5b34252f1bf349930e34020a00000004',
23302326
coin: 'ofc',
23312327
keys: ['5b3424f91bf349930e34017500000003'],
23322328
coinSpecific: {
2333-
features: ['multi-user-key'],
2329+
features: ['multi-key-user-key'],
23342330
},
23352331
type: 'hot',
23362332
});
@@ -2358,7 +2354,7 @@ describe('V2 Wallet:', function () {
23582354
.times(3)
23592355
.reply(200, { userId, pubkey: 'testpubkey', path: 'm/999999/1/1' });
23602356

2361-
// Multi-user-key wallet should skip keychain
2357+
// Multi-key-user-key wallet should skip keychain
23622358
const getEncryptedUserKeychainStub1 = sinon.stub(walletWithMultiUserKeyFeature, 'getEncryptedUserKeychain');
23632359
getEncryptedUserKeychainStub1.rejects(new Error('getEncryptedUserKeychain should not be called'));
23642360
const createShareStub1 = sinon
@@ -2371,14 +2367,14 @@ describe('V2 Wallet:', function () {
23712367
getEncryptedUserKeychainStub1.called.should.be.false();
23722368
createShareStub1.calledOnce.should.be.true();
23732369

2374-
// Wallet without multi-user-key feature should respect skipKeychain flag
2370+
// Wallet without multi-key-user-key feature should respect skipKeychain flag
23752371
const createShareStub2 = sinon.stub(walletWithoutFeature, 'createShare').callsFake(async (options) => {
23762372
return undefined;
23772373
});
23782374
await walletWithoutFeature.shareWallet({ email, permissions, skipKeychain: true });
23792375
createShareStub2.calledOnce.should.be.true();
23802376

2381-
// Wallet without coinSpecific should not be detected as multi-user-key
2377+
// Wallet without coinSpecific should not be detected as multi-key-user-key
23822378
const createShareStub3 = sinon.stub(walletWithoutCoinSpecific, 'createShare').callsFake(async (options) => {
23832379
return undefined;
23842380
});

modules/bitgo/test/v2/unit/wallets.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,7 @@ describe('V2 Wallets:', function () {
18851885
permissions: ['admin', 'spend', 'view'],
18861886
state: 'active',
18871887
userMultiKeyRotationRequired: true,
1888-
// No keychain - this is the key difference for multi-user-key shares
1888+
// No keychain - this is the key difference for multi-key-user-key shares
18891889
},
18901890
],
18911891
outgoing: [],
@@ -1957,7 +1957,7 @@ describe('V2 Wallets:', function () {
19571957
permissions: ['admin', 'spend', 'view'],
19581958
state: 'active',
19591959
userMultiKeyRotationRequired: true,
1960-
// No keychain - this is the key difference for multi-user-key shares
1960+
// No keychain - this is the key difference for multi-key-user-key shares
19611961
},
19621962
],
19631963
outgoing: [],
@@ -2140,10 +2140,10 @@ describe('V2 Wallets:', function () {
21402140
const encryptedPrv = bitgo.encrypt({ input: keychain.prv, password: userPassword });
21412141
sandbox.stub(bitgo, 'encrypt').returns(encryptedPrv);
21422142

2143-
// Should use the multi-user-key flow (no signature/payload/keyId)
2143+
// Should use the multi-key-user-key flow (no signature/payload/keyId)
21442144
const acceptShareNock = nock(bgUrl)
21452145
.post(`/api/v2/ofc/walletshare/${shareId}`, (body: any) => {
2146-
// Verify it's using multi-user-key flow (has pub and encryptedPrv, but no signature/payload/keyId)
2146+
// Verify it's using multi-key-user-key flow (has pub and encryptedPrv, but no signature/payload/keyId)
21472147
return (
21482148
body.walletShareId === shareId &&
21492149
body.state === 'accepted' &&
@@ -2161,7 +2161,7 @@ describe('V2 Wallets:', function () {
21612161

21622162
should.equal(res.changed, true);
21632163
should.equal(res.state, 'accepted');
2164-
// Verify reshare was NOT called (multi-user-key flow)
2164+
// Verify reshare was NOT called (multi-key-user-key flow)
21652165
should.equal(reshareStub.called, false);
21662166

21672167
walletShareNock.done();

modules/sdk-core/src/bitgo/wallet/wallet.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,7 @@ export class Wallet implements IWallet {
15951595
}
15961596

15971597
private isMultiUserKeyWallet(): boolean {
1598-
return this._wallet.coinSpecific?.features?.includes('multi-user-key') ?? false;
1598+
return this._wallet.coinSpecific?.features?.includes('multi-key-user-key') ?? false;
15991599
}
16001600

16011601
/**
@@ -1609,7 +1609,7 @@ export class Wallet implements IWallet {
16091609

16101610
if (isMultiUserKeyWallet) {
16111611
if (params.keychain && !_.isEmpty(params.keychain)) {
1612-
throw new Error('keychain property must not be provided for multi-user-key wallets');
1612+
throw new Error('keychain property must not be provided for multi-key-user-key wallets');
16131613
}
16141614
// Remove keychain from params if presents
16151615
return await this.bitgo.post(this.url('/share')).send(_.omit(params, 'keychain')).result();
@@ -1811,8 +1811,8 @@ export class Wallet implements IWallet {
18111811
throw new Error('Expected skipKeychain to be a boolean. ');
18121812
}
18131813

1814-
// Check if this is a multi-user-key OFC wallet
1815-
// For multi-user-key wallets, skip keychain preparation regardless of other conditions
1814+
// Check if this is a multi-key-user-key OFC wallet
1815+
// For multi-key-user-key wallets, skip keychain preparation regardless of other conditions
18161816
const needsKeychain =
18171817
!this.isMultiUserKeyWallet() &&
18181818
!params.skipKeychain &&

modules/sdk-core/src/bitgo/wallet/wallets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ export class Wallets implements IWallets {
904904
};
905905

906906
// Note: Unlike keychainOverrideRequired, we do NOT reshare the wallet with spenders
907-
// This is a key difference - multi-user-key wallets don't require reshare
907+
// This is a key difference - multi-key-user-key wallets don't require reshare
908908
return this.updateShare(updateParams);
909909
}
910910

0 commit comments

Comments
 (0)