@aztec/pxe 5.0.0-rc.1 → 5.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/block_synchronizer/block_stream_source.d.ts +5 -5
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -1
- package/dest/block_synchronizer/block_stream_source.js +4 -29
- package/dest/block_synchronizer/block_synchronizer.d.ts +13 -11
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +43 -15
- package/dest/config/index.d.ts +2 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +11 -16
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +22 -18
- package/dest/contract_function_simulator/index.d.ts +15 -9
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +3 -7
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts +8 -27
- package/dest/contract_function_simulator/noir-structs/bounded_vec.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/bounded_vec.js +8 -23
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts +9 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/contract_class_log_data.js +1 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts +7 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/embedded_curve_point.js +1 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/fact.d.ts +16 -0
- package/dest/contract_function_simulator/noir-structs/fact.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/fact.js +6 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts +27 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/fact_collection.js +29 -0
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +11 -12
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +6 -49
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +4 -8
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -60
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +2 -2
- package/dest/contract_function_simulator/noir-structs/option.d.ts +9 -11
- package/dest/contract_function_simulator/noir-structs/option.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/option.js +18 -13
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts +11 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/origin_block.js +5 -0
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts +5 -8
- package/dest/contract_function_simulator/noir-structs/provided_secret.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/provided_secret.js +1 -14
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts +21 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tagging_strategy.js +33 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts +21 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/resolved_tx.js +50 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts +14 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/tx_effect_data.js +5 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +6 -11
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -20
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -14
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -24
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts +81 -6
- package/dest/contract_function_simulator/oracle/oracle_registry.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_registry.js +128 -9
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts +80 -36
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle_type_mappings.js +926 -264
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +13 -8
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +80 -11
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +46 -20
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +119 -55
- package/dest/contract_sync/helpers.d.ts +7 -6
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/contract_sync/helpers.js +11 -16
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +1 -0
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +1 -0
- package/dest/entrypoints/pxe_creation_options.d.ts +8 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +1 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +0 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +3 -1
- package/dest/error_enriching.js +1 -1
- package/dest/hooks/execution_hooks.d.ts +16 -7
- package/dest/hooks/execution_hooks.d.ts.map +1 -1
- package/dest/hooks/execution_hooks.js +3 -3
- package/dest/hooks/index.d.ts +3 -3
- package/dest/hooks/index.d.ts.map +1 -1
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts +41 -0
- package/dest/hooks/resolve_tagging_secret_strategy.d.ts.map +1 -0
- package/dest/hooks/resolve_tagging_secret_strategy.js +3 -0
- package/dest/logs/log_service.d.ts +6 -6
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +62 -28
- package/dest/messages/tx_resolver_service.d.ts +17 -0
- package/dest/messages/tx_resolver_service.d.ts.map +1 -0
- package/dest/messages/{message_context_service.js → tx_resolver_service.js} +8 -8
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/test_utils.js +1 -1
- package/dest/pxe.d.ts +46 -19
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +104 -52
- package/dest/storage/allowed_scopes.d.ts +6 -0
- package/dest/storage/allowed_scopes.d.ts.map +1 -0
- package/dest/storage/allowed_scopes.js +7 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +1 -1
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -1
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +86 -33
- package/dest/storage/capsule_store/capsule_service.d.ts +1 -1
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_service.js +6 -9
- package/dest/storage/contract_store/contract_store.js +2 -2
- package/dest/storage/fact_store/fact_service.d.ts +20 -0
- package/dest/storage/fact_store/fact_service.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_service.js +30 -0
- package/dest/storage/fact_store/fact_store.d.ts +95 -0
- package/dest/storage/fact_store/fact_store.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store.js +408 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts +34 -0
- package/dest/storage/fact_store/fact_store_keys.d.ts.map +1 -0
- package/dest/storage/fact_store/fact_store_keys.js +50 -0
- package/dest/storage/fact_store/index.d.ts +5 -0
- package/dest/storage/fact_store/index.d.ts.map +1 -0
- package/dest/storage/fact_store/index.js +3 -0
- package/dest/storage/fact_store/stored_fact.d.ts +32 -0
- package/dest/storage/fact_store/stored_fact.d.ts.map +1 -0
- package/dest/storage/fact_store/stored_fact.js +64 -0
- package/dest/storage/index.d.ts +2 -1
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +1 -0
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/open_pxe_stores.d.ts +5 -3
- package/dest/storage/open_pxe_stores.d.ts.map +1 -1
- package/dest/storage/open_pxe_stores.js +5 -3
- package/dest/storage/tagging_store/index.d.ts +2 -2
- package/dest/storage/tagging_store/index.d.ts.map +1 -1
- package/dest/storage/tagging_store/index.js +1 -1
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts +40 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/tagging_secret_sources_store.js +92 -0
- package/package.json +17 -17
- package/src/block_synchronizer/block_stream_source.ts +6 -45
- package/src/block_synchronizer/block_synchronizer.ts +56 -23
- package/src/config/index.ts +1 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +32 -31
- package/src/contract_function_simulator/index.ts +17 -8
- package/src/contract_function_simulator/noir-structs/bounded_vec.ts +12 -24
- package/src/contract_function_simulator/noir-structs/contract_class_log_data.ts +9 -0
- package/src/contract_function_simulator/noir-structs/embedded_curve_point.ts +4 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/fact.ts +13 -0
- package/src/contract_function_simulator/noir-structs/fact_collection.ts +59 -0
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +20 -46
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +7 -60
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +2 -2
- package/src/contract_function_simulator/noir-structs/option.ts +17 -11
- package/src/contract_function_simulator/noir-structs/origin_block.ts +8 -0
- package/src/contract_function_simulator/noir-structs/provided_secret.ts +3 -14
- package/src/contract_function_simulator/noir-structs/resolved_tagging_strategy.ts +45 -0
- package/src/contract_function_simulator/noir-structs/resolved_tx.ts +53 -0
- package/src/contract_function_simulator/noir-structs/tx_effect_data.ts +15 -0
- package/src/contract_function_simulator/noir-structs/utility_context.ts +5 -17
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +6 -21
- package/src/contract_function_simulator/oracle/oracle_registry.ts +87 -79
- package/src/contract_function_simulator/oracle/oracle_type_mappings.ts +641 -247
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +94 -14
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +206 -66
- package/src/contract_sync/helpers.ts +11 -18
- package/src/entrypoints/client/bundle/utils.ts +1 -0
- package/src/entrypoints/client/lazy/utils.ts +1 -0
- package/src/entrypoints/pxe_creation_options.ts +7 -1
- package/src/entrypoints/server/index.ts +0 -1
- package/src/entrypoints/server/utils.ts +3 -1
- package/src/error_enriching.ts +1 -1
- package/src/hooks/execution_hooks.ts +17 -8
- package/src/hooks/index.ts +6 -2
- package/src/hooks/resolve_tagging_secret_strategy.ts +46 -0
- package/src/logs/log_service.ts +71 -37
- package/src/messages/{message_context_service.ts → tx_resolver_service.ts} +16 -9
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/test_utils.ts +1 -1
- package/src/pxe.ts +150 -54
- package/src/storage/allowed_scopes.ts +14 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/FactStore.json +40 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +1 -1
- package/src/storage/backwards_compatibility_tests/__snapshots__/TaggingSecretSourcesStore.json +30 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +21 -5
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +88 -33
- package/src/storage/capsule_store/capsule_service.ts +8 -13
- package/src/storage/contract_store/contract_store.ts +2 -2
- package/src/storage/fact_store/fact_service.ts +45 -0
- package/src/storage/fact_store/fact_store.ts +487 -0
- package/src/storage/fact_store/fact_store_keys.ts +75 -0
- package/src/storage/fact_store/index.ts +4 -0
- package/src/storage/fact_store/stored_fact.ts +80 -0
- package/src/storage/index.ts +1 -0
- package/src/storage/metadata.ts +1 -1
- package/src/storage/open_pxe_stores.ts +6 -3
- package/src/storage/tagging_store/index.ts +1 -1
- package/src/storage/tagging_store/tagging_secret_sources_store.ts +117 -0
- package/dest/messages/message_context_service.d.ts +0 -17
- package/dest/messages/message_context_service.d.ts.map +0 -1
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +0 -14
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +0 -1
- package/dest/storage/tagging_store/sender_address_book_store.js +0 -36
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +0 -16
- package/src/storage/tagging_store/sender_address_book_store.ts +0 -48
|
@@ -7,9 +7,10 @@ import { AddressStore } from './address_store/address_store.js';
|
|
|
7
7
|
import { AnchorBlockStore } from './anchor_block_store/anchor_block_store.js';
|
|
8
8
|
import { CapsuleStore } from './capsule_store/capsule_store.js';
|
|
9
9
|
import { ContractStore } from './contract_store/contract_store.js';
|
|
10
|
+
import { FactStore } from './fact_store/fact_store.js';
|
|
10
11
|
import { NoteStore } from './note_store/note_store.js';
|
|
11
12
|
import { PrivateEventStore } from './private_event_store/private_event_store.js';
|
|
12
|
-
import { RecipientTaggingStore,
|
|
13
|
+
import { RecipientTaggingStore, SenderTaggingStore, TaggingSecretSourcesStore } from './tagging_store/index.js';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* The set of sub-stores opened against a single `AztecAsyncKVStore` to back PXE state.
|
|
@@ -21,11 +22,12 @@ export type PxeStores = {
|
|
|
21
22
|
noteStore: NoteStore;
|
|
22
23
|
anchorBlockStore: AnchorBlockStore;
|
|
23
24
|
senderTaggingStore: SenderTaggingStore;
|
|
24
|
-
|
|
25
|
+
taggingSecretSourcesStore: TaggingSecretSourcesStore;
|
|
25
26
|
recipientTaggingStore: RecipientTaggingStore;
|
|
26
27
|
capsuleStore: CapsuleStore;
|
|
27
28
|
keyStore: KeyStore;
|
|
28
29
|
l2TipsStore: L2TipsKVStore;
|
|
30
|
+
factStore: FactStore;
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
/**
|
|
@@ -40,10 +42,11 @@ export function openPxeStores(store: AztecAsyncKVStore, initialBlockHash: BlockH
|
|
|
40
42
|
noteStore: new NoteStore(store),
|
|
41
43
|
anchorBlockStore: new AnchorBlockStore(store),
|
|
42
44
|
senderTaggingStore: new SenderTaggingStore(store),
|
|
43
|
-
|
|
45
|
+
taggingSecretSourcesStore: new TaggingSecretSourcesStore(store),
|
|
44
46
|
recipientTaggingStore: new RecipientTaggingStore(store),
|
|
45
47
|
capsuleStore: new CapsuleStore(store),
|
|
46
48
|
keyStore: new KeyStore(store),
|
|
47
49
|
l2TipsStore: new L2TipsKVStore(store, 'pxe', initialBlockHash),
|
|
50
|
+
factStore: new FactStore(store),
|
|
48
51
|
};
|
|
49
52
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { SenderTaggingStore } from './sender_tagging_store.js';
|
|
2
|
-
export {
|
|
2
|
+
export { TaggingSecretSourcesStore } from './tagging_secret_sources_store.js';
|
|
3
3
|
export { RecipientTaggingStore } from './recipient_tagging_store.js';
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
2
|
+
import { toArray } from '@aztec/foundation/iterable';
|
|
3
|
+
import type { AztecAsyncKVStore, AztecAsyncMap, AztecAsyncMultiMap } from '@aztec/kv-store';
|
|
4
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Stores the sources from which directional app tagging secrets are derived during recipient log synchronization.
|
|
8
|
+
*
|
|
9
|
+
* Two kinds of source are held:
|
|
10
|
+
* - Sender addresses: combined with a recipient to derive a shared tagging secret via ECDH. These are global (not
|
|
11
|
+
* scoped to a recipient) because the per-recipient binding comes from re-mixing the recipient's keys during
|
|
12
|
+
* derivation, so each account only ever derives secrets meant for it.
|
|
13
|
+
* - Pre-shared tagging secrets: shared secret points registered directly, bypassing ECDH. These are scoped to a
|
|
14
|
+
* specific recipient, since the derivation of the directional app tagging secret does not require any secret
|
|
15
|
+
* recipient data: given the original secret anyone can derive a recipient's app-siloed directional tagging secret,
|
|
16
|
+
* and so these must not be reused to preserve privacy.
|
|
17
|
+
*/
|
|
18
|
+
export class TaggingSecretSourcesStore {
|
|
19
|
+
#store: AztecAsyncKVStore;
|
|
20
|
+
#senders: AztecAsyncMap<string, true>;
|
|
21
|
+
#sharedSecretsByRecipient: AztecAsyncMultiMap<string, string>;
|
|
22
|
+
|
|
23
|
+
constructor(store: AztecAsyncKVStore) {
|
|
24
|
+
this.#store = store;
|
|
25
|
+
|
|
26
|
+
this.#senders = this.#store.openMap('senders');
|
|
27
|
+
this.#sharedSecretsByRecipient = this.#store.openMultiMap('recipient_shared_secrets');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
addSender(address: AztecAddress): Promise<boolean> {
|
|
31
|
+
return this.#store.transactionAsync(async () => {
|
|
32
|
+
if (await this.#senders.hasAsync(address.toString())) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
await this.#senders.set(address.toString(), true);
|
|
37
|
+
|
|
38
|
+
return true;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
getSenders(): Promise<AztecAddress[]> {
|
|
43
|
+
return this.#store.transactionAsync(async () => {
|
|
44
|
+
return (await toArray(this.#senders.keysAsync())).map(AztecAddress.fromStringUnsafe);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
removeSender(address: AztecAddress): Promise<boolean> {
|
|
49
|
+
return this.#store.transactionAsync(async () => {
|
|
50
|
+
if (!(await this.#senders.hasAsync(address.toString()))) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
await this.#senders.delete(address.toString());
|
|
55
|
+
|
|
56
|
+
return true;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Registers a pre-shared tagging secret scoped to a recipient.
|
|
62
|
+
* @returns true if the secret was newly added, false if it was already registered for that recipient.
|
|
63
|
+
*/
|
|
64
|
+
addSharedSecret(recipient: AztecAddress, secret: Point): Promise<boolean> {
|
|
65
|
+
return this.#store.transactionAsync(async () => {
|
|
66
|
+
const secretStr = secret.toString();
|
|
67
|
+
// MultiMap.set silently ignores an identical (key, value), so we scan to report whether this is a new secret.
|
|
68
|
+
for await (const existing of this.#sharedSecretsByRecipient.getValuesAsync(recipient.toString())) {
|
|
69
|
+
if (existing === secretStr) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
await this.#sharedSecretsByRecipient.set(recipient.toString(), secretStr);
|
|
75
|
+
|
|
76
|
+
return true;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Returns the pre-shared tagging secrets registered for a given recipient. */
|
|
81
|
+
getSharedSecretsForRecipient(recipient: AztecAddress): Promise<Point[]> {
|
|
82
|
+
return this.#store.transactionAsync(async () => {
|
|
83
|
+
return (await toArray(this.#sharedSecretsByRecipient.getValuesAsync(recipient.toString()))).map(secret =>
|
|
84
|
+
Point.fromString(secret),
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Returns every registered pre-shared tagging secret, each paired with the recipient it is scoped to. */
|
|
90
|
+
getAllSharedSecrets(): Promise<{ recipient: AztecAddress; secret: Point }[]> {
|
|
91
|
+
return this.#store.transactionAsync(async () => {
|
|
92
|
+
const entries = await toArray(this.#sharedSecretsByRecipient.entriesAsync());
|
|
93
|
+
return entries.map(([recipient, secret]) => ({
|
|
94
|
+
recipient: AztecAddress.fromStringUnsafe(recipient),
|
|
95
|
+
secret: Point.fromString(secret),
|
|
96
|
+
}));
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Removes a pre-shared tagging secret scoped to a recipient.
|
|
102
|
+
* @returns true if the secret was registered and removed, false if it was not registered for that recipient.
|
|
103
|
+
*/
|
|
104
|
+
removeSharedSecret(recipient: AztecAddress, secret: Point): Promise<boolean> {
|
|
105
|
+
return this.#store.transactionAsync(async () => {
|
|
106
|
+
const secretStr = secret.toString();
|
|
107
|
+
for await (const existing of this.#sharedSecretsByRecipient.getValuesAsync(recipient.toString())) {
|
|
108
|
+
if (existing === secretStr) {
|
|
109
|
+
await this.#sharedSecretsByRecipient.deleteValue(recipient.toString(), secretStr);
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return false;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
3
|
-
import { MessageContext } from '@aztec/stdlib/logs';
|
|
4
|
-
/** Resolves transaction hashes into the context needed to process messages. */
|
|
5
|
-
export declare class MessageContextService {
|
|
6
|
-
private readonly aztecNode;
|
|
7
|
-
constructor(aztecNode: AztecNode);
|
|
8
|
-
/**
|
|
9
|
-
* Resolves a list of tx hashes into their message contexts.
|
|
10
|
-
*
|
|
11
|
-
* For each tx hash, looks up the corresponding tx effect and extracts the note hashes and first nullifier needed to
|
|
12
|
-
* process messages that originated from that transaction. Returns `null` for tx hashes that are zero, not yet
|
|
13
|
-
* available, or in blocks beyond the anchor block.
|
|
14
|
-
*/
|
|
15
|
-
getMessageContextsByTxHash(txHashes: Fr[], anchorBlockNumber: number): Promise<(MessageContext | null)[]>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZV9jb250ZXh0X3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tZXNzYWdlcy9tZXNzYWdlX2NvbnRleHRfc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBR3BELCtFQUErRTtBQUMvRSxxQkFBYSxxQkFBcUI7SUFDcEIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxTQUFTO0lBQXRDLFlBQTZCLFNBQVMsRUFBRSxTQUFTLEVBQUk7SUFFckQ7Ozs7OztPQU1HO0lBQ0csMEJBQTBCLENBQUMsUUFBUSxFQUFFLEVBQUUsRUFBRSxFQUFFLGlCQUFpQixFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsQ0FBQyxjQUFjLEdBQUcsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQTJDOUc7Q0FDRiJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message_context_service.d.ts","sourceRoot":"","sources":["../../src/messages/message_context_service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,+EAA+E;AAC/E,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,SAAS,EAAI;IAErD;;;;;;OAMG;IACG,0BAA0B,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,CAAC,CA2C9G;CACF"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
/**
|
|
4
|
-
* Stores sender addresses. During recipient log synchronization, these senders are used, along with a given recipient,
|
|
5
|
-
* to derive directional app tagging secrets that are then used to sync the logs.
|
|
6
|
-
*/
|
|
7
|
-
export declare class SenderAddressBookStore {
|
|
8
|
-
#private;
|
|
9
|
-
constructor(store: AztecAsyncKVStore);
|
|
10
|
-
addSender(address: AztecAddress): Promise<boolean>;
|
|
11
|
-
getSenders(): Promise<AztecAddress[]>;
|
|
12
|
-
removeSender(address: AztecAddress): Promise<boolean>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VuZGVyX2FkZHJlc3NfYm9va19zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvdGFnZ2luZ19zdG9yZS9zZW5kZXJfYWRkcmVzc19ib29rX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFpQixNQUFNLGlCQUFpQixDQUFDO0FBQ3hFLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUUzRDs7O0dBR0c7QUFDSCxxQkFBYSxzQkFBc0I7O0lBSWpDLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQUluQztJQUVELFNBQVMsQ0FBQyxPQUFPLEVBQUUsWUFBWSxHQUFHLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FVakQ7SUFFRCxVQUFVLElBQUksT0FBTyxDQUFDLFlBQVksRUFBRSxDQUFDLENBSXBDO0lBRUQsWUFBWSxDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQVVwRDtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sender_address_book_store.d.ts","sourceRoot":"","sources":["../../../src/storage/tagging_store/sender_address_book_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;GAGG;AACH,qBAAa,sBAAsB;;IAIjC,YAAY,KAAK,EAAE,iBAAiB,EAInC;IAED,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAUjD;IAED,UAAU,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAIpC;IAED,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAUpD;CACF"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
/**
|
|
4
|
-
* Stores sender addresses. During recipient log synchronization, these senders are used, along with a given recipient,
|
|
5
|
-
* to derive directional app tagging secrets that are then used to sync the logs.
|
|
6
|
-
*/ export class SenderAddressBookStore {
|
|
7
|
-
#store;
|
|
8
|
-
#addressBook;
|
|
9
|
-
constructor(store){
|
|
10
|
-
this.#store = store;
|
|
11
|
-
this.#addressBook = this.#store.openMap('address_book');
|
|
12
|
-
}
|
|
13
|
-
addSender(address) {
|
|
14
|
-
return this.#store.transactionAsync(async ()=>{
|
|
15
|
-
if (await this.#addressBook.hasAsync(address.toString())) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
await this.#addressBook.set(address.toString(), true);
|
|
19
|
-
return true;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
getSenders() {
|
|
23
|
-
return this.#store.transactionAsync(async ()=>{
|
|
24
|
-
return (await toArray(this.#addressBook.keysAsync())).map(AztecAddress.fromString);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
removeSender(address) {
|
|
28
|
-
return this.#store.transactionAsync(async ()=>{
|
|
29
|
-
if (!await this.#addressBook.hasAsync(address.toString())) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
await this.#addressBook.delete(address.toString());
|
|
33
|
-
return true;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"address_book": [
|
|
3
|
-
{
|
|
4
|
-
"key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000002",
|
|
5
|
-
"value": "true"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000003",
|
|
9
|
-
"value": "true"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"key": "utf8:0x0000000000000000000000000000000000000000000000000000000000000005",
|
|
13
|
-
"value": "true"
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
-
import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
|
|
3
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Stores sender addresses. During recipient log synchronization, these senders are used, along with a given recipient,
|
|
7
|
-
* to derive directional app tagging secrets that are then used to sync the logs.
|
|
8
|
-
*/
|
|
9
|
-
export class SenderAddressBookStore {
|
|
10
|
-
#store: AztecAsyncKVStore;
|
|
11
|
-
#addressBook: AztecAsyncMap<string, true>;
|
|
12
|
-
|
|
13
|
-
constructor(store: AztecAsyncKVStore) {
|
|
14
|
-
this.#store = store;
|
|
15
|
-
|
|
16
|
-
this.#addressBook = this.#store.openMap('address_book');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
addSender(address: AztecAddress): Promise<boolean> {
|
|
20
|
-
return this.#store.transactionAsync(async () => {
|
|
21
|
-
if (await this.#addressBook.hasAsync(address.toString())) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
await this.#addressBook.set(address.toString(), true);
|
|
26
|
-
|
|
27
|
-
return true;
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
getSenders(): Promise<AztecAddress[]> {
|
|
32
|
-
return this.#store.transactionAsync(async () => {
|
|
33
|
-
return (await toArray(this.#addressBook.keysAsync())).map(AztecAddress.fromString);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
removeSender(address: AztecAddress): Promise<boolean> {
|
|
38
|
-
return this.#store.transactionAsync(async () => {
|
|
39
|
-
if (!(await this.#addressBook.hasAsync(address.toString()))) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
await this.#addressBook.delete(address.toString());
|
|
44
|
-
|
|
45
|
-
return true;
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|