walletkit-web 0.21.3 → 0.22.1

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.
@@ -12,6 +12,14 @@ import { type FfiConverter, type RustBufferAllocator, type UniffiByteArray, type
12
12
  * - [`CredentialConstraintsCheckError::ConstraintTooLarge`] if the constraint tree exceeds the node limit.
13
13
  */
14
14
  export declare function checkCredentialsAgainstProofRequest(request: ProofRequestLike, store: CredentialStoreLike, now: bigint): CredentialConstraintsCheckResult;
15
+ /**
16
+ * Deletes the host-owned key envelope after closing/destroying its credential store.
17
+ * This does not invalidate keys already held in memory by other owners.
18
+ *
19
+ * # Errors
20
+ * Returns an error if locking or envelope deletion fails.
21
+ */
22
+ export declare function deleteStorageKeyEnvelope(paths: StoragePathsLike, blobStore: AtomicBlobStore): void;
15
23
  /**
16
24
  * Emits a message at the given level through `WalletKit`'s tracing pipeline.
17
25
  *
@@ -33,6 +41,34 @@ export declare function emitLog(level: LogLevel, message: string): void;
33
41
  * Panics if the dedicated logger delivery thread cannot be spawned (native only).
34
42
  */
35
43
  export declare function initLogging(logger: Logger, level: LogLevel | undefined): void;
44
+ /**
45
+ * Installs persistent encrypted browser storage in the current Web Worker.
46
+ *
47
+ * This must be awaited once before initializing a [`crate::storage::CredentialStore`] on
48
+ * WASM. The function fails when called outside a supported dedicated worker
49
+ * or when another browsing context owns the same OPFS SAH pool.
50
+ *
51
+ * # Errors
52
+ *
53
+ * Returns [`StorageError::PersistentStorage`] when OPFS setup fails.
54
+ */
55
+ export declare function initializePersistentStorage(asyncOpts_?: {
56
+ signal: AbortSignal;
57
+ }): Promise<void>;
58
+ /**
59
+ * Opens the device-sealed key envelope, or generates and persists one if absent.
60
+ *
61
+ * Call this before constructing a credential store. Platform components are
62
+ * used only during this call and are not retained.
63
+ *
64
+ * `now` is Unix time in seconds, used only for a new envelope's creation and
65
+ * update timestamps. It is ignored when opening an existing envelope.
66
+ *
67
+ * # Errors
68
+ * Returns an error if locking, envelope access, key generation, sealing, or
69
+ * unsealing fails.
70
+ */
71
+ export declare function openOrCreateStorageKeys(paths: StoragePathsLike, keystore: DeviceKeystore, blobStore: AtomicBlobStore, now: bigint): StorageKeysLike;
36
72
  /**
37
73
  * Derives recovery data from a 32-byte seed.
38
74
  *
@@ -64,6 +100,144 @@ export declare function recoveryDataFromSeed(seed: ArrayBuffer): RecoveryData;
64
100
  * is not in canonical form, or is the `BabyJubJub` identity point.
65
101
  */
66
102
  export declare function validateAuthenticatorPubkey(authenticatorPubkey: string): string;
103
+ /**
104
+ * Which World ID protocol handled a proof-share request.
105
+ */
106
+ export declare enum ProtocolVersion {
107
+ /**
108
+ * Legacy Semaphore-based protocol.
109
+ */
110
+ V3 = 3,
111
+ /**
112
+ * Current. Reference: <https://github.com/worldcoin/world-id-protocol/tree/main/docs/world-id-4-specs>
113
+ */
114
+ V4 = 4
115
+ }
116
+ /**
117
+ * Terminal outcome of a proof-share request.
118
+ */
119
+ export declare enum ActivityOutcome {
120
+ /**
121
+ * Proof request was completed successfully.
122
+ */
123
+ Completed = 0,
124
+ /**
125
+ * The user declined the request.
126
+ */
127
+ Declined = 1,
128
+ /**
129
+ * The user cancelled or dismissed the request without an explicit decline.
130
+ */
131
+ Cancelled = 2,
132
+ /**
133
+ * The request failed (see [`ActivityFailureReason`]).
134
+ */
135
+ Failed = 3,
136
+ /**
137
+ * The request never reached a terminal outcome (e.g. the app was killed
138
+ * or backgrounded before completion).
139
+ */
140
+ Incomplete = 4
141
+ }
142
+ /**
143
+ * Reasons a proof fails.
144
+ */
145
+ export declare enum ActivityFailureReason {
146
+ /**
147
+ * A network request failed.
148
+ */
149
+ NetworkError = 0,
150
+ /**
151
+ * The request timed out.
152
+ */
153
+ Timeout = 1,
154
+ /**
155
+ * Device authentication (e.g. Face ID/passcode) failed.
156
+ */
157
+ DeviceAuthenticationFailed = 2,
158
+ /**
159
+ * Proof generation itself failed.
160
+ */
161
+ ProofGenerationFailed = 3,
162
+ /**
163
+ * The relying party rejected the proof.
164
+ */
165
+ RelyingPartyRejected = 4
166
+ }
167
+ /**
168
+ * A single row of credential activity history.
169
+ */
170
+ export type ActivityEntry = {
171
+ /**
172
+ * Unique identifier for this entry.
173
+ */
174
+ id?: bigint;
175
+ /**
176
+ * The relying party identifier.
177
+ */
178
+ rpId: bigint;
179
+ /**
180
+ * Host-app-defined identifier correlating this entry with its request.
181
+ */
182
+ clientId: string;
183
+ /**
184
+ * Protocol used for this request.
185
+ */
186
+ protocol: ProtocolVersion;
187
+ /**
188
+ * Activity time.
189
+ */
190
+ timestamp?: bigint;
191
+ /**
192
+ * The result of the activity.
193
+ */
194
+ outcome: ActivityOutcome;
195
+ /**
196
+ * The credentials which produced an output proof for the request.
197
+ */
198
+ issuerSchemaIds: Array<bigint>;
199
+ /**
200
+ * Present only when `outcome` is `Failed`.
201
+ */
202
+ failureReason?: ActivityFailureReason;
203
+ };
204
+ /**
205
+ * Generated factory for {@link ActivityEntry} record objects.
206
+ */
207
+ export declare const ActivityEntry: Readonly<{
208
+ create: (partial: Partial<ActivityEntry> & Required<Omit<ActivityEntry, "id" | "timestamp" | "failureReason">>) => ActivityEntry;
209
+ new: (partial: Partial<ActivityEntry> & Required<Omit<ActivityEntry, "id" | "timestamp" | "failureReason">>) => ActivityEntry;
210
+ defaults: () => Partial<ActivityEntry>;
211
+ }>;
212
+ /**
213
+ * Aggregate counts over credential activity history.
214
+ */
215
+ export type ActivityMetadata = {
216
+ /**
217
+ * Total number of recorded entries.
218
+ */
219
+ totalCount: bigint;
220
+ };
221
+ /**
222
+ * Generated factory for {@link ActivityMetadata} record objects.
223
+ */
224
+ export declare const ActivityMetadata: Readonly<{
225
+ create: (partial: Partial<ActivityMetadata> & Required<Omit<ActivityMetadata, never>>) => ActivityMetadata;
226
+ new: (partial: Partial<ActivityMetadata> & Required<Omit<ActivityMetadata, never>>) => ActivityMetadata;
227
+ defaults: () => Partial<ActivityMetadata>;
228
+ }>;
229
+ /**
230
+ * Filtering/sorting options for [`super::CredentialStore::list_activities`].
231
+ */
232
+ export type ActivityQuery = {};
233
+ /**
234
+ * Generated factory for {@link ActivityQuery} record objects.
235
+ */
236
+ export declare const ActivityQuery: Readonly<{
237
+ create: (partial: Partial<ActivityQuery> & Required<Omit<ActivityQuery, never>>) => ActivityQuery;
238
+ new: (partial: Partial<ActivityQuery> & Required<Omit<ActivityQuery, never>>) => ActivityQuery;
239
+ defaults: () => Partial<ActivityQuery>;
240
+ }>;
67
241
  /**
68
242
  * Check result for a single request item.
69
243
  */
@@ -273,9 +447,11 @@ export declare enum StorageError_Tags {
273
447
  Serialization = "Serialization",
274
448
  Crypto = "Crypto",
275
449
  InvalidEnvelope = "InvalidEnvelope",
450
+ InvalidInput = "InvalidInput",
276
451
  UnsupportedEnvelopeVersion = "UnsupportedEnvelopeVersion",
277
452
  VaultDb = "VaultDb",
278
453
  CacheDb = "CacheDb",
454
+ PersistentStorage = "PersistentStorage",
279
455
  InvalidLeafIndex = "InvalidLeafIndex",
280
456
  CorruptedVault = "CorruptedVault",
281
457
  NotInitialized = "NotInitialized",
@@ -283,6 +459,8 @@ export declare enum StorageError_Tags {
283
459
  CredentialNotFound = "CredentialNotFound",
284
460
  CredentialIdNotFound = "CredentialIdNotFound",
285
461
  CorruptedCacheEntry = "CorruptedCacheEntry",
462
+ ActivityDb = "ActivityDb",
463
+ ActivityInvalidRecord = "ActivityInvalidRecord",
286
464
  UnexpectedUniFfiCallbackError = "UnexpectedUniFfiCallbackError"
287
465
  }
288
466
  /**
@@ -692,6 +870,73 @@ export declare const StorageError: Readonly<{
692
870
  cause?: unknown;
693
871
  }): Readonly<[string]>;
694
872
  };
873
+ InvalidInput: {
874
+ new (v0: string): {
875
+ readonly tag: StorageError_Tags.InvalidInput;
876
+ readonly inner: Readonly<[string]>;
877
+ /**
878
+ * @private
879
+ * This field is private and should not be used, use `tag` instead.
880
+ */
881
+ readonly [uniffiTypeNameSymbol]: "StorageError";
882
+ name: string;
883
+ message: string;
884
+ stack?: string;
885
+ cause?: unknown;
886
+ };
887
+ "new"(v0: string): {
888
+ readonly tag: StorageError_Tags.InvalidInput;
889
+ readonly inner: Readonly<[string]>;
890
+ /**
891
+ * @private
892
+ * This field is private and should not be used, use `tag` instead.
893
+ */
894
+ readonly [uniffiTypeNameSymbol]: "StorageError";
895
+ name: string;
896
+ message: string;
897
+ stack?: string;
898
+ cause?: unknown;
899
+ };
900
+ instanceOf(obj: any): obj is {
901
+ readonly tag: StorageError_Tags.InvalidInput;
902
+ readonly inner: Readonly<[string]>;
903
+ /**
904
+ * @private
905
+ * This field is private and should not be used, use `tag` instead.
906
+ */
907
+ readonly [uniffiTypeNameSymbol]: "StorageError";
908
+ name: string;
909
+ message: string;
910
+ stack?: string;
911
+ cause?: unknown;
912
+ };
913
+ hasInner(obj: any): obj is {
914
+ readonly tag: StorageError_Tags.InvalidInput;
915
+ readonly inner: Readonly<[string]>;
916
+ /**
917
+ * @private
918
+ * This field is private and should not be used, use `tag` instead.
919
+ */
920
+ readonly [uniffiTypeNameSymbol]: "StorageError";
921
+ name: string;
922
+ message: string;
923
+ stack?: string;
924
+ cause?: unknown;
925
+ };
926
+ getInner(obj: {
927
+ readonly tag: StorageError_Tags.InvalidInput;
928
+ readonly inner: Readonly<[string]>;
929
+ /**
930
+ * @private
931
+ * This field is private and should not be used, use `tag` instead.
932
+ */
933
+ readonly [uniffiTypeNameSymbol]: "StorageError";
934
+ name: string;
935
+ message: string;
936
+ stack?: string;
937
+ cause?: unknown;
938
+ }): Readonly<[string]>;
939
+ };
695
940
  UnsupportedEnvelopeVersion: {
696
941
  new (v0: number): {
697
942
  readonly tag: StorageError_Tags.UnsupportedEnvelopeVersion;
@@ -893,6 +1138,73 @@ export declare const StorageError: Readonly<{
893
1138
  cause?: unknown;
894
1139
  }): Readonly<[string]>;
895
1140
  };
1141
+ PersistentStorage: {
1142
+ new (v0: string): {
1143
+ readonly tag: StorageError_Tags.PersistentStorage;
1144
+ readonly inner: Readonly<[string]>;
1145
+ /**
1146
+ * @private
1147
+ * This field is private and should not be used, use `tag` instead.
1148
+ */
1149
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1150
+ name: string;
1151
+ message: string;
1152
+ stack?: string;
1153
+ cause?: unknown;
1154
+ };
1155
+ "new"(v0: string): {
1156
+ readonly tag: StorageError_Tags.PersistentStorage;
1157
+ readonly inner: Readonly<[string]>;
1158
+ /**
1159
+ * @private
1160
+ * This field is private and should not be used, use `tag` instead.
1161
+ */
1162
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1163
+ name: string;
1164
+ message: string;
1165
+ stack?: string;
1166
+ cause?: unknown;
1167
+ };
1168
+ instanceOf(obj: any): obj is {
1169
+ readonly tag: StorageError_Tags.PersistentStorage;
1170
+ readonly inner: Readonly<[string]>;
1171
+ /**
1172
+ * @private
1173
+ * This field is private and should not be used, use `tag` instead.
1174
+ */
1175
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1176
+ name: string;
1177
+ message: string;
1178
+ stack?: string;
1179
+ cause?: unknown;
1180
+ };
1181
+ hasInner(obj: any): obj is {
1182
+ readonly tag: StorageError_Tags.PersistentStorage;
1183
+ readonly inner: Readonly<[string]>;
1184
+ /**
1185
+ * @private
1186
+ * This field is private and should not be used, use `tag` instead.
1187
+ */
1188
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1189
+ name: string;
1190
+ message: string;
1191
+ stack?: string;
1192
+ cause?: unknown;
1193
+ };
1194
+ getInner(obj: {
1195
+ readonly tag: StorageError_Tags.PersistentStorage;
1196
+ readonly inner: Readonly<[string]>;
1197
+ /**
1198
+ * @private
1199
+ * This field is private and should not be used, use `tag` instead.
1200
+ */
1201
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1202
+ name: string;
1203
+ message: string;
1204
+ stack?: string;
1205
+ cause?: unknown;
1206
+ }): Readonly<[string]>;
1207
+ };
896
1208
  InvalidLeafIndex: {
897
1209
  new (inner: {
898
1210
  expected: bigint;
@@ -1367,6 +1679,140 @@ export declare const StorageError: Readonly<{
1367
1679
  keyPrefix: number;
1368
1680
  }>;
1369
1681
  };
1682
+ ActivityDb: {
1683
+ new (v0: string): {
1684
+ readonly tag: StorageError_Tags.ActivityDb;
1685
+ readonly inner: Readonly<[string]>;
1686
+ /**
1687
+ * @private
1688
+ * This field is private and should not be used, use `tag` instead.
1689
+ */
1690
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1691
+ name: string;
1692
+ message: string;
1693
+ stack?: string;
1694
+ cause?: unknown;
1695
+ };
1696
+ "new"(v0: string): {
1697
+ readonly tag: StorageError_Tags.ActivityDb;
1698
+ readonly inner: Readonly<[string]>;
1699
+ /**
1700
+ * @private
1701
+ * This field is private and should not be used, use `tag` instead.
1702
+ */
1703
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1704
+ name: string;
1705
+ message: string;
1706
+ stack?: string;
1707
+ cause?: unknown;
1708
+ };
1709
+ instanceOf(obj: any): obj is {
1710
+ readonly tag: StorageError_Tags.ActivityDb;
1711
+ readonly inner: Readonly<[string]>;
1712
+ /**
1713
+ * @private
1714
+ * This field is private and should not be used, use `tag` instead.
1715
+ */
1716
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1717
+ name: string;
1718
+ message: string;
1719
+ stack?: string;
1720
+ cause?: unknown;
1721
+ };
1722
+ hasInner(obj: any): obj is {
1723
+ readonly tag: StorageError_Tags.ActivityDb;
1724
+ readonly inner: Readonly<[string]>;
1725
+ /**
1726
+ * @private
1727
+ * This field is private and should not be used, use `tag` instead.
1728
+ */
1729
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1730
+ name: string;
1731
+ message: string;
1732
+ stack?: string;
1733
+ cause?: unknown;
1734
+ };
1735
+ getInner(obj: {
1736
+ readonly tag: StorageError_Tags.ActivityDb;
1737
+ readonly inner: Readonly<[string]>;
1738
+ /**
1739
+ * @private
1740
+ * This field is private and should not be used, use `tag` instead.
1741
+ */
1742
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1743
+ name: string;
1744
+ message: string;
1745
+ stack?: string;
1746
+ cause?: unknown;
1747
+ }): Readonly<[string]>;
1748
+ };
1749
+ ActivityInvalidRecord: {
1750
+ new (v0: string): {
1751
+ readonly tag: StorageError_Tags.ActivityInvalidRecord;
1752
+ readonly inner: Readonly<[string]>;
1753
+ /**
1754
+ * @private
1755
+ * This field is private and should not be used, use `tag` instead.
1756
+ */
1757
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1758
+ name: string;
1759
+ message: string;
1760
+ stack?: string;
1761
+ cause?: unknown;
1762
+ };
1763
+ "new"(v0: string): {
1764
+ readonly tag: StorageError_Tags.ActivityInvalidRecord;
1765
+ readonly inner: Readonly<[string]>;
1766
+ /**
1767
+ * @private
1768
+ * This field is private and should not be used, use `tag` instead.
1769
+ */
1770
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1771
+ name: string;
1772
+ message: string;
1773
+ stack?: string;
1774
+ cause?: unknown;
1775
+ };
1776
+ instanceOf(obj: any): obj is {
1777
+ readonly tag: StorageError_Tags.ActivityInvalidRecord;
1778
+ readonly inner: Readonly<[string]>;
1779
+ /**
1780
+ * @private
1781
+ * This field is private and should not be used, use `tag` instead.
1782
+ */
1783
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1784
+ name: string;
1785
+ message: string;
1786
+ stack?: string;
1787
+ cause?: unknown;
1788
+ };
1789
+ hasInner(obj: any): obj is {
1790
+ readonly tag: StorageError_Tags.ActivityInvalidRecord;
1791
+ readonly inner: Readonly<[string]>;
1792
+ /**
1793
+ * @private
1794
+ * This field is private and should not be used, use `tag` instead.
1795
+ */
1796
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1797
+ name: string;
1798
+ message: string;
1799
+ stack?: string;
1800
+ cause?: unknown;
1801
+ };
1802
+ getInner(obj: {
1803
+ readonly tag: StorageError_Tags.ActivityInvalidRecord;
1804
+ readonly inner: Readonly<[string]>;
1805
+ /**
1806
+ * @private
1807
+ * This field is private and should not be used, use `tag` instead.
1808
+ */
1809
+ readonly [uniffiTypeNameSymbol]: "StorageError";
1810
+ name: string;
1811
+ message: string;
1812
+ stack?: string;
1813
+ cause?: unknown;
1814
+ }): Readonly<[string]>;
1815
+ };
1370
1816
  UnexpectedUniFfiCallbackError: {
1371
1817
  new (v0: string): {
1372
1818
  readonly tag: StorageError_Tags.UnexpectedUniFfiCallbackError;
@@ -1438,7 +1884,7 @@ export declare const StorageError: Readonly<{
1438
1884
  /**
1439
1885
  * Errors raised by credential storage primitives.
1440
1886
  */
1441
- export type StorageError = InstanceType<(typeof StorageError)["Keystore" | "BlobStore" | "Lock" | "Serialization" | "Crypto" | "InvalidEnvelope" | "UnsupportedEnvelopeVersion" | "VaultDb" | "CacheDb" | "InvalidLeafIndex" | "CorruptedVault" | "NotInitialized" | "NullifierAlreadyDisclosed" | "CredentialNotFound" | "CredentialIdNotFound" | "CorruptedCacheEntry" | "UnexpectedUniFfiCallbackError"]>;
1887
+ export type StorageError = InstanceType<(typeof StorageError)["Keystore" | "BlobStore" | "Lock" | "Serialization" | "Crypto" | "InvalidEnvelope" | "InvalidInput" | "UnsupportedEnvelopeVersion" | "VaultDb" | "CacheDb" | "PersistentStorage" | "InvalidLeafIndex" | "CorruptedVault" | "NotInitialized" | "NullifierAlreadyDisclosed" | "CredentialNotFound" | "CredentialIdNotFound" | "CorruptedCacheEntry" | "ActivityDb" | "ActivityInvalidRecord" | "UnexpectedUniFfiCallbackError"]>;
1442
1888
  export declare enum CredentialConstraintsCheckError_Tags {
1443
1889
  Storage = "Storage",
1444
1890
  ConstraintTooDeep = "ConstraintTooDeep",
@@ -4616,9 +5062,11 @@ export interface AuthenticatorLike {
4616
5062
  signal: AbortSignal;
4617
5063
  }): Promise<RecoveryUpdateSignature>;
4618
5064
  /**
4619
- * Permanently destroys all credential storage data.
5065
+ * Closes credential storage and attempts to delete its database files.
4620
5066
  *
4621
- * Removes the encryption keys, vault database, and cache database.
5067
+ * Releases the store's key reference and removes the vault and cache databases
5068
+ * on a best-effort basis. File deletion failures are logged, not returned.
5069
+ * The host must separately delete any key envelope it owns.
4622
5070
  * After this call the authenticator can no longer generate proofs or
4623
5071
  * access stored credentials. Intended for logout or account deletion.
4624
5072
  *
@@ -4944,9 +5392,11 @@ export declare class Authenticator extends UniffiAbstractObject implements Authe
4944
5392
  signal: AbortSignal;
4945
5393
  }): Promise<RecoveryUpdateSignature>;
4946
5394
  /**
4947
- * Permanently destroys all credential storage data.
5395
+ * Closes credential storage and attempts to delete its database files.
4948
5396
  *
4949
- * Removes the encryption keys, vault database, and cache database.
5397
+ * Releases the store's key reference and removes the vault and cache databases
5398
+ * on a best-effort basis. File deletion failures are logged, not returned.
5399
+ * The host must separately delete any key envelope it owns.
4950
5400
  * After this call the authenticator can no longer generate proofs or
4951
5401
  * access stored credentials. Intended for logout or account deletion.
4952
5402
  *
@@ -5191,6 +5641,24 @@ export interface CredentialLike {
5191
5641
  * The commitment scheme is issuer-defined.
5192
5642
  */
5193
5643
  associatedDataCommitment(): FieldElementLike;
5644
+ /**
5645
+ * Returns the credential's raw claims, in schema order.
5646
+ *
5647
+ * Each claim is a field element; interpretation is defined by the issuer
5648
+ * schema ([`Self::issuer_schema_id`]). Unset slots hold the zero field
5649
+ * element. This exposes nothing [`Self::to_bytes`] doesn't already
5650
+ * serialize — it is an accessor, not a disclosure mechanism; whether and
5651
+ * which claims leave the device is entirely the host app's policy.
5652
+ */
5653
+ claims(): Array<FieldElementLike>;
5654
+ /**
5655
+ * Returns the credential's raw claims as hex-encoded, padded strings, in
5656
+ * schema order.
5657
+ *
5658
+ * Convenience over [`Self::claims`] using the same encoding claims carry
5659
+ * in credential JSON.
5660
+ */
5661
+ claimsHex(): Array<string>;
5194
5662
  /**
5195
5663
  * Returns the credential's expiration timestamp (unix seconds).
5196
5664
  */
@@ -5228,23 +5696,29 @@ export declare class Credential extends UniffiAbstractObject implements Credenti
5228
5696
  */
5229
5697
  static fromBytes(bytes: ArrayBuffer): CredentialLike;
5230
5698
  /**
5231
- * Deserializes a `Credential` from an issuer response shaped as
5232
- * `{ "credential": ... }`.
5233
- *
5234
- * Accepting the complete response lets JavaScript callers pass its raw
5235
- * bytes to Rust without parsing signed `u64` fields as lossy JS numbers.
5699
+ * Returns the credential's `associated_data_commitment` field element.
5236
5700
  *
5237
- * # Errors
5701
+ * The commitment scheme is issuer-defined.
5702
+ */
5703
+ associatedDataCommitment(): FieldElementLike;
5704
+ /**
5705
+ * Returns the credential's raw claims, in schema order.
5238
5706
  *
5239
- * Returns an error if the response or its credential cannot be deserialized.
5707
+ * Each claim is a field element; interpretation is defined by the issuer
5708
+ * schema ([`Self::issuer_schema_id`]). Unset slots hold the zero field
5709
+ * element. This exposes nothing [`Self::to_bytes`] doesn't already
5710
+ * serialize — it is an accessor, not a disclosure mechanism; whether and
5711
+ * which claims leave the device is entirely the host app's policy.
5240
5712
  */
5241
- static fromIssuanceResponseBytes(bytes: ArrayBuffer): CredentialLike;
5713
+ claims(): Array<FieldElementLike>;
5242
5714
  /**
5243
- * Returns the credential's `associated_data_commitment` field element.
5715
+ * Returns the credential's raw claims as hex-encoded, padded strings, in
5716
+ * schema order.
5244
5717
  *
5245
- * The commitment scheme is issuer-defined.
5718
+ * Convenience over [`Self::claims`] using the same encoding claims carry
5719
+ * in credential JSON.
5246
5720
  */
5247
- associatedDataCommitment(): FieldElementLike;
5721
+ claimsHex(): Array<string>;
5248
5722
  /**
5249
5723
  * Returns the credential's expiration timestamp (unix seconds).
5250
5724
  */
@@ -5368,6 +5842,22 @@ export declare class StoragePaths extends UniffiAbstractObject implements Storag
5368
5842
  * Concrete storage implementation backed by `SQLCipher` databases.
5369
5843
  */
5370
5844
  export interface CredentialStoreLike {
5845
+ /**
5846
+ * Returns aggregate credential-activity metadata.
5847
+ *
5848
+ * # Errors
5849
+ *
5850
+ * Returns an error if the store is not initialized or the query fails.
5851
+ */
5852
+ activityMetadata(): ActivityMetadata;
5853
+ /**
5854
+ * Deletes all activity entries. Returns the number of entries deleted.
5855
+ *
5856
+ * # Errors
5857
+ *
5858
+ * Returns an error if the store is not initialized or the delete fails.
5859
+ */
5860
+ clearActivities(): bigint;
5371
5861
  /**
5372
5862
  * **Development only.** Permanently deletes all stored credentials and their
5373
5863
  * associated blob data from the vault.
@@ -5397,21 +5887,31 @@ export interface CredentialStoreLike {
5397
5887
  */
5398
5888
  deleteCredential(credentialId: bigint): void;
5399
5889
  /**
5400
- * Permanently destroys all credential storage data.
5890
+ * Closes the databases, releases this store's key reference, and attempts file cleanup.
5401
5891
  *
5402
- * This removes the encryption key envelope, the vault database, and the
5403
- * cache database. After this call the store is left in an uninitialized
5404
- * state any subsequent operation (other than re-initialization) will
5405
- * return [`StorageError::NotInitialized`].
5892
+ * The host owns envelope deletion via `delete_storage_key_envelope`. This
5893
+ * store cannot be reinitialized after destruction; construct a new store
5894
+ * with resolved keys. Other key owners are unaffected.
5895
+ * Database file deletion is best effort: failures are logged, not returned.
5406
5896
  *
5407
- * Intended for use when the user logs out or deletes their account.
5897
+ * # Errors
5898
+ * Returns an error if locking fails.
5899
+ */
5900
+ destroyStorage(): void;
5901
+ /**
5902
+ * Retrieves the most recent non-expired credential matching the issuer
5903
+ * schema ID, or `None` when the store holds no usable match.
5904
+ *
5905
+ * This is the same selection `generate_proof` uses when building its
5906
+ * credential inputs, so fields read from the returned credential (e.g.
5907
+ * [`Credential::claims_hex`]) describe the credential a proof for that
5908
+ * schema is generated against.
5408
5909
  *
5409
5910
  * # Errors
5410
5911
  *
5411
- * Returns an error if the storage lock cannot be acquired or the key
5412
- * envelope cannot be deleted from the blob store.
5912
+ * Returns an error if the credential query fails.
5413
5913
  */
5414
- destroyStorage(): void;
5914
+ fetchCredential(issuerSchemaId: bigint, now: bigint): CredentialLike | undefined;
5415
5915
  /**
5416
5916
  * Initializes storage and validates the account leaf index.
5417
5917
  *
@@ -5420,6 +5920,14 @@ export interface CredentialStoreLike {
5420
5920
  * Returns an error if initialization fails or the leaf index mismatches.
5421
5921
  */
5422
5922
  init(leafIndex: bigint, now: bigint): void;
5923
+ /**
5924
+ * Lists activity entries, most recent first.
5925
+ *
5926
+ * # Errors
5927
+ *
5928
+ * Returns an error if the store is not initialized or the query fails.
5929
+ */
5930
+ listActivities(query: ActivityQuery, limit: number, offset: number): Array<ActivityEntry>;
5423
5931
  /**
5424
5932
  * Lists credential metadata, optionally filtered by issuer schema ID.
5425
5933
  *
@@ -5431,6 +5939,14 @@ export interface CredentialStoreLike {
5431
5939
  * Returns an error if the credential query fails.
5432
5940
  */
5433
5941
  listCredentials(issuerSchemaId: bigint | undefined, now: bigint): Array<CredentialRecord>;
5942
+ /**
5943
+ * Records a new activity entry.
5944
+ *
5945
+ * # Errors
5946
+ *
5947
+ * Returns an error if the store is not initialized or the query fails.
5948
+ */
5949
+ recordActivity(entry: ActivityEntry, now: bigint): bigint;
5434
5950
  /**
5435
5951
  * Returns the storage paths used by this handle.
5436
5952
  *
@@ -5459,35 +5975,33 @@ export declare class CredentialStore extends UniffiAbstractObject implements Cre
5459
5975
  readonly [uniffiTypeNameSymbol] = "CredentialStore";
5460
5976
  readonly [destructorGuardSymbol]: UniffiGcObject;
5461
5977
  readonly [pointerLiteralSymbol]: UniffiHandle;
5462
- private constructor();
5463
5978
  /**
5464
- * Creates a new storage handle from a platform provider.
5979
+ * Creates storage from paths and an already-resolved database key.
5465
5980
  *
5466
- * # Errors
5981
+ * The store retains the keys through initialization retries and releases
5982
+ * its reference on destruction. Callers should release their own key handles
5983
+ * once construction succeeds.
5467
5984
  *
5985
+ * # Errors
5468
5986
  * Returns an error if the storage lock cannot be opened.
5469
5987
  */
5470
- static fromProviderArc(provider: StorageProvider): CredentialStoreLike;
5988
+ constructor(paths: StoragePathsLike, keys: StorageKeysLike);
5471
5989
  /**
5472
- * Creates process-local credential storage for browser demos and tests.
5473
- *
5474
- * The store is discarded when the page is refreshed. Its key envelope is
5475
- * kept in memory without device-bound encryption, so callers must not use
5476
- * this constructor for production credentials.
5990
+ * Returns aggregate credential-activity metadata.
5477
5991
  *
5478
5992
  * # Errors
5479
5993
  *
5480
- * Returns an error if the in-memory storage handle cannot be created.
5994
+ * Returns an error if the store is not initialized or the query fails.
5481
5995
  */
5482
- static newEphemeral(): CredentialStoreLike;
5996
+ activityMetadata(): ActivityMetadata;
5483
5997
  /**
5484
- * Creates a new storage handle from explicit components.
5998
+ * Deletes all activity entries. Returns the number of entries deleted.
5485
5999
  *
5486
6000
  * # Errors
5487
6001
  *
5488
- * Returns an error if the storage lock cannot be opened.
6002
+ * Returns an error if the store is not initialized or the delete fails.
5489
6003
  */
5490
- static newWithComponents(paths: StoragePathsLike, keystore: DeviceKeystore, blobStore: AtomicBlobStore): CredentialStoreLike;
6004
+ clearActivities(): bigint;
5491
6005
  /**
5492
6006
  * **Development only.** Permanently deletes all stored credentials and their
5493
6007
  * associated blob data from the vault.
@@ -5517,21 +6031,31 @@ export declare class CredentialStore extends UniffiAbstractObject implements Cre
5517
6031
  */
5518
6032
  deleteCredential(credentialId: bigint): void;
5519
6033
  /**
5520
- * Permanently destroys all credential storage data.
6034
+ * Closes the databases, releases this store's key reference, and attempts file cleanup.
5521
6035
  *
5522
- * This removes the encryption key envelope, the vault database, and the
5523
- * cache database. After this call the store is left in an uninitialized
5524
- * state any subsequent operation (other than re-initialization) will
5525
- * return [`StorageError::NotInitialized`].
6036
+ * The host owns envelope deletion via `delete_storage_key_envelope`. This
6037
+ * store cannot be reinitialized after destruction; construct a new store
6038
+ * with resolved keys. Other key owners are unaffected.
6039
+ * Database file deletion is best effort: failures are logged, not returned.
5526
6040
  *
5527
- * Intended for use when the user logs out or deletes their account.
6041
+ * # Errors
6042
+ * Returns an error if locking fails.
6043
+ */
6044
+ destroyStorage(): void;
6045
+ /**
6046
+ * Retrieves the most recent non-expired credential matching the issuer
6047
+ * schema ID, or `None` when the store holds no usable match.
6048
+ *
6049
+ * This is the same selection `generate_proof` uses when building its
6050
+ * credential inputs, so fields read from the returned credential (e.g.
6051
+ * [`Credential::claims_hex`]) describe the credential a proof for that
6052
+ * schema is generated against.
5528
6053
  *
5529
6054
  * # Errors
5530
6055
  *
5531
- * Returns an error if the storage lock cannot be acquired or the key
5532
- * envelope cannot be deleted from the blob store.
6056
+ * Returns an error if the credential query fails.
5533
6057
  */
5534
- destroyStorage(): void;
6058
+ fetchCredential(issuerSchemaId: bigint, now: bigint): CredentialLike | undefined;
5535
6059
  /**
5536
6060
  * Initializes storage and validates the account leaf index.
5537
6061
  *
@@ -5540,6 +6064,14 @@ export declare class CredentialStore extends UniffiAbstractObject implements Cre
5540
6064
  * Returns an error if initialization fails or the leaf index mismatches.
5541
6065
  */
5542
6066
  init(leafIndex: bigint, now: bigint): void;
6067
+ /**
6068
+ * Lists activity entries, most recent first.
6069
+ *
6070
+ * # Errors
6071
+ *
6072
+ * Returns an error if the store is not initialized or the query fails.
6073
+ */
6074
+ listActivities(query: ActivityQuery, limit: number, offset: number): Array<ActivityEntry>;
5543
6075
  /**
5544
6076
  * Lists credential metadata, optionally filtered by issuer schema ID.
5545
6077
  *
@@ -5551,6 +6083,14 @@ export declare class CredentialStore extends UniffiAbstractObject implements Cre
5551
6083
  * Returns an error if the credential query fails.
5552
6084
  */
5553
6085
  listCredentials(issuerSchemaId: bigint | undefined, now: bigint): Array<CredentialRecord>;
6086
+ /**
6087
+ * Records a new activity entry.
6088
+ *
6089
+ * # Errors
6090
+ *
6091
+ * Returns an error if the store is not initialized or the query fails.
6092
+ */
6093
+ recordActivity(entry: ActivityEntry, now: bigint): bigint;
5554
6094
  /**
5555
6095
  * Returns the storage paths used by this handle.
5556
6096
  *
@@ -5889,6 +6429,37 @@ export declare class LoggerImpl extends UniffiAbstractObject implements Logger {
5889
6429
  uniffiDestroy(): void;
5890
6430
  static instanceOf(obj_: any): obj_ is LoggerImpl;
5891
6431
  }
6432
+ /**
6433
+ * Resolved in-memory database keys, independent of their source.
6434
+ *
6435
+ * Keys are zeroized when the last owner drops this object.
6436
+ */
6437
+ export interface StorageKeysLike {
6438
+ }
6439
+ /**
6440
+ * @deprecated Use `StorageKeysLike` instead.
6441
+ */
6442
+ export type StorageKeysInterface = StorageKeysLike;
6443
+ /**
6444
+ * Resolved in-memory database keys, independent of their source.
6445
+ *
6446
+ * Keys are zeroized when the last owner drops this object.
6447
+ */
6448
+ export declare class StorageKeys extends UniffiAbstractObject implements StorageKeysLike {
6449
+ readonly [uniffiTypeNameSymbol] = "StorageKeys";
6450
+ readonly [destructorGuardSymbol]: UniffiGcObject;
6451
+ readonly [pointerLiteralSymbol]: UniffiHandle;
6452
+ private constructor();
6453
+ /**
6454
+ * Takes a resolved 32-byte database key, for example derived from a passkey PRF.
6455
+ *
6456
+ * # Errors
6457
+ * Returns an error if the key is not exactly 32 bytes.
6458
+ */
6459
+ static fromBytes(databaseKey: ArrayBuffer): StorageKeysLike;
6460
+ uniffiDestroy(): void;
6461
+ static instanceOf(obj_: any): obj_ is StorageKeys;
6462
+ }
5892
6463
  /**
5893
6464
  * Provider responsible for platform-specific storage components and paths.
5894
6465
  */
@@ -6048,6 +6619,41 @@ declare function uniffiEnsureInitialized(): void;
6048
6619
  declare const _default: Readonly<{
6049
6620
  initialize: typeof uniffiEnsureInitialized;
6050
6621
  converters: {
6622
+ FfiConverterTypeActivityEntry: {
6623
+ readFromCursor(c: Cursor): ActivityEntry;
6624
+ writeIntoCursor(value: ActivityEntry, c: Cursor): void;
6625
+ allocationSize(value: ActivityEntry): number;
6626
+ lift(value: UniffiByteArray): ActivityEntry;
6627
+ lower(value: ActivityEntry, alloc: RustBufferAllocator): UniffiByteArray;
6628
+ };
6629
+ FfiConverterTypeActivityFailureReason: {
6630
+ readFromCursor(c: Cursor): ActivityFailureReason;
6631
+ writeIntoCursor(value: ActivityFailureReason, c: Cursor): void;
6632
+ allocationSize(value: ActivityFailureReason): number;
6633
+ lift(value: UniffiByteArray): ActivityFailureReason;
6634
+ lower(value: ActivityFailureReason, alloc: RustBufferAllocator): UniffiByteArray;
6635
+ };
6636
+ FfiConverterTypeActivityMetadata: {
6637
+ readFromCursor(c: Cursor): ActivityMetadata;
6638
+ writeIntoCursor(value: ActivityMetadata, c: Cursor): void;
6639
+ allocationSize(value: ActivityMetadata): number;
6640
+ lift(value: UniffiByteArray): ActivityMetadata;
6641
+ lower(value: ActivityMetadata, alloc: RustBufferAllocator): UniffiByteArray;
6642
+ };
6643
+ FfiConverterTypeActivityOutcome: {
6644
+ readFromCursor(c: Cursor): ActivityOutcome;
6645
+ writeIntoCursor(value: ActivityOutcome, c: Cursor): void;
6646
+ allocationSize(value: ActivityOutcome): number;
6647
+ lift(value: UniffiByteArray): ActivityOutcome;
6648
+ lower(value: ActivityOutcome, alloc: RustBufferAllocator): UniffiByteArray;
6649
+ };
6650
+ FfiConverterTypeActivityQuery: {
6651
+ readFromCursor(c: Cursor): ActivityQuery;
6652
+ writeIntoCursor(value: ActivityQuery, c: Cursor): void;
6653
+ allocationSize(value: ActivityQuery): number;
6654
+ lift(value: UniffiByteArray): ActivityQuery;
6655
+ lower(value: ActivityQuery, alloc: RustBufferAllocator): UniffiByteArray;
6656
+ };
6051
6657
  FfiConverterTypeAtomicBlobStore: FfiConverterObjectWithCallbacks<AtomicBlobStore>;
6052
6658
  FfiConverterTypeAuthenticator: FfiConverterObject<AuthenticatorLike>;
6053
6659
  FfiConverterTypeBlobKind: {
@@ -6116,6 +6722,13 @@ declare const _default: Readonly<{
6116
6722
  FfiConverterTypeOwnershipProof: FfiConverterObject<OwnershipProofLike>;
6117
6723
  FfiConverterTypeProofRequest: FfiConverterObject<ProofRequestLike>;
6118
6724
  FfiConverterTypeProofResponse: FfiConverterObject<ProofResponseLike>;
6725
+ FfiConverterTypeProtocolVersion: {
6726
+ readFromCursor(c: Cursor): ProtocolVersion;
6727
+ writeIntoCursor(value: ProtocolVersion, c: Cursor): void;
6728
+ allocationSize(value: ProtocolVersion): number;
6729
+ lift(value: UniffiByteArray): ProtocolVersion;
6730
+ lower(value: ProtocolVersion, alloc: RustBufferAllocator): UniffiByteArray;
6731
+ };
6119
6732
  FfiConverterTypeRecoveryData: {
6120
6733
  readFromCursor(c: Cursor): RecoveryData;
6121
6734
  writeIntoCursor(value: RecoveryData, c: Cursor): void;
@@ -6165,6 +6778,7 @@ declare const _default: Readonly<{
6165
6778
  lift(value: UniffiByteArray): StorageError;
6166
6779
  lower(value: StorageError, alloc: RustBufferAllocator): UniffiByteArray;
6167
6780
  };
6781
+ FfiConverterTypeStorageKeys: FfiConverterObject<StorageKeysLike>;
6168
6782
  FfiConverterTypeStoragePaths: FfiConverterObject<StoragePathsLike>;
6169
6783
  FfiConverterTypeStorageProvider: FfiConverterObjectWithCallbacks<StorageProvider>;
6170
6784
  FfiConverterTypeUint256: FfiConverter<UniffiByteArray, string>;