Skip to content

Commit

Permalink
feat(sdk-core): implement root key creation for eddsa multisig
Browse files Browse the repository at this point in the history
implemented root key creation for eddsa multisig, deprecated ed25519 Key deriver

WP-1401

TICKET: WP-1401
  • Loading branch information
alebusse committed Feb 20, 2024
1 parent 816f0ef commit a4dc28e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion modules/bitgo/test/v2/unit/internal/tssUtils/ecdsa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ describe('TSS Ecdsa Utils:', async function () {
});

// Seems to be flaky on CI, failed here: https://github.com/BitGo/BitGoJS/actions/runs/5902489990/job/16010623888?pr=3822
it.skip('createOfflineMuDeltaShare should succeed', async function () {
xit('createOfflineMuDeltaShare should succeed', async function () {
const mockPassword = 'password';
const alphaLength = 1536;
const deltaLength = 64;
Expand Down
13 changes: 11 additions & 2 deletions modules/sdk-core/src/bitgo/baseCoin/baseCoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,20 @@ export abstract class BaseCoin implements IBaseCoin {

/**
* Generate a key pair on the curve used by the coin
*
* @param seed
* @param {Buffer} seed - seed to use for key pair generation
* @returns {KeyPair} the generated key pair
*/
abstract generateKeyPair(seed?: Buffer): KeyPair;

/**
* Generate a root key pair on the curve used by the coin
* @param {Buffer} seed - seed to use for key pair generation
* @returns {KeyPair} the generated key pair
*/
generateRootKeyPair(seed?: Buffer): KeyPair {
throw new NotImplementedError('generateRootKeyPair is not supported for this coin');
}

/**
* Return boolean indicating whether input is valid public key for the coin.
*
Expand Down
1 change: 1 addition & 0 deletions modules/sdk-core/src/bitgo/baseCoin/iBaseCoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ export interface IBaseCoin {
initiateRecovery(params: InitiateRecoveryOptions): never;
parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction>;
generateKeyPair(seed?: Buffer): KeyPair;
generateRootKeyPair(seed?: Buffer): KeyPair;
isValidPub(pub: string): boolean;
isValidMofNSetup(params: ValidMofNOptions): boolean;
isValidAddress(address: string): boolean;
Expand Down
2 changes: 1 addition & 1 deletion modules/sdk-core/src/bitgo/keychain/iKeychains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export interface IKeychains {
list(params?: ListKeychainOptions): Promise<ListKeychainsResult>;
updatePassword(params: UpdatePasswordOptions): Promise<ChangedKeychains>;
updateSingleKeychainPassword(params?: UpdateSingleKeychainPasswordOptions): Keychain;
create(params?: { seed?: Buffer }): KeyPair;
create(params?: { seed?: Buffer; isRootKey?: boolean }): KeyPair;
add(params?: AddKeychainOptions): Promise<Keychain>;
createBitGo(params?: CreateBitGoOptions): Promise<Keychain>;
createBackup(params?: CreateBackupOptions): Promise<Keychain>;
Expand Down
10 changes: 8 additions & 2 deletions modules/sdk-core/src/bitgo/keychain/keychains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,15 @@ export class Keychains implements IKeychains {

/**
* Create a public/private key pair
* @param params.seed
* @param params - optional params
* @param params.seed optional - seed to use for keypair generation
* @param params.isRootKey optional - whether the resulting keypair should be a root key
* @returns {KeyPair} - the generated keypair
*/
create(params: { seed?: Buffer } = {}): KeyPair {
create(params: { seed?: Buffer; isRootKey?: boolean } = {}): KeyPair {
if (params?.isRootKey) {
return this.baseCoin.generateRootKeyPair(params.seed);
}
return this.baseCoin.generateKeyPair(params.seed);
}

Expand Down

0 comments on commit a4dc28e

Please sign in to comment.