From 1e83a212a1b96311fc7df6f16be659c5e848d557 Mon Sep 17 00:00:00 2001 From: benesjan Date: Fri, 12 Apr 2024 10:32:15 +0000 Subject: [PATCH 1/5] feat: app siloing in new key store --- .../circuit-types/src/keys/new_key_store.ts | 37 +++++++++ .../key-store/src/new_test_key_store.test.ts | 25 +++++- .../key-store/src/new_test_key_store.ts | 76 ++++++++++++++++++- 3 files changed, 136 insertions(+), 2 deletions(-) diff --git a/yarn-project/circuit-types/src/keys/new_key_store.ts b/yarn-project/circuit-types/src/keys/new_key_store.ts index 6ae9337cc18d..4210640992bb 100644 --- a/yarn-project/circuit-types/src/keys/new_key_store.ts +++ b/yarn-project/circuit-types/src/keys/new_key_store.ts @@ -49,4 +49,41 @@ export interface NewKeyStore { * @returns A Promise that resolves to the master tagging key. */ getMasterTaggingPublicKey(account: AztecAddress): Promise; + + /** + * Retrieves application nullifier secret key. + * @throws If the account does not exist in the key store. + * @param account - The account to retrieve the application nullifier secret key for. + * @param app - The application address to retrieve the nullifier secret key for. + * @returns A Promise that resolves to the application nullifier secret key. + */ + getAppNullifierSecretKey(account: AztecAddress, app: AztecAddress): Promise; + + /** + * Retrieves application incoming viewing secret key. + * @throws If the account does not exist in the key store. + * @param account - The account to retrieve the application incoming viewing secret key for. + * @param app - The application address to retrieve the incoming viewing secret key for. + * @returns A Promise that resolves to the application incoming viewing secret key. + */ + getAppIncomingViewingSecretKey(account: AztecAddress, app: AztecAddress): Promise; + + /** + * Retrieves application outgoing viewing secret key. + * @throws If the account does not exist in the key store. + * @param account - The account to retrieve the application outgoing viewing secret key for. + * @param app - The application address to retrieve the outgoing viewing secret key for. + * @returns A Promise that resolves to the application outgoing viewing secret key. + */ + getAppOutgoingViewingSecretKey(account: AztecAddress, app: AztecAddress): Promise; + + /** + * Retrieves application tagging secret key. + * @throws If the account does not exist in the key store. + * @param account - The account to retrieve the application tagging secret key for. + * @param app - The application address to retrieve the tagging secret key for. + * @returns A Promise that resolves to the application tagging secret key. + * TODO: Not sure if this func will be needed. 💣💣💣 if not + */ + getAppTaggingSecretKey(account: AztecAddress, app: AztecAddress): Promise; } diff --git a/yarn-project/key-store/src/new_test_key_store.test.ts b/yarn-project/key-store/src/new_test_key_store.test.ts index 45a1ca06f1dc..372076d863d4 100644 --- a/yarn-project/key-store/src/new_test_key_store.test.ts +++ b/yarn-project/key-store/src/new_test_key_store.test.ts @@ -1,4 +1,4 @@ -import { Fr } from '@aztec/circuits.js'; +import { AztecAddress, Fr } from '@aztec/circuits.js'; import { Grumpkin } from '@aztec/circuits.js/barretenberg'; import { openTmpStore } from '@aztec/kv-store/utils'; @@ -37,5 +37,28 @@ describe('NewTestKeyStore', () => { expect(masterTaggingPublicKey.toString()).toMatchInlineSnapshot( `"0x076429010fdebfa522b053267f654a4c5daf18589915d96f7e5001d63ea2033f27f915f254560c84450aa38e93c3162be52492d05b316e75f542e3b302117360"`, ); + + // Arbitrary app contract address + const appAddress = AztecAddress.fromBigInt(624n); + + const appNullifierSecretKey = await keyStore.getAppNullifierSecretKey(accountAddress, appAddress); + expect(appNullifierSecretKey.toString()).toMatchInlineSnapshot( + `"0x17e6aa39fa3b496ab3253d366b60b21d40df6f4db145cc543896a07e81cdca57"`, + ); + + const appIncomingViewingSecretKey = await keyStore.getAppIncomingViewingSecretKey(accountAddress, appAddress); + expect(appIncomingViewingSecretKey.toString()).toMatchInlineSnapshot( + `"0x26802fcefb8c238ed5dc8e3e0eff8fc05f8feff9fa1dd1dc951f2bdf04fe279b"`, + ); + + const appOutgoingViewingSecretKey = await keyStore.getAppOutgoingViewingSecretKey(accountAddress, appAddress); + expect(appOutgoingViewingSecretKey.toString()).toMatchInlineSnapshot( + `"0x1e4aaa29289f2be15c05509478aa054be9cbe16d75dbb59bdfaefc3a2df88f0b"`, + ); + + const appTaggingSecretKey = await keyStore.getAppTaggingSecretKey(accountAddress, appAddress); + expect(appTaggingSecretKey.toString()).toMatchInlineSnapshot( + `"0x24051d8fddc0d49929a118edc68d04babe7175bd4cf0f25d83527e25c6dd591f"`, + ); }); }); diff --git a/yarn-project/key-store/src/new_test_key_store.ts b/yarn-project/key-store/src/new_test_key_store.ts index 7ba118d58d75..cc9a25947005 100644 --- a/yarn-project/key-store/src/new_test_key_store.ts +++ b/yarn-project/key-store/src/new_test_key_store.ts @@ -60,7 +60,12 @@ export class NewTestKeyStore implements NewKeyStore { const accountAddressFr = poseidon2Hash([partialAddress, publicKeysHash, GeneratorIndex.CONTRACT_ADDRESS_V1]); const accountAddress = AztecAddress.fromField(accountAddressFr); - // We store the keys in the database + // We store all the public and secret keys in the database + await this.#keys.set(`${accountAddress.toString()}-nsk_m`, masterNullifierSecretKey.toBuffer()); + await this.#keys.set(`${accountAddress.toString()}-ivsk_m`, masterIncomingViewingSecretKey.toBuffer()); + await this.#keys.set(`${accountAddress.toString()}-ovsk_m`, masterOutgoingViewingSecretKey.toBuffer()); + await this.#keys.set(`${accountAddress.toString()}-tsk_m`, masterTaggingSecretKey.toBuffer()); + await this.#keys.set(`${accountAddress.toString()}-npk_m`, masterNullifierPublicKey.toBuffer()); await this.#keys.set(`${accountAddress.toString()}-ivpk_m`, masterIncomingViewingPublicKey.toBuffer()); await this.#keys.set(`${accountAddress.toString()}-ovpk_m`, masterOutgoingViewingPublicKey.toBuffer()); @@ -125,4 +130,73 @@ export class NewTestKeyStore implements NewKeyStore { } return Promise.resolve(Point.fromBuffer(masterTaggingPublicKeyBuffer)); } + + /** + * Retrieves application nullifier secret key. + * @throws If the account does not exist in the key store. + * @param account - The account to retrieve the application nullifier secret key for. + * @param app - The application address to retrieve the nullifier secret key for. + * @returns A Promise that resolves to the application nullifier secret key. + */ + public getAppNullifierSecretKey(account: AztecAddress, app: AztecAddress): Promise { + const masterNullifierSecretKeyBuffer = this.#keys.get(`${account.toString()}-nsk_m`); + if (!masterNullifierSecretKeyBuffer) { + throw new Error(`Account ${account.toString()} does not exist.`); + } + const masterNullifierSecretKey = Fr.fromBuffer(masterNullifierSecretKeyBuffer); + + return Promise.resolve(poseidonHash([masterNullifierSecretKey, app], GeneratorIndex.NSK_M)); + } + + /** + * Retrieves application incoming viewing secret key. + * @throws If the account does not exist in the key store. + * @param account - The account to retrieve the application incoming viewing secret key for. + * @param app - The application address to retrieve the incoming viewing secret key for. + * @returns A Promise that resolves to the application incoming viewing secret key. + */ + public getAppIncomingViewingSecretKey(account: AztecAddress, app: AztecAddress): Promise { + const masterIncomingViewingSecretKeyBuffer = this.#keys.get(`${account.toString()}-ivsk_m`); + if (!masterIncomingViewingSecretKeyBuffer) { + throw new Error(`Account ${account.toString()} does not exist.`); + } + const masterIncomingViewingSecretKey = Fr.fromBuffer(masterIncomingViewingSecretKeyBuffer); + + return Promise.resolve(poseidonHash([masterIncomingViewingSecretKey, app], GeneratorIndex.IVSK_M)); + } + + /** + * Retrieves application outgoing viewing secret key. + * @throws If the account does not exist in the key store. + * @param account - The account to retrieve the application outgoing viewing secret key for. + * @param app - The application address to retrieve the outgoing viewing secret key for. + * @returns A Promise that resolves to the application outgoing viewing secret key. + */ + public getAppOutgoingViewingSecretKey(account: AztecAddress, app: AztecAddress): Promise { + const masterOutgoingViewingSecretKeyBuffer = this.#keys.get(`${account.toString()}-ovsk_m`); + if (!masterOutgoingViewingSecretKeyBuffer) { + throw new Error(`Account ${account.toString()} does not exist.`); + } + const masterOutgoingViewingSecretKey = Fr.fromBuffer(masterOutgoingViewingSecretKeyBuffer); + + return Promise.resolve(poseidonHash([masterOutgoingViewingSecretKey, app], GeneratorIndex.OVSK_M)); + } + + /** + * Retrieves application tagging secret key. + * @throws If the account does not exist in the key store. + * @param account - The account to retrieve the application tagging secret key for. + * @param app - The application address to retrieve the tagging secret key for. + * @returns A Promise that resolves to the application tagging secret key. + * TODO: Not sure if this func will be needed. 💣💣💣 if not + */ + public getAppTaggingSecretKey(account: AztecAddress, app: AztecAddress): Promise { + const masterTaggingSecretKeyBuffer = this.#keys.get(`${account.toString()}-tsk_m`); + if (!masterTaggingSecretKeyBuffer) { + throw new Error(`Account ${account.toString()} does not exist.`); + } + const masterTaggingSecretKey = Fr.fromBuffer(masterTaggingSecretKeyBuffer); + + return Promise.resolve(poseidonHash([masterTaggingSecretKey, app], GeneratorIndex.TSK_M)); + } } From 6782aa9fa28f1fd7dcb793a65d9ac5d9ef1cee0c Mon Sep 17 00:00:00 2001 From: benesjan Date: Fri, 12 Apr 2024 13:19:49 +0000 Subject: [PATCH 2/5] fix after rebase --- yarn-project/key-store/src/new_test_key_store.test.ts | 8 ++++---- yarn-project/key-store/src/new_test_key_store.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/yarn-project/key-store/src/new_test_key_store.test.ts b/yarn-project/key-store/src/new_test_key_store.test.ts index 372076d863d4..cfba216d2b4b 100644 --- a/yarn-project/key-store/src/new_test_key_store.test.ts +++ b/yarn-project/key-store/src/new_test_key_store.test.ts @@ -43,22 +43,22 @@ describe('NewTestKeyStore', () => { const appNullifierSecretKey = await keyStore.getAppNullifierSecretKey(accountAddress, appAddress); expect(appNullifierSecretKey.toString()).toMatchInlineSnapshot( - `"0x17e6aa39fa3b496ab3253d366b60b21d40df6f4db145cc543896a07e81cdca57"`, + `"0x03d147a454c3b76c7293538f45de8f0cc6179219f67171bd4734507ff2f4e66b"`, ); const appIncomingViewingSecretKey = await keyStore.getAppIncomingViewingSecretKey(accountAddress, appAddress); expect(appIncomingViewingSecretKey.toString()).toMatchInlineSnapshot( - `"0x26802fcefb8c238ed5dc8e3e0eff8fc05f8feff9fa1dd1dc951f2bdf04fe279b"`, + `"0x09d3b6af7911b5d1d81221657dab651cb1553f656c83b469d1c5bb3155c885ec"`, ); const appOutgoingViewingSecretKey = await keyStore.getAppOutgoingViewingSecretKey(accountAddress, appAddress); expect(appOutgoingViewingSecretKey.toString()).toMatchInlineSnapshot( - `"0x1e4aaa29289f2be15c05509478aa054be9cbe16d75dbb59bdfaefc3a2df88f0b"`, + `"0x25731ba98966ac7822efc31b2fe42af326f38a64be1e56b480ada4966eae2be3"`, ); const appTaggingSecretKey = await keyStore.getAppTaggingSecretKey(accountAddress, appAddress); expect(appTaggingSecretKey.toString()).toMatchInlineSnapshot( - `"0x24051d8fddc0d49929a118edc68d04babe7175bd4cf0f25d83527e25c6dd591f"`, + `"0x1b9d684ddddcf3cc36bc6925331cc321a0d9f1d2341572ec5967eea36be65c85"`, ); }); }); diff --git a/yarn-project/key-store/src/new_test_key_store.ts b/yarn-project/key-store/src/new_test_key_store.ts index cc9a25947005..791305774aaf 100644 --- a/yarn-project/key-store/src/new_test_key_store.ts +++ b/yarn-project/key-store/src/new_test_key_store.ts @@ -145,7 +145,7 @@ export class NewTestKeyStore implements NewKeyStore { } const masterNullifierSecretKey = Fr.fromBuffer(masterNullifierSecretKeyBuffer); - return Promise.resolve(poseidonHash([masterNullifierSecretKey, app], GeneratorIndex.NSK_M)); + return Promise.resolve(poseidon2Hash([masterNullifierSecretKey, app], GeneratorIndex.NSK_M)); } /** @@ -162,7 +162,7 @@ export class NewTestKeyStore implements NewKeyStore { } const masterIncomingViewingSecretKey = Fr.fromBuffer(masterIncomingViewingSecretKeyBuffer); - return Promise.resolve(poseidonHash([masterIncomingViewingSecretKey, app], GeneratorIndex.IVSK_M)); + return Promise.resolve(poseidon2Hash([masterIncomingViewingSecretKey, app], GeneratorIndex.IVSK_M)); } /** @@ -179,7 +179,7 @@ export class NewTestKeyStore implements NewKeyStore { } const masterOutgoingViewingSecretKey = Fr.fromBuffer(masterOutgoingViewingSecretKeyBuffer); - return Promise.resolve(poseidonHash([masterOutgoingViewingSecretKey, app], GeneratorIndex.OVSK_M)); + return Promise.resolve(poseidon2Hash([masterOutgoingViewingSecretKey, app], GeneratorIndex.OVSK_M)); } /** @@ -197,6 +197,6 @@ export class NewTestKeyStore implements NewKeyStore { } const masterTaggingSecretKey = Fr.fromBuffer(masterTaggingSecretKeyBuffer); - return Promise.resolve(poseidonHash([masterTaggingSecretKey, app], GeneratorIndex.TSK_M)); + return Promise.resolve(poseidon2Hash([masterTaggingSecretKey, app], GeneratorIndex.TSK_M)); } } From 887acc3ea2ee99a6a5f9345f3ba98a5fdb4a9a90 Mon Sep 17 00:00:00 2001 From: benesjan Date: Fri, 12 Apr 2024 14:04:45 +0000 Subject: [PATCH 3/5] fix --- .../key-store/src/new_test_key_store.test.ts | 8 ++--- .../key-store/src/new_test_key_store.ts | 36 +++++++++++++------ 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/yarn-project/key-store/src/new_test_key_store.test.ts b/yarn-project/key-store/src/new_test_key_store.test.ts index cfba216d2b4b..144f6b49c2df 100644 --- a/yarn-project/key-store/src/new_test_key_store.test.ts +++ b/yarn-project/key-store/src/new_test_key_store.test.ts @@ -43,22 +43,22 @@ describe('NewTestKeyStore', () => { const appNullifierSecretKey = await keyStore.getAppNullifierSecretKey(accountAddress, appAddress); expect(appNullifierSecretKey.toString()).toMatchInlineSnapshot( - `"0x03d147a454c3b76c7293538f45de8f0cc6179219f67171bd4734507ff2f4e66b"`, + `"0x230a44dfe7cfec7a735c89f7289c5cb5d2c3dc0bf5d3505917fd2476f67873a8"`, ); const appIncomingViewingSecretKey = await keyStore.getAppIncomingViewingSecretKey(accountAddress, appAddress); expect(appIncomingViewingSecretKey.toString()).toMatchInlineSnapshot( - `"0x09d3b6af7911b5d1d81221657dab651cb1553f656c83b469d1c5bb3155c885ec"`, + `"0x0084c92262407236c992dcea10cf3406a642074cad6c6034d2990ffb073207a7"`, ); const appOutgoingViewingSecretKey = await keyStore.getAppOutgoingViewingSecretKey(accountAddress, appAddress); expect(appOutgoingViewingSecretKey.toString()).toMatchInlineSnapshot( - `"0x25731ba98966ac7822efc31b2fe42af326f38a64be1e56b480ada4966eae2be3"`, + `"0x2639b26510f9d30b7e173d301b263b246b7a576186be1f44cd7c86bc06773f8a"`, ); const appTaggingSecretKey = await keyStore.getAppTaggingSecretKey(accountAddress, appAddress); expect(appTaggingSecretKey.toString()).toMatchInlineSnapshot( - `"0x1b9d684ddddcf3cc36bc6925331cc321a0d9f1d2341572ec5967eea36be65c85"`, + `"0x13b400d2fccab28a04a4df9fe541d242e6b518d03137ef0ffa57c3d98cc56e67"`, ); }); }); diff --git a/yarn-project/key-store/src/new_test_key_store.ts b/yarn-project/key-store/src/new_test_key_store.ts index 791305774aaf..4c8bf2171f14 100644 --- a/yarn-project/key-store/src/new_test_key_store.ts +++ b/yarn-project/key-store/src/new_test_key_store.ts @@ -1,5 +1,5 @@ import { type NewKeyStore, type PublicKey } from '@aztec/circuit-types'; -import { AztecAddress, Fr, GeneratorIndex, type PartialAddress, Point } from '@aztec/circuits.js'; +import { AztecAddress, Fr, GeneratorIndex, GrumpkinScalar, type PartialAddress, Point } from '@aztec/circuits.js'; import { type Grumpkin } from '@aztec/circuits.js/barretenberg'; import { poseidon2Hash, sha512ToGrumpkinScalar } from '@aztec/foundation/crypto'; import { type AztecKVStore, type AztecMap } from '@aztec/kv-store'; @@ -143,9 +143,11 @@ export class NewTestKeyStore implements NewKeyStore { if (!masterNullifierSecretKeyBuffer) { throw new Error(`Account ${account.toString()} does not exist.`); } - const masterNullifierSecretKey = Fr.fromBuffer(masterNullifierSecretKeyBuffer); + const masterNullifierSecretKey = GrumpkinScalar.fromBuffer(masterNullifierSecretKeyBuffer); - return Promise.resolve(poseidon2Hash([masterNullifierSecretKey, app], GeneratorIndex.NSK_M)); + return Promise.resolve( + poseidon2Hash([masterNullifierSecretKey.high, masterNullifierSecretKey.low, app], GeneratorIndex.NSK_M), + ); } /** @@ -160,9 +162,14 @@ export class NewTestKeyStore implements NewKeyStore { if (!masterIncomingViewingSecretKeyBuffer) { throw new Error(`Account ${account.toString()} does not exist.`); } - const masterIncomingViewingSecretKey = Fr.fromBuffer(masterIncomingViewingSecretKeyBuffer); - - return Promise.resolve(poseidon2Hash([masterIncomingViewingSecretKey, app], GeneratorIndex.IVSK_M)); + const masterIncomingViewingSecretKey = GrumpkinScalar.fromBuffer(masterIncomingViewingSecretKeyBuffer); + + return Promise.resolve( + poseidon2Hash( + [masterIncomingViewingSecretKey.high, masterIncomingViewingSecretKey.low, app], + GeneratorIndex.IVSK_M, + ), + ); } /** @@ -177,9 +184,14 @@ export class NewTestKeyStore implements NewKeyStore { if (!masterOutgoingViewingSecretKeyBuffer) { throw new Error(`Account ${account.toString()} does not exist.`); } - const masterOutgoingViewingSecretKey = Fr.fromBuffer(masterOutgoingViewingSecretKeyBuffer); - - return Promise.resolve(poseidon2Hash([masterOutgoingViewingSecretKey, app], GeneratorIndex.OVSK_M)); + const masterOutgoingViewingSecretKey = GrumpkinScalar.fromBuffer(masterOutgoingViewingSecretKeyBuffer); + + return Promise.resolve( + poseidon2Hash( + [masterOutgoingViewingSecretKey.high, masterOutgoingViewingSecretKey.low, app], + GeneratorIndex.OVSK_M, + ), + ); } /** @@ -195,8 +207,10 @@ export class NewTestKeyStore implements NewKeyStore { if (!masterTaggingSecretKeyBuffer) { throw new Error(`Account ${account.toString()} does not exist.`); } - const masterTaggingSecretKey = Fr.fromBuffer(masterTaggingSecretKeyBuffer); + const masterTaggingSecretKey = GrumpkinScalar.fromBuffer(masterTaggingSecretKeyBuffer); - return Promise.resolve(poseidon2Hash([masterTaggingSecretKey, app], GeneratorIndex.TSK_M)); + return Promise.resolve( + poseidon2Hash([masterTaggingSecretKey.high, masterTaggingSecretKey.low, app], GeneratorIndex.TSK_M), + ); } } From d49d98e7f1f83a30d232e625a512dd36707adb2d Mon Sep 17 00:00:00 2001 From: benesjan Date: Fri, 12 Apr 2024 14:13:02 +0000 Subject: [PATCH 4/5] fix --- .../key-store/src/new_test_key_store.ts | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/yarn-project/key-store/src/new_test_key_store.ts b/yarn-project/key-store/src/new_test_key_store.ts index 4c8bf2171f14..52b18306697e 100644 --- a/yarn-project/key-store/src/new_test_key_store.ts +++ b/yarn-project/key-store/src/new_test_key_store.ts @@ -146,7 +146,7 @@ export class NewTestKeyStore implements NewKeyStore { const masterNullifierSecretKey = GrumpkinScalar.fromBuffer(masterNullifierSecretKeyBuffer); return Promise.resolve( - poseidon2Hash([masterNullifierSecretKey.high, masterNullifierSecretKey.low, app], GeneratorIndex.NSK_M), + poseidon2Hash([masterNullifierSecretKey.high, masterNullifierSecretKey.low, app, GeneratorIndex.NSK_M]), ); } @@ -165,10 +165,12 @@ export class NewTestKeyStore implements NewKeyStore { const masterIncomingViewingSecretKey = GrumpkinScalar.fromBuffer(masterIncomingViewingSecretKeyBuffer); return Promise.resolve( - poseidon2Hash( - [masterIncomingViewingSecretKey.high, masterIncomingViewingSecretKey.low, app], + poseidon2Hash([ + masterIncomingViewingSecretKey.high, + masterIncomingViewingSecretKey.low, + app, GeneratorIndex.IVSK_M, - ), + ]), ); } @@ -187,10 +189,12 @@ export class NewTestKeyStore implements NewKeyStore { const masterOutgoingViewingSecretKey = GrumpkinScalar.fromBuffer(masterOutgoingViewingSecretKeyBuffer); return Promise.resolve( - poseidon2Hash( - [masterOutgoingViewingSecretKey.high, masterOutgoingViewingSecretKey.low, app], + poseidon2Hash([ + masterOutgoingViewingSecretKey.high, + masterOutgoingViewingSecretKey.low, + app, GeneratorIndex.OVSK_M, - ), + ]), ); } @@ -210,7 +214,7 @@ export class NewTestKeyStore implements NewKeyStore { const masterTaggingSecretKey = GrumpkinScalar.fromBuffer(masterTaggingSecretKeyBuffer); return Promise.resolve( - poseidon2Hash([masterTaggingSecretKey.high, masterTaggingSecretKey.low, app], GeneratorIndex.TSK_M), + poseidon2Hash([masterTaggingSecretKey.high, masterTaggingSecretKey.low, app, GeneratorIndex.TSK_M]), ); } } From 2b3a5be137c4fce0bc17226a620c98affe1b1902 Mon Sep 17 00:00:00 2001 From: benesjan Date: Fri, 12 Apr 2024 14:39:25 +0000 Subject: [PATCH 5/5] cleanup --- .../circuit-types/src/keys/new_key_store.ts | 10 ---------- .../key-store/src/new_test_key_store.test.ts | 5 ----- .../key-store/src/new_test_key_store.ts | 20 ------------------- 3 files changed, 35 deletions(-) diff --git a/yarn-project/circuit-types/src/keys/new_key_store.ts b/yarn-project/circuit-types/src/keys/new_key_store.ts index 4210640992bb..10eddd49561b 100644 --- a/yarn-project/circuit-types/src/keys/new_key_store.ts +++ b/yarn-project/circuit-types/src/keys/new_key_store.ts @@ -76,14 +76,4 @@ export interface NewKeyStore { * @returns A Promise that resolves to the application outgoing viewing secret key. */ getAppOutgoingViewingSecretKey(account: AztecAddress, app: AztecAddress): Promise; - - /** - * Retrieves application tagging secret key. - * @throws If the account does not exist in the key store. - * @param account - The account to retrieve the application tagging secret key for. - * @param app - The application address to retrieve the tagging secret key for. - * @returns A Promise that resolves to the application tagging secret key. - * TODO: Not sure if this func will be needed. 💣💣💣 if not - */ - getAppTaggingSecretKey(account: AztecAddress, app: AztecAddress): Promise; } diff --git a/yarn-project/key-store/src/new_test_key_store.test.ts b/yarn-project/key-store/src/new_test_key_store.test.ts index 144f6b49c2df..7e56a873ac8d 100644 --- a/yarn-project/key-store/src/new_test_key_store.test.ts +++ b/yarn-project/key-store/src/new_test_key_store.test.ts @@ -55,10 +55,5 @@ describe('NewTestKeyStore', () => { expect(appOutgoingViewingSecretKey.toString()).toMatchInlineSnapshot( `"0x2639b26510f9d30b7e173d301b263b246b7a576186be1f44cd7c86bc06773f8a"`, ); - - const appTaggingSecretKey = await keyStore.getAppTaggingSecretKey(accountAddress, appAddress); - expect(appTaggingSecretKey.toString()).toMatchInlineSnapshot( - `"0x13b400d2fccab28a04a4df9fe541d242e6b518d03137ef0ffa57c3d98cc56e67"`, - ); }); }); diff --git a/yarn-project/key-store/src/new_test_key_store.ts b/yarn-project/key-store/src/new_test_key_store.ts index 52b18306697e..c5ff22030e70 100644 --- a/yarn-project/key-store/src/new_test_key_store.ts +++ b/yarn-project/key-store/src/new_test_key_store.ts @@ -197,24 +197,4 @@ export class NewTestKeyStore implements NewKeyStore { ]), ); } - - /** - * Retrieves application tagging secret key. - * @throws If the account does not exist in the key store. - * @param account - The account to retrieve the application tagging secret key for. - * @param app - The application address to retrieve the tagging secret key for. - * @returns A Promise that resolves to the application tagging secret key. - * TODO: Not sure if this func will be needed. 💣💣💣 if not - */ - public getAppTaggingSecretKey(account: AztecAddress, app: AztecAddress): Promise { - const masterTaggingSecretKeyBuffer = this.#keys.get(`${account.toString()}-tsk_m`); - if (!masterTaggingSecretKeyBuffer) { - throw new Error(`Account ${account.toString()} does not exist.`); - } - const masterTaggingSecretKey = GrumpkinScalar.fromBuffer(masterTaggingSecretKeyBuffer); - - return Promise.resolve( - poseidon2Hash([masterTaggingSecretKey.high, masterTaggingSecretKey.low, app, GeneratorIndex.TSK_M]), - ); - } }