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 6bc488e2764..2f60f964045 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,18 +1,42 @@ -import { Fr } from "@aztec/circuits.js"; -import { NewTestKeyStore } from "./new_test_key_store.js"; -import { openTmpStore } from "@aztec/kv-store/utils"; -import { Grumpkin } from "@aztec/circuits.js/barretenberg"; +import { Fr } from '@aztec/circuits.js'; +import { Grumpkin } from '@aztec/circuits.js/barretenberg'; +import { openTmpStore } from '@aztec/kv-store/utils'; + +import { NewTestKeyStore } from './new_test_key_store.js'; describe('NewTestKeyStore', () => { - it('Adds account and returns keys', () => { + it('Adds account and returns keys', async () => { const db = openTmpStore(); const keyStore = new NewTestKeyStore(new Grumpkin(), db); // Arbitrary fixed values const sk = new Fr(8923n); const partialAddress = new Fr(243523n); - - const accountAddress = keyStore.addAccount(sk, partialAddress); - expect(accountAddress).toMatchInlineSnapshot(`"0071f7630d28ce02cc1ca8b15c44953f84a39e1478445395247ae04dfa213c0e"`); + + const accountAddress = await keyStore.addAccount(sk, partialAddress); + expect(accountAddress.toString()).toMatchInlineSnapshot( + `"0x2ae5eeea29e4059842653d97864456c28fa53e4a823a8df65802090de1e85baa"`, + ); + + // TODO(#5714): The keys are currently the same here because separator is currently ignored in poseidon + const masterNullifierPublicKey = await keyStore.getMasterNullifierPublicKey(accountAddress); + expect(masterNullifierPublicKey.toString()).toMatchInlineSnapshot( + `"0x1b0b998b70b295ed14912584c64abfd402ee13511d0dcf05badef38e8c10acd00fce0a5909d612c9a2d2c9172ff3cf5ba6be3e314d66b05edd74f3d5d259110f"`, + ); + + const masterIncomingViewingPublicKey = await keyStore.getMasterIncomingViewingPublicKey(accountAddress); + expect(masterIncomingViewingPublicKey.toString()).toMatchInlineSnapshot( + `"0x1b0b998b70b295ed14912584c64abfd402ee13511d0dcf05badef38e8c10acd00fce0a5909d612c9a2d2c9172ff3cf5ba6be3e314d66b05edd74f3d5d259110f"`, + ); + + const masterOutgoingViewingPublicKey = await keyStore.getMasterOutgoingViewingPublicKey(accountAddress); + expect(masterOutgoingViewingPublicKey.toString()).toMatchInlineSnapshot( + `"0x1b0b998b70b295ed14912584c64abfd402ee13511d0dcf05badef38e8c10acd00fce0a5909d612c9a2d2c9172ff3cf5ba6be3e314d66b05edd74f3d5d259110f"`, + ); + + const masterTaggingPublicKey = await keyStore.getMasterTaggingPublicKey(accountAddress); + expect(masterTaggingPublicKey.toString()).toMatchInlineSnapshot( + `"0x1b0b998b70b295ed14912584c64abfd402ee13511d0dcf05badef38e8c10acd00fce0a5909d612c9a2d2c9172ff3cf5ba6be3e314d66b05edd74f3d5d259110f"`, + ); }); }); 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 63a87773541..d6737153dfd 100644 --- a/yarn-project/key-store/src/new_test_key_store.ts +++ b/yarn-project/key-store/src/new_test_key_store.ts @@ -7,7 +7,6 @@ import { type AztecKVStore, type AztecMap } from '@aztec/kv-store'; /** * TestKeyStore is an implementation of the KeyStore interface, used for managing key pairs in a testing environment. * It should be utilized in testing scenarios where secure key management is not required, and ease-of-use is prioritized. - * TODO: Potentially rename to not include 'Test' in the name. */ export class NewTestKeyStore implements NewKeyStore { #keys: AztecMap;