diff --git a/packages/hdwallet-native/package.json b/packages/hdwallet-native/package.json index e372f1fb6..0a43b6b9a 100644 --- a/packages/hdwallet-native/package.json +++ b/packages/hdwallet-native/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@bitcoinerlab/secp256k1": "^1.1.1", - "@noble/curves": "^1.7.3", + "@noble/curves": "^1.4.0", "@shapeshiftoss/bitcoinjs-lib": "7.0.0-shapeshift.0", "@shapeshiftoss/fiosdk": "1.2.1-shapeshift.6", "@shapeshiftoss/hdwallet-core": "1.57.1", diff --git a/packages/hdwallet-native/src/crypto/isolation/core/ed25519/index.ts b/packages/hdwallet-native/src/crypto/isolation/core/ed25519/index.ts index ade9dfe7e..bc2016ee3 100644 --- a/packages/hdwallet-native/src/crypto/isolation/core/ed25519/index.ts +++ b/packages/hdwallet-native/src/crypto/isolation/core/ed25519/index.ts @@ -12,7 +12,7 @@ export type Ed25519Key = { }; export class Ed25519Node extends Revocable(class {}) { - readonly #privateKey: ByteArray; // Changed to privateKey + readonly #privateKey: ByteArray; readonly #chainCode: ByteArray; readonly explicitPath?: string; @@ -29,7 +29,7 @@ export class Ed25519Node extends Revocable(class {}) { } async getPublicKey(): Promise { - // Generate public key using noble-curves ed25519 + // Generate public key from private key return Buffer.from(ed25519.getPublicKey(this.#privateKey)); } @@ -38,7 +38,6 @@ export class Ed25519Node extends Revocable(class {}) { } async sign(message: Uint8Array): Promise { - // Sign using noble-curves ed25519 return Buffer.from(ed25519.sign(message, this.#privateKey)); } @@ -51,7 +50,7 @@ export class Ed25519Node extends Revocable(class {}) { const indexBuffer = Buffer.alloc(4); indexBuffer.writeUInt32BE(index, 0); - // SLIP-0010 Ed25519 derivation + // SLIP-0010 for Ed25519 const data = Buffer.concat([Buffer.from([0x00]), Buffer.from(this.#privateKey), indexBuffer]); const I = bip32crypto.hmacSHA512(Buffer.from(this.#chainCode), data); diff --git a/packages/hdwallet-native/src/native.ts b/packages/hdwallet-native/src/native.ts index 9b9da4915..bb7c32b2e 100644 --- a/packages/hdwallet-native/src/native.ts +++ b/packages/hdwallet-native/src/native.ts @@ -438,8 +438,6 @@ export class NativeHDWallet this.#ed25519MasterKey = Promise.resolve( await (async (mnemonic, masterKey) => { if (masterKey !== undefined) { - // If a master key is provided, we'll need a way to derive the Ed25519 key from it - // This might require additional logic depending on your key derivation method throw new Error("TODO?"); } else if (mnemonic !== undefined) { const isolatedMnemonic = await (async () => {