diff --git a/crypto/package.json b/crypto/package.json index 662b538029..fa25d99646 100644 --- a/crypto/package.json +++ b/crypto/package.json @@ -22,7 +22,7 @@ }, "dependencies": { "@zk-kit/baby-jubjub": "^0.3.0", - "@zk-kit/eddsa-poseidon": "^0.5.1", + "@zk-kit/eddsa-poseidon": "^0.11.0", "@zk-kit/poseidon-cipher": "^0.3.0", "ethers": "^6.11.1" }, diff --git a/crypto/ts/keys.ts b/crypto/ts/keys.ts index 17bed6ebd9..a3abbbbe18 100644 --- a/crypto/ts/keys.ts +++ b/crypto/ts/keys.ts @@ -25,7 +25,7 @@ export const genRandomSalt = (): bigint => genRandomBabyJubValue(); * @param privKey A private key generated using genPrivKey() * @returns A BabyJub-compatible private key. */ -export const formatPrivKeyForBabyJub = (privKey: PrivKey): bigint => BigInt(deriveSecretScalar(privKey)); +export const formatPrivKeyForBabyJub = (privKey: PrivKey): bigint => BigInt(deriveSecretScalar(privKey.toString())); /** * Losslessly reduces the size of the representation of a public key @@ -49,7 +49,7 @@ export const unpackPubKey = (packed: bigint): PubKey => { * @returns A public key associated with the private key */ export const genPubKey = (privKey: PrivKey): PubKey => { - const key = derivePublicKey(privKey); + const key = derivePublicKey(privKey.toString()); return [BigInt(key[0]), BigInt(key[1])]; }; diff --git a/domainobjs/ts/commands/PCommand.ts b/domainobjs/ts/commands/PCommand.ts index 99194fcfb2..8bb1f5f2cb 100644 --- a/domainobjs/ts/commands/PCommand.ts +++ b/domainobjs/ts/commands/PCommand.ts @@ -139,7 +139,7 @@ export class PCommand implements ICommand { /** * @notice Signs this command and returns a Signature. */ - sign = (privKey: PrivKey): Signature => sign(privKey.rawPrivKey, this.hash()); + sign = (privKey: PrivKey): Signature => sign(privKey.rawPrivKey.toString(), this.hash()); /** * @notice Returns true if the given signature is a correct signature of this diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fbc80e10c0..9962c905d7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -343,8 +343,8 @@ importers: specifier: ^0.3.0 version: 0.3.0 '@zk-kit/eddsa-poseidon': - specifier: ^0.5.1 - version: 0.5.1 + specifier: ^0.11.0 + version: 0.11.0 '@zk-kit/poseidon-cipher': specifier: ^0.3.0 version: 0.3.0 @@ -6168,12 +6168,6 @@ packages: tslib: 2.6.2 dev: true - /@zk-kit/baby-jubjub@0.1.1: - resolution: {integrity: sha512-eWpUSpKKpllGZXE6mdS1IVuegRjY2Yu+3Qccyfg0+gMI8+p0ruioMM/MCK3tg2lRIUJTVd+16UghVcK0145yWg==} - dependencies: - '@zk-kit/utils': 0.1.0 - dev: false - /@zk-kit/baby-jubjub@0.2.0: resolution: {integrity: sha512-pqiPq621oKpwiIkf1KcVh5MdbFX0V67s9gCmiEkhLMeafZaIXEwVt5qmIu1d2HB4mjXgr4Ys8Jpn2Rw4KXxnFQ==} dependencies: @@ -6192,11 +6186,12 @@ packages: circomlib: 2.0.5 dev: false - /@zk-kit/eddsa-poseidon@0.5.1: - resolution: {integrity: sha512-sPyoyjwg9EZ+tHLGxOG+FDj9XJK1knVjm27nTMV4ZSiQIf0427QWnLhOk7b6zMvFmEpBWTG9gneJ5pr3jzJ4zg==} + /@zk-kit/eddsa-poseidon@0.11.0: + resolution: {integrity: sha512-8XgIVSD+nTnTEjvdrFVvju6lVQ5rxCfkBnf/nCFN/IteiIpYX7LnxrTOV7pIp3RrWL29WuTvNrT8TlBrHRrUFA==} dependencies: - '@zk-kit/baby-jubjub': 0.1.1 - '@zk-kit/utils': 0.1.0 + '@zk-kit/baby-jubjub': 0.3.0 + '@zk-kit/utils': 0.8.1 + buffer: 6.0.3 dev: false /@zk-kit/poseidon-cipher@0.3.0: @@ -6206,10 +6201,6 @@ packages: '@zk-kit/utils': 0.3.0 dev: false - /@zk-kit/utils@0.1.0: - resolution: {integrity: sha512-MZmuw2w2StB7XOSNg1TW4VwnBJ746UDmdXTvxwDO/U85UZfGfM3zb53gG35qz5sWpQo/DjfoKqaScmh6HUtQpA==} - dev: false - /@zk-kit/utils@0.3.0: resolution: {integrity: sha512-yVBczOwOSV+evSgdsJ0tpPn3oQpbL7a7fRqANDogleaLLte1IFxKTFLz3WNcgd28Asq2guMGiU6SmiEc61uHAg==} dev: false @@ -6220,6 +6211,12 @@ packages: buffer: 6.0.3 dev: false + /@zk-kit/utils@0.8.1: + resolution: {integrity: sha512-m5cvnYo5IBZQCO8H5X0Mw3rGRGEoSqlYXVVF1+4M9IT3olDWcJHLPRqtYGF9zNf+vXV/21srpZ0hX3X2Lzp1TQ==} + dependencies: + buffer: 6.0.3 + dev: false + /@zkochan/js-yaml@0.0.6: resolution: {integrity: sha512-nzvgl3VfhcELQ8LyVrYOru+UtAy1nrygk2+AGbTm8a5YcO6o8lSjAT+pfg3vJWxIoZKOUhrK6UU7xW/+00kQrg==} hasBin: true