diff --git a/packages/protocol/packages/account/package.json b/packages/protocol/packages/account/package.json index 331ab5a15b..899bfdc7fa 100644 --- a/packages/protocol/packages/account/package.json +++ b/packages/protocol/packages/account/package.json @@ -29,7 +29,7 @@ "module": "dist/neutral/index.mjs", "types": "dist/neutral/index.d.ts", "dependencies": { - "@bitauth/libauth-1-19-1": "npm:@bitauth/libauth@1.19.1", + "@bitauth/libauth": "^3.0.0", "@scure/bip39": "^1.3.0", "@xylabs/arraybuffer": "^4.0.5", "@xylabs/assert": "^4.0.5", diff --git a/packages/protocol/packages/account/src/Elliptic.ts b/packages/protocol/packages/account/src/Elliptic.ts index 8fbdbb2a2d..e983855c55 100644 --- a/packages/protocol/packages/account/src/Elliptic.ts +++ b/packages/protocol/packages/account/src/Elliptic.ts @@ -1,5 +1,5 @@ -import type { Secp256k1 } from '@bitauth/libauth-1-19-1' -import { instantiateSecp256k1 } from '@bitauth/libauth-1-19-1' +import type { Secp256k1 } from '@bitauth/libauth' +import { instantiateSecp256k1 } from '@bitauth/libauth' import { toUint8Array } from '@xylabs/arraybuffer' import { assertEx } from '@xylabs/assert' import { Data } from '@xyo-network/data' @@ -41,7 +41,7 @@ export class Elliptic { static async publicKeyFromPrivateKey(privateKey: ArrayBuffer, prefix = false): Promise { const { derivePublicKeyUncompressed } = await this.secp256k1() - const fullPublicKey = derivePublicKeyUncompressed(new Uint8Array(privateKey)) + const fullPublicKey = toUint8Array(derivePublicKeyUncompressed(new Uint8Array(privateKey))) return prefix ? fullPublicKey : fullPublicKey.slice(1) } @@ -62,7 +62,7 @@ export class Elliptic { static async sign(hash: ArrayBuffer, key: ArrayBuffer) { const { signMessageHashCompact } = await this.secp256k1() - return signMessageHashCompact(new Uint8Array(key), toUint8Array(hash)) + return toUint8Array(signMessageHashCompact(new Uint8Array(key), toUint8Array(hash))) } static async verify(msg: ArrayBuffer, signature: ArrayBuffer, address: ArrayBuffer) { @@ -70,7 +70,7 @@ export class Elliptic { if (verifier && this.wasmSupport.canUseWasm) { for (const recoveryId of recoveryIds) { try { - const recoveredPublicKey = verifier.recoverPublicKeyUncompressed(toUint8Array(signature), recoveryId, toUint8Array(msg)).slice(1) + const recoveredPublicKey = toUint8Array(verifier.recoverPublicKeyUncompressed(toUint8Array(signature), recoveryId, toUint8Array(msg)).slice(1)) const recoveredAddress = this.addressFromPublicKey(recoveredPublicKey) if (compareArrayBuffers(address, recoveredAddress)) { return true diff --git a/yarn.lock b/yarn.lock index f7c1e4661a..36d9b0ed02 100644 --- a/yarn.lock +++ b/yarn.lock @@ -885,10 +885,10 @@ __metadata: languageName: node linkType: hard -"@bitauth/libauth-1-19-1@npm:@bitauth/libauth@1.19.1": - version: 1.19.1 - resolution: "@bitauth/libauth@npm:1.19.1" - checksum: 10/325e396bdbed4af15861085db8b702a9a5083fea9f22c451598ca574d25edf1d344b22b7576b082da5bab8a46d9b31ea42f206e1ad4d5c1b02e877b62448c1aa +"@bitauth/libauth@npm:^3.0.0": + version: 3.0.0 + resolution: "@bitauth/libauth@npm:3.0.0" + checksum: 10/3158091c462f16cc1e9df8b4bbf35e6fa3f85dde1d8f6337344d4c0102b4f0b55a0768472d6ef88c297a9050772b6ee0ff4bc65174f5c4e6af7721dd9d7eac1c languageName: node linkType: hard @@ -4108,7 +4108,7 @@ __metadata: version: 0.0.0-use.local resolution: "@xyo-network/account@workspace:packages/protocol/packages/account" dependencies: - "@bitauth/libauth-1-19-1": "npm:@bitauth/libauth@1.19.1" + "@bitauth/libauth": "npm:^3.0.0" "@scure/bip39": "npm:^1.3.0" "@xylabs/arraybuffer": "npm:^4.0.5" "@xylabs/assert": "npm:^4.0.5"