@fireproof/core 0.20.0-dev-preview-23 → 0.20.0-dev-preview-25

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Logger, Future, ResolveOnce, URI, Result, ResolveSeq, CoerceURI, CryptoRuntime, CTCryptoKey, EnvFactoryOpts, Env, runtimeFn } from '@adviser/cement';
1
+ import { Logger, Future, Result, ResolveOnce, URI, ResolveSeq, CoerceURI, CryptoRuntime, CTCryptoKey, EnvFactoryOpts, Env, runtimeFn } from '@adviser/cement';
2
2
  import { EventLink } from '@fireproof/vendor/@web3-storage/pail/clock/api';
3
3
  import { Operation } from '@fireproof/vendor/@web3-storage/pail/crdt/api';
4
4
  import { ByteView, ArrayBufferView, Version, Block as Block$1, UnknownLink, CID, Link, BlockView, MultihashHasher } from 'multiformats';
@@ -98,25 +98,56 @@ declare class CommitQueue<T = void> {
98
98
  processNext(): void;
99
99
  }
100
100
 
101
+ declare class keyWithFingerPrint implements KeyWithFingerPrint {
102
+ #private;
103
+ readonly default: boolean;
104
+ readonly fingerPrint: string;
105
+ readonly key: CTCryptoKey;
106
+ private kfp;
107
+ constructor(kfp: KeyWithFingerPrint, material: string | Uint8Array, def: boolean);
108
+ extract(): Promise<KeyMaterial>;
109
+ asV2StorageKeyItem(): Promise<V2StorageKeyItem>;
110
+ }
111
+ declare function toKeyWithFingerPrint(keybag: KeyBag, materialStrOrUint8: string | Uint8Array): Promise<Result<KeyWithFingerPrint>>;
112
+ declare class keysByFingerprint implements KeysByFingerprint {
113
+ readonly keys: Record<string, keyWithFingerPrint>;
114
+ readonly keybag: KeyBag;
115
+ readonly name: string;
116
+ static from(keyBag: KeyBag, named: KeysItem): Promise<KeysByFingerprint>;
117
+ constructor(keyBag: KeyBag, name: string);
118
+ get(fingerPrint?: Uint8Array | string): Promise<KeyWithFingerPrint | undefined>;
119
+ upsert(materialStrOrUint8: string | Uint8Array, def: boolean, keyBagAction?: boolean): Promise<Result<KeyUpsertResult>>;
120
+ asKeysItem(): Promise<KeysItem>;
121
+ }
101
122
  declare class KeyBag {
102
- readonly rt: KeyBagRuntime;
103
123
  readonly logger: Logger;
124
+ readonly rt: KeyBagRuntime;
104
125
  constructor(rt: KeyBagRuntime);
105
126
  readonly _warnOnce: ResolveOnce<void>;
106
- subtleKey(key: string): Promise<CryptoKey>;
127
+ subtleKey(materialStrOrUint8: string | Uint8Array): Promise<CryptoKey>;
107
128
  ensureKeyFromUrl(url: URI, keyFactory: () => string): Promise<Result<URI>>;
108
- toKeyWithFingerPrint(keyStr: string): Promise<Result<KeyWithFingerPrint>>;
109
- readonly _seq: ResolveSeq<Result<KeyWithFingerPrint>>;
110
- setNamedKey(name: string, key: string): Promise<Result<KeyWithFingerPrint>>;
111
- _setNamedKey(name: string, key: string): Promise<Result<KeyWithFingerPrint>>;
112
- getNamedExtractableKey(name: string, failIfNotFound?: boolean): Promise<Result<KeyWithFingerExtract>>;
113
- getNamedKey(name: string, failIfNotFound?: boolean): Promise<Result<KeyWithFingerPrint>>;
114
- }
115
- interface KeyItem {
129
+ private toKeysItem;
130
+ flush(): Promise<void>;
131
+ readonly _seq: ResolveSeq<Result<KeysByFingerprint>>;
132
+ _upsertNamedKey(ksi: KeysByFingerprint): Promise<Result<KeysByFingerprint>>;
133
+ private _namedKeyCache;
134
+ private _getNamedKey;
135
+ getNamedKey(name: string, failIfNotFound?: boolean, material?: string | Uint8Array): Promise<Result<KeysByFingerprint>>;
136
+ }
137
+ interface V1StorageKeyItem {
116
138
  readonly name: string;
117
139
  readonly key: string;
118
140
  }
119
- type KeyBagFile = Record<string, KeyItem>;
141
+ interface V2StorageKeyItem {
142
+ readonly key: string;
143
+ readonly fingerPrint: string;
144
+ readonly default: boolean;
145
+ }
146
+ interface KeysItem {
147
+ readonly name: string;
148
+ readonly keys: Record<string, V2StorageKeyItem>;
149
+ }
150
+ type KeyBagFile = Record<string, KeysItem>;
120
151
  interface KeyBagOpts {
121
152
  readonly url: CoerceURI;
122
153
  readonly crypto: CryptoRuntime;
@@ -124,8 +155,8 @@ interface KeyBagOpts {
124
155
  readonly keyRuntime: KeyBagRuntime;
125
156
  }
126
157
  interface KeyBagProvider {
127
- get(id: string): Promise<KeyItem | undefined>;
128
- set(id: string, item: KeyItem): Promise<void>;
158
+ get(id: string): Promise<V1StorageKeyItem | KeysItem | undefined>;
159
+ set(item: KeysItem): Promise<void>;
129
160
  }
130
161
  interface KeyBagRuntime {
131
162
  readonly url: URI;
@@ -155,13 +186,18 @@ type keyBag_KeyBagOpts = KeyBagOpts;
155
186
  type keyBag_KeyBagProvider = KeyBagProvider;
156
187
  type keyBag_KeyBagProviderFactoryItem = KeyBagProviderFactoryItem;
157
188
  type keyBag_KeyBagRuntime = KeyBagRuntime;
158
- type keyBag_KeyItem = KeyItem;
189
+ type keyBag_KeysItem = KeysItem;
190
+ type keyBag_V1StorageKeyItem = V1StorageKeyItem;
191
+ type keyBag_V2StorageKeyItem = V2StorageKeyItem;
159
192
  declare const keyBag_defaultKeyBagOpts: typeof defaultKeyBagOpts;
160
193
  declare const keyBag_defaultKeyBagUrl: typeof defaultKeyBagUrl;
161
194
  declare const keyBag_getKeyBag: typeof getKeyBag;
195
+ type keyBag_keysByFingerprint = keysByFingerprint;
196
+ declare const keyBag_keysByFingerprint: typeof keysByFingerprint;
162
197
  declare const keyBag_registerKeyBagProviderFactory: typeof registerKeyBagProviderFactory;
198
+ declare const keyBag_toKeyWithFingerPrint: typeof toKeyWithFingerPrint;
163
199
  declare namespace keyBag {
164
- export { type keyBag_KeyBackProviderFactory as KeyBackProviderFactory, keyBag_KeyBag as KeyBag, type keyBag_KeyBagFile as KeyBagFile, type keyBag_KeyBagOpts as KeyBagOpts, type keyBag_KeyBagProvider as KeyBagProvider, type keyBag_KeyBagProviderFactoryItem as KeyBagProviderFactoryItem, type keyBag_KeyBagRuntime as KeyBagRuntime, type keyBag_KeyItem as KeyItem, keyBag_defaultKeyBagOpts as defaultKeyBagOpts, keyBag_defaultKeyBagUrl as defaultKeyBagUrl, keyBag_getKeyBag as getKeyBag, keyBag_registerKeyBagProviderFactory as registerKeyBagProviderFactory };
200
+ export { type keyBag_KeyBackProviderFactory as KeyBackProviderFactory, keyBag_KeyBag as KeyBag, type keyBag_KeyBagFile as KeyBagFile, type keyBag_KeyBagOpts as KeyBagOpts, type keyBag_KeyBagProvider as KeyBagProvider, type keyBag_KeyBagProviderFactoryItem as KeyBagProviderFactoryItem, type keyBag_KeyBagRuntime as KeyBagRuntime, type keyBag_KeysItem as KeysItem, type keyBag_V1StorageKeyItem as V1StorageKeyItem, type keyBag_V2StorageKeyItem as V2StorageKeyItem, keyBag_defaultKeyBagOpts as defaultKeyBagOpts, keyBag_defaultKeyBagUrl as defaultKeyBagUrl, keyBag_getKeyBag as getKeyBag, keyBag_keysByFingerprint as keysByFingerprint, keyBag_registerKeyBagProviderFactory as registerKeyBagProviderFactory, keyBag_toKeyWithFingerPrint as toKeyWithFingerPrint };
165
201
  }
166
202
 
167
203
  declare class TaskManager {
@@ -199,30 +235,31 @@ declare function coerceIntoUint8(raw: ToUInt8): Result<Uint8Array>;
199
235
  declare function coercePromiseIntoUint8(raw: PromiseToUInt8): Promise<Result<Uint8Array>>;
200
236
  declare function makeName(fnString: string): string;
201
237
 
202
- declare enum FPEnvelopeType {
203
- CAR = "car",
204
- FILE = "file",
205
- META = "meta",
206
- WAL = "wal"
207
- }
238
+ declare const FPEnvelopeTypes: {
239
+ readonly CAR: "car";
240
+ readonly FILE: "file";
241
+ readonly META: "meta";
242
+ readonly WAL: "wal";
243
+ };
244
+ type FPEnvelopeType = (typeof FPEnvelopeTypes)[keyof typeof FPEnvelopeTypes];
208
245
  interface FPEnvelope<T> {
209
246
  readonly type: FPEnvelopeType;
210
247
  readonly payload: T;
211
248
  }
212
249
  interface FPEnvelopeCar extends FPEnvelope<Uint8Array> {
213
- readonly type: FPEnvelopeType.CAR;
250
+ readonly type: typeof FPEnvelopeTypes.CAR;
214
251
  }
215
252
  interface FPEnvelopeFile extends FPEnvelope<Uint8Array> {
216
- readonly type: FPEnvelopeType.FILE;
253
+ readonly type: typeof FPEnvelopeTypes.FILE;
217
254
  }
218
255
  interface FPEnvelopeMeta extends FPEnvelope<DbMetaEvent[]> {
219
- readonly type: FPEnvelopeType.META;
256
+ readonly type: typeof FPEnvelopeTypes.META;
220
257
  }
221
258
  interface FPWALCarsOps {
222
259
  readonly cars: CID[];
223
260
  }
224
261
  interface FPEnvelopeWAL extends FPEnvelope<WALState> {
225
- readonly type: FPEnvelopeType.WAL;
262
+ readonly type: typeof FPEnvelopeTypes.WAL;
226
263
  }
227
264
  declare function Car2FPMsg(fpcar: Uint8Array): Result<FPEnvelopeCar>;
228
265
  declare function File2FPMsg(fpfile: Uint8Array): Result<FPEnvelopeFile>;
@@ -375,12 +412,14 @@ interface IvKeyIdData {
375
412
  readonly keyId: Uint8Array;
376
413
  readonly data: Uint8Array;
377
414
  }
378
- interface IvAndBytes {
415
+ interface IvAndKeyAndBytes {
379
416
  readonly bytes: Uint8Array;
417
+ readonly key: CTCryptoKey;
380
418
  readonly iv: Uint8Array;
381
419
  }
382
- interface BytesWithIv {
420
+ interface BytesAndKeyWithIv {
383
421
  readonly bytes: Uint8Array;
422
+ readonly key: CTCryptoKey;
384
423
  readonly iv?: Uint8Array;
385
424
  }
386
425
  interface AnyDecodedBlock {
@@ -404,7 +443,7 @@ interface TransactionWrapper<M extends TransactionMeta> {
404
443
  }
405
444
  type TransactionMeta = unknown;
406
445
  interface EncryptedBlock {
407
- readonly value: IvAndBytes;
446
+ readonly value: IvAndKeyAndBytes;
408
447
  }
409
448
  interface KeyMaterial {
410
449
  readonly key: Uint8Array;
@@ -413,28 +452,36 @@ interface KeyMaterial {
413
452
  interface KeyWithFingerPrint {
414
453
  readonly fingerPrint: string;
415
454
  readonly key: CTCryptoKey;
416
- }
417
- interface KeyWithFingerExtract extends KeyWithFingerPrint {
418
455
  extract(): Promise<KeyMaterial>;
419
456
  }
420
457
  interface CodecOpts {
421
458
  readonly ivCalc: "random" | "hash";
422
459
  readonly noIVVerify: boolean;
423
460
  }
424
- interface KeyedCrypto {
461
+ interface KeyUpsertResult {
462
+ readonly modified: boolean;
463
+ readonly kfp: KeyWithFingerPrint;
464
+ }
465
+ interface KeysByFingerprint {
466
+ readonly name: string;
467
+ get(fingerPrint?: Uint8Array | string): Promise<KeyWithFingerPrint | undefined>;
468
+ upsert(key: string | Uint8Array, def: boolean): Promise<Result<KeyUpsertResult>>;
469
+ asKeysItem(): Promise<KeysItem>;
470
+ }
471
+ interface CryptoAction {
425
472
  readonly ivLength: number;
426
473
  readonly logger: Logger;
427
474
  readonly crypto: CryptoRuntime;
428
475
  readonly url: URI;
429
- fingerPrint(): Promise<string>;
476
+ readonly key: KeysByFingerprint;
430
477
  algo(iv?: Uint8Array): {
431
478
  name: string;
432
479
  iv: Uint8Array;
433
480
  tagLength: number;
434
481
  };
435
482
  codec(iv?: Uint8Array, codecOpts?: Partial<CodecOpts>): BlockCodec<number, Uint8Array>;
436
- _decrypt(data: IvAndBytes): Promise<Uint8Array>;
437
- _encrypt(data: BytesWithIv): Promise<Uint8Array>;
483
+ _decrypt(data: IvAndKeyAndBytes): Promise<Uint8Array>;
484
+ _encrypt(data: BytesAndKeyWithIv): Promise<Uint8Array>;
438
485
  }
439
486
  interface BlobLike {
440
487
  stream: () => ReadableStream;
@@ -516,7 +563,7 @@ interface BaseStore {
516
563
  url(): URI;
517
564
  onStarted(fn: () => void): void;
518
565
  onClosed(fn: () => void): void;
519
- keyedCrypto(): Promise<KeyedCrypto>;
566
+ keyedCrypto(): Promise<CryptoAction>;
520
567
  close(): Promise<Result<void>>;
521
568
  destroy(): Promise<Result<void>>;
522
569
  readonly ready?: () => Promise<void>;
@@ -788,7 +835,7 @@ type index$5_BlockFetcher = BlockFetcher;
788
835
  type index$5_BlockstoreOpts = BlockstoreOpts;
789
836
  type index$5_BlockstoreParams = BlockstoreParams;
790
837
  type index$5_BlockstoreRuntime = BlockstoreRuntime;
791
- type index$5_BytesWithIv = BytesWithIv;
838
+ type index$5_BytesAndKeyWithIv = BytesAndKeyWithIv;
792
839
  type index$5_CIDBlock = CIDBlock;
793
840
  declare const index$5_Car2FPMsg: typeof Car2FPMsg;
794
841
  type index$5_CarClockHead = CarClockHead;
@@ -809,6 +856,7 @@ declare const index$5_CompactionFetcher: typeof CompactionFetcher;
809
856
  type index$5_Connection = Connection;
810
857
  type index$5_ConnectionBase = ConnectionBase;
811
858
  declare const index$5_ConnectionBase: typeof ConnectionBase;
859
+ type index$5_CryptoAction = CryptoAction;
812
860
  type index$5_DataSaveOpts = DataSaveOpts;
813
861
  type index$5_DataStore = DataStore;
814
862
  type index$5_DbMeta = DbMeta;
@@ -825,7 +873,7 @@ type index$5_FPEnvelopeCar = FPEnvelopeCar;
825
873
  type index$5_FPEnvelopeFile = FPEnvelopeFile;
826
874
  type index$5_FPEnvelopeMeta = FPEnvelopeMeta;
827
875
  type index$5_FPEnvelopeType = FPEnvelopeType;
828
- declare const index$5_FPEnvelopeType: typeof FPEnvelopeType;
876
+ declare const index$5_FPEnvelopeTypes: typeof FPEnvelopeTypes;
829
877
  type index$5_FPEnvelopeWAL = FPEnvelopeWAL;
830
878
  type index$5_FPWALCarsOps = FPWALCarsOps;
831
879
  declare const index$5_File2FPMsg: typeof File2FPMsg;
@@ -834,12 +882,12 @@ type index$5_GatewayOpts = GatewayOpts;
834
882
  type index$5_GetResult = GetResult;
835
883
  type index$5_InterceptorGateway = InterceptorGateway;
836
884
  declare const index$5_InterceptorGateway: typeof InterceptorGateway;
837
- type index$5_IvAndBytes = IvAndBytes;
885
+ type index$5_IvAndKeyAndBytes = IvAndKeyAndBytes;
838
886
  type index$5_IvKeyIdData = IvKeyIdData;
839
887
  type index$5_KeyMaterial = KeyMaterial;
840
- type index$5_KeyWithFingerExtract = KeyWithFingerExtract;
888
+ type index$5_KeyUpsertResult = KeyUpsertResult;
841
889
  type index$5_KeyWithFingerPrint = KeyWithFingerPrint;
842
- type index$5_KeyedCrypto = KeyedCrypto;
890
+ type index$5_KeysByFingerprint = KeysByFingerprint;
843
891
  type index$5_LoadHandler = LoadHandler;
844
892
  type index$5_Loadable = Loadable;
845
893
  type index$5_Loader = Loader;
@@ -899,7 +947,7 @@ declare const index$5_registerStoreProtocol: typeof registerStoreProtocol;
899
947
  declare const index$5_toCIDBlock: typeof toCIDBlock;
900
948
  declare const index$5_toStoreRuntime: typeof toStoreRuntime;
901
949
  declare namespace index$5 {
902
- export { type index$5_AnyAnyBlock as AnyAnyBlock, type index$5_AnyAnyLink as AnyAnyLink, type index$5_AnyBlock as AnyBlock, type index$5_AnyDecodedBlock as AnyDecodedBlock, type index$5_AnyLink as AnyLink, type index$5_AnyLinkFn as AnyLinkFn, index$5_BaseBlockstoreImpl as BaseBlockstoreImpl, type index$5_BaseStore as BaseStore, type index$5_BlobLike as BlobLike, type index$5_BlockFetcher as BlockFetcher, type index$5_BlockstoreOpts as BlockstoreOpts, type index$5_BlockstoreParams as BlockstoreParams, type index$5_BlockstoreRuntime as BlockstoreRuntime, type index$5_BytesWithIv as BytesWithIv, type index$5_CIDBlock as CIDBlock, index$5_Car2FPMsg as Car2FPMsg, type index$5_CarClockHead as CarClockHead, type index$5_CarClockLink as CarClockLink, type index$5_CarGroup as CarGroup, type index$5_CarHeader as CarHeader, type index$5_CarLog as CarLog, type index$5_CarMakeable as CarMakeable, index$5_CarTransactionImpl as CarTransactionImpl, type index$5_CarTransactionOpts as CarTransactionOpts, type index$5_CodecOpts as CodecOpts, type index$5_CommitOpts as CommitOpts, type index$5_CompactFetcher as CompactFetcher, type index$5_CompactFn as CompactFn, index$5_CompactionFetcher as CompactionFetcher, type index$5_Connection as Connection, index$5_ConnectionBase as ConnectionBase, type index$5_DataSaveOpts as DataSaveOpts, type index$5_DataStore as DataStore, type index$5_DbMeta as DbMeta, type index$5_DbMetaBinary as DbMetaBinary, type index$5_DbMetaEvent as DbMetaEvent, type index$5_DbMetaEventBlock as DbMetaEventBlock, index$5_DbMetaEventEqual as DbMetaEventEqual, index$5_DbMetaEventsEqual as DbMetaEventsEqual, type index$5_EncryptedBlock as EncryptedBlock, index$5_EncryptedBlockstore as EncryptedBlockstore, type index$5_FPEnvelope as FPEnvelope, type index$5_FPEnvelopeCar as FPEnvelopeCar, type index$5_FPEnvelopeFile as FPEnvelopeFile, type index$5_FPEnvelopeMeta as FPEnvelopeMeta, index$5_FPEnvelopeType as FPEnvelopeType, type index$5_FPEnvelopeWAL as FPEnvelopeWAL, type index$5_FPWALCarsOps as FPWALCarsOps, index$5_File2FPMsg as File2FPMsg, type index$5_Gateway as Gateway, type index$5_GatewayOpts as GatewayOpts, type index$5_GetResult as GetResult, index$5_InterceptorGateway as InterceptorGateway, type index$5_IvAndBytes as IvAndBytes, type index$5_IvKeyIdData as IvKeyIdData, type index$5_KeyMaterial as KeyMaterial, type index$5_KeyWithFingerExtract as KeyWithFingerExtract, type index$5_KeyWithFingerPrint as KeyWithFingerPrint, type index$5_KeyedCrypto as KeyedCrypto, type index$5_LoadHandler as LoadHandler, type index$5_Loadable as Loadable, index$5_Loader as Loader, type index$5_MetaStore as MetaStore, index$5_PassThroughGateway as PassThroughGateway, type index$5_RefBlockstore as RefBlockstore, type index$5_RefLoadable as RefLoadable, type index$5_SerdeGateway as SerdeGateway, type index$5_SerdeGatewayBuildUrlOp as SerdeGatewayBuildUrlOp, type index$5_SerdeGatewayBuildUrlReturn as SerdeGatewayBuildUrlReturn, type index$5_SerdeGatewayCloseOp as SerdeGatewayCloseOp, type index$5_SerdeGatewayCloseReturn as SerdeGatewayCloseReturn, type index$5_SerdeGatewayCtx as SerdeGatewayCtx, type index$5_SerdeGatewayDeleteOp as SerdeGatewayDeleteOp, type index$5_SerdeGatewayDeleteReturn as SerdeGatewayDeleteReturn, type index$5_SerdeGatewayDestroyOp as SerdeGatewayDestroyOp, type index$5_SerdeGatewayDestroyReturn as SerdeGatewayDestroyReturn, type index$5_SerdeGatewayFactoryItem as SerdeGatewayFactoryItem, type index$5_SerdeGatewayGetOp as SerdeGatewayGetOp, type index$5_SerdeGatewayGetReturn as SerdeGatewayGetReturn, type index$5_SerdeGatewayInterceptor as SerdeGatewayInterceptor, type index$5_SerdeGatewayOpts as SerdeGatewayOpts, type index$5_SerdeGatewayPutOp as SerdeGatewayPutOp, type index$5_SerdeGatewayPutReturn as SerdeGatewayPutReturn, type index$5_SerdeGatewayReturn as SerdeGatewayReturn, type index$5_SerdeGatewayStartOp as SerdeGatewayStartOp, type index$5_SerdeGatewayStartReturn as SerdeGatewayStartReturn, type index$5_SerdeGatewaySubscribeOp as SerdeGatewaySubscribeOp, type index$5_SerdeGatewaySubscribeReturn as SerdeGatewaySubscribeReturn, type index$5_SerdeGetResult as SerdeGetResult, type index$5_SerdeOrGatewayFactoryItem as SerdeOrGatewayFactoryItem, type index$5_StoreEnDeFile as StoreEnDeFile, type index$5_StoreFactory as StoreFactory, type index$5_StoreFactoryItem as StoreFactoryItem, type index$5_StoreRuntime as StoreRuntime, type index$5_StoreRuntimeUrls as StoreRuntimeUrls, type index$5_StoreURIRuntime as StoreURIRuntime, type index$5_StoreURIs as StoreURIs, type index$5_StoreUrls as StoreUrls, type index$5_StoreUrlsOpts as StoreUrlsOpts, type index$5_TransactionMeta as TransactionMeta, type index$5_TransactionWrapper as TransactionWrapper, type index$5_UnsubscribeResult as UnsubscribeResult, type index$5_VoidResult as VoidResult, type index$5_WALState as WALState, type index$5_WALStore as WALStore, index$5_createDbMetaEvent as createDbMetaEvent, index$5_defaultGatewayFactoryItem as defaultGatewayFactoryItem, index$5_ensureStoreEnDeFile as ensureStoreEnDeFile, index$5_getDefaultURI as getDefaultURI, index$5_getGatewayFactoryItem as getGatewayFactoryItem, index$5_getStartedGateway as getStartedGateway, index$5_parseCarFile as parseCarFile, index$5_registerStoreProtocol as registerStoreProtocol, index$5_toCIDBlock as toCIDBlock, index$5_toStoreRuntime as toStoreRuntime };
950
+ export { type index$5_AnyAnyBlock as AnyAnyBlock, type index$5_AnyAnyLink as AnyAnyLink, type index$5_AnyBlock as AnyBlock, type index$5_AnyDecodedBlock as AnyDecodedBlock, type index$5_AnyLink as AnyLink, type index$5_AnyLinkFn as AnyLinkFn, index$5_BaseBlockstoreImpl as BaseBlockstoreImpl, type index$5_BaseStore as BaseStore, type index$5_BlobLike as BlobLike, type index$5_BlockFetcher as BlockFetcher, type index$5_BlockstoreOpts as BlockstoreOpts, type index$5_BlockstoreParams as BlockstoreParams, type index$5_BlockstoreRuntime as BlockstoreRuntime, type index$5_BytesAndKeyWithIv as BytesAndKeyWithIv, type index$5_CIDBlock as CIDBlock, index$5_Car2FPMsg as Car2FPMsg, type index$5_CarClockHead as CarClockHead, type index$5_CarClockLink as CarClockLink, type index$5_CarGroup as CarGroup, type index$5_CarHeader as CarHeader, type index$5_CarLog as CarLog, type index$5_CarMakeable as CarMakeable, index$5_CarTransactionImpl as CarTransactionImpl, type index$5_CarTransactionOpts as CarTransactionOpts, type index$5_CodecOpts as CodecOpts, type index$5_CommitOpts as CommitOpts, type index$5_CompactFetcher as CompactFetcher, type index$5_CompactFn as CompactFn, index$5_CompactionFetcher as CompactionFetcher, type index$5_Connection as Connection, index$5_ConnectionBase as ConnectionBase, type index$5_CryptoAction as CryptoAction, type index$5_DataSaveOpts as DataSaveOpts, type index$5_DataStore as DataStore, type index$5_DbMeta as DbMeta, type index$5_DbMetaBinary as DbMetaBinary, type index$5_DbMetaEvent as DbMetaEvent, type index$5_DbMetaEventBlock as DbMetaEventBlock, index$5_DbMetaEventEqual as DbMetaEventEqual, index$5_DbMetaEventsEqual as DbMetaEventsEqual, type index$5_EncryptedBlock as EncryptedBlock, index$5_EncryptedBlockstore as EncryptedBlockstore, type index$5_FPEnvelope as FPEnvelope, type index$5_FPEnvelopeCar as FPEnvelopeCar, type index$5_FPEnvelopeFile as FPEnvelopeFile, type index$5_FPEnvelopeMeta as FPEnvelopeMeta, type index$5_FPEnvelopeType as FPEnvelopeType, index$5_FPEnvelopeTypes as FPEnvelopeTypes, type index$5_FPEnvelopeWAL as FPEnvelopeWAL, type index$5_FPWALCarsOps as FPWALCarsOps, index$5_File2FPMsg as File2FPMsg, type index$5_Gateway as Gateway, type index$5_GatewayOpts as GatewayOpts, type index$5_GetResult as GetResult, index$5_InterceptorGateway as InterceptorGateway, type index$5_IvAndKeyAndBytes as IvAndKeyAndBytes, type index$5_IvKeyIdData as IvKeyIdData, type index$5_KeyMaterial as KeyMaterial, type index$5_KeyUpsertResult as KeyUpsertResult, type index$5_KeyWithFingerPrint as KeyWithFingerPrint, type index$5_KeysByFingerprint as KeysByFingerprint, type index$5_LoadHandler as LoadHandler, type index$5_Loadable as Loadable, index$5_Loader as Loader, type index$5_MetaStore as MetaStore, index$5_PassThroughGateway as PassThroughGateway, type index$5_RefBlockstore as RefBlockstore, type index$5_RefLoadable as RefLoadable, type index$5_SerdeGateway as SerdeGateway, type index$5_SerdeGatewayBuildUrlOp as SerdeGatewayBuildUrlOp, type index$5_SerdeGatewayBuildUrlReturn as SerdeGatewayBuildUrlReturn, type index$5_SerdeGatewayCloseOp as SerdeGatewayCloseOp, type index$5_SerdeGatewayCloseReturn as SerdeGatewayCloseReturn, type index$5_SerdeGatewayCtx as SerdeGatewayCtx, type index$5_SerdeGatewayDeleteOp as SerdeGatewayDeleteOp, type index$5_SerdeGatewayDeleteReturn as SerdeGatewayDeleteReturn, type index$5_SerdeGatewayDestroyOp as SerdeGatewayDestroyOp, type index$5_SerdeGatewayDestroyReturn as SerdeGatewayDestroyReturn, type index$5_SerdeGatewayFactoryItem as SerdeGatewayFactoryItem, type index$5_SerdeGatewayGetOp as SerdeGatewayGetOp, type index$5_SerdeGatewayGetReturn as SerdeGatewayGetReturn, type index$5_SerdeGatewayInterceptor as SerdeGatewayInterceptor, type index$5_SerdeGatewayOpts as SerdeGatewayOpts, type index$5_SerdeGatewayPutOp as SerdeGatewayPutOp, type index$5_SerdeGatewayPutReturn as SerdeGatewayPutReturn, type index$5_SerdeGatewayReturn as SerdeGatewayReturn, type index$5_SerdeGatewayStartOp as SerdeGatewayStartOp, type index$5_SerdeGatewayStartReturn as SerdeGatewayStartReturn, type index$5_SerdeGatewaySubscribeOp as SerdeGatewaySubscribeOp, type index$5_SerdeGatewaySubscribeReturn as SerdeGatewaySubscribeReturn, type index$5_SerdeGetResult as SerdeGetResult, type index$5_SerdeOrGatewayFactoryItem as SerdeOrGatewayFactoryItem, type index$5_StoreEnDeFile as StoreEnDeFile, type index$5_StoreFactory as StoreFactory, type index$5_StoreFactoryItem as StoreFactoryItem, type index$5_StoreRuntime as StoreRuntime, type index$5_StoreRuntimeUrls as StoreRuntimeUrls, type index$5_StoreURIRuntime as StoreURIRuntime, type index$5_StoreURIs as StoreURIs, type index$5_StoreUrls as StoreUrls, type index$5_StoreUrlsOpts as StoreUrlsOpts, type index$5_TransactionMeta as TransactionMeta, type index$5_TransactionWrapper as TransactionWrapper, type index$5_UnsubscribeResult as UnsubscribeResult, type index$5_VoidResult as VoidResult, type index$5_WALState as WALState, type index$5_WALStore as WALStore, index$5_createDbMetaEvent as createDbMetaEvent, index$5_defaultGatewayFactoryItem as defaultGatewayFactoryItem, index$5_ensureStoreEnDeFile as ensureStoreEnDeFile, index$5_getDefaultURI as getDefaultURI, index$5_getGatewayFactoryItem as getGatewayFactoryItem, index$5_getStartedGateway as getStartedGateway, index$5_parseCarFile as parseCarFile, index$5_registerStoreProtocol as registerStoreProtocol, index$5_toCIDBlock as toCIDBlock, index$5_toStoreRuntime as toStoreRuntime };
903
951
  }
904
952
 
905
953
  interface WriteQueueParams {
@@ -965,25 +1013,27 @@ declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFra
965
1013
 
966
1014
  type Falsy = false | null | undefined;
967
1015
  declare function isFalsy(value: unknown): value is Falsy;
968
- declare enum PARAM {
969
- SUFFIX = "suffix",
970
- URL_GEN = "urlGen",
971
- STORE_KEY = "storekey",
972
- STORE = "store",
973
- KEY = "key",
974
- INDEX = "index",
975
- NAME = "name",
976
- VERSION = "version",
977
- RUNTIME = "runtime",
978
- FRAG_SIZE = "fragSize",
979
- IV_VERIFY = "ivVerify",
980
- IV_HASH = "ivHash",
981
- FRAG_FID = "fid",
982
- FRAG_OFS = "ofs",
983
- FRAG_LEN = "len",
984
- FRAG_HEAD = "headerSize",
985
- EXTRACTKEY = "extractKey"
986
- }
1016
+ declare const PARAM: {
1017
+ SUFFIX: string;
1018
+ URL_GEN: string;
1019
+ STORE_KEY: string;
1020
+ STORE: string;
1021
+ KEY: string;
1022
+ INDEX: string;
1023
+ NAME: string;
1024
+ VERSION: string;
1025
+ RUNTIME: string;
1026
+ FRAG_SIZE: string;
1027
+ IV_VERIFY: string;
1028
+ IV_HASH: string;
1029
+ FRAG_FID: string;
1030
+ FRAG_OFS: string;
1031
+ FRAG_LEN: string;
1032
+ FRAG_HEAD: string;
1033
+ EXTRACTKEY: string;
1034
+ SELF_REFLECT: string;
1035
+ };
1036
+ type PARAMS = (typeof PARAM)[keyof typeof PARAM];
987
1037
  declare function throwFalsy<T>(value: T | Falsy): T;
988
1038
  declare function falsyToUndef<T>(value: T | Falsy): T | undefined;
989
1039
  type StoreType = "data" | "wal" | "meta";
@@ -1458,14 +1508,14 @@ declare namespace files {
1458
1508
  declare class BlockIvKeyIdCodec implements BlockCodec<0x300539, Uint8Array> {
1459
1509
  readonly code = 3147065;
1460
1510
  readonly name = "Fireproof@encrypted-block:aes-gcm";
1461
- readonly ko: KeyedCrypto;
1511
+ readonly ko: CryptoAction;
1462
1512
  readonly iv?: Uint8Array;
1463
1513
  readonly opts: Partial<CodecOpts>;
1464
- constructor(ko: KeyedCrypto, iv?: Uint8Array, opts?: CodecOpts);
1514
+ constructor(ko: CryptoAction, iv?: Uint8Array, opts?: CodecOpts);
1465
1515
  encode(data: Uint8Array): Promise<Uint8Array>;
1466
1516
  decode(abytes: Uint8Array | ArrayBuffer): Promise<Uint8Array>;
1467
1517
  }
1468
- declare function keyedCryptoFactory(url: URI, kb: KeyBag, sthis: SuperThis): Promise<KeyedCrypto>;
1518
+ declare function keyedCryptoFactory(url: URI, kb: KeyBag, sthis: SuperThis): Promise<CryptoAction>;
1469
1519
 
1470
1520
  type keyedCrypto_BlockIvKeyIdCodec = BlockIvKeyIdCodec;
1471
1521
  declare const keyedCrypto_BlockIvKeyIdCodec: typeof BlockIvKeyIdCodec;
@@ -1532,8 +1582,8 @@ declare class KeyBagProviderFile implements KeyBagProvider {
1532
1582
  readonly logger: Logger;
1533
1583
  readonly sthis: SuperThis;
1534
1584
  constructor(url: URI, sthis: SuperThis);
1535
- get(id: string): Promise<KeyItem | undefined>;
1536
- set(id: string, item: KeyItem): Promise<void>;
1585
+ get(id: string): Promise<V1StorageKeyItem | KeysItem | undefined>;
1586
+ set(item: KeysItem): Promise<void>;
1537
1587
  }
1538
1588
 
1539
1589
  declare function sysFileSystemFactory(uri: URI): Promise<SysFileSystem>;
@@ -1616,20 +1666,25 @@ type index_KeyBagOpts = KeyBagOpts;
1616
1666
  type index_KeyBagProvider = KeyBagProvider;
1617
1667
  type index_KeyBagProviderFactoryItem = KeyBagProviderFactoryItem;
1618
1668
  type index_KeyBagRuntime = KeyBagRuntime;
1619
- type index_KeyItem = KeyItem;
1669
+ type index_KeysItem = KeysItem;
1670
+ type index_V1StorageKeyItem = V1StorageKeyItem;
1671
+ type index_V2StorageKeyItem = V2StorageKeyItem;
1620
1672
  declare const index_defaultKeyBagOpts: typeof defaultKeyBagOpts;
1621
1673
  declare const index_defaultKeyBagUrl: typeof defaultKeyBagUrl;
1622
1674
  declare const index_files: typeof files;
1623
1675
  declare const index_getFileName: typeof getFileName;
1624
1676
  declare const index_getKeyBag: typeof getKeyBag;
1625
1677
  declare const index_getPath: typeof getPath;
1678
+ type index_keysByFingerprint = keysByFingerprint;
1679
+ declare const index_keysByFingerprint: typeof keysByFingerprint;
1626
1680
  declare const index_registerKeyBagProviderFactory: typeof registerKeyBagProviderFactory;
1627
1681
  declare const index_runtimeFn: typeof runtimeFn;
1682
+ declare const index_toKeyWithFingerPrint: typeof toKeyWithFingerPrint;
1628
1683
  declare namespace index {
1629
- export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXEDDB_VERSION as INDEXEDDB_VERSION, type index_KeyBackProviderFactory as KeyBackProviderFactory, index_KeyBag as KeyBag, type index_KeyBagFile as KeyBagFile, type index_KeyBagOpts as KeyBagOpts, type index_KeyBagProvider as KeyBagProvider, type index_KeyBagProviderFactoryItem as KeyBagProviderFactoryItem, type index_KeyBagRuntime as KeyBagRuntime, type index_KeyItem as KeyItem, index_defaultKeyBagOpts as defaultKeyBagOpts, index_defaultKeyBagUrl as defaultKeyBagUrl, index_files as files, index_getFileName as getFileName, index_getKeyBag as getKeyBag, index_getPath as getPath, index$1 as gw, keyBag as kb, keyedCrypto as kc, index$3 as mf, index_registerKeyBagProviderFactory as registerKeyBagProviderFactory, index_runtimeFn as runtimeFn };
1684
+ export { index_FILESTORE_VERSION as FILESTORE_VERSION, index_INDEXEDDB_VERSION as INDEXEDDB_VERSION, type index_KeyBackProviderFactory as KeyBackProviderFactory, index_KeyBag as KeyBag, type index_KeyBagFile as KeyBagFile, type index_KeyBagOpts as KeyBagOpts, type index_KeyBagProvider as KeyBagProvider, type index_KeyBagProviderFactoryItem as KeyBagProviderFactoryItem, type index_KeyBagRuntime as KeyBagRuntime, type index_KeysItem as KeysItem, type index_V1StorageKeyItem as V1StorageKeyItem, type index_V2StorageKeyItem as V2StorageKeyItem, index_defaultKeyBagOpts as defaultKeyBagOpts, index_defaultKeyBagUrl as defaultKeyBagUrl, index_files as files, index_getFileName as getFileName, index_getKeyBag as getKeyBag, index_getPath as getPath, index$1 as gw, keyBag as kb, keyedCrypto as kc, index_keysByFingerprint as keysByFingerprint, index$3 as mf, index_registerKeyBagProviderFactory as registerKeyBagProviderFactory, index_runtimeFn as runtimeFn, index_toKeyWithFingerPrint as toKeyWithFingerPrint };
1630
1685
  }
1631
1686
 
1632
1687
  declare const PACKAGE_VERSION: string;
1633
1688
 
1634
- export { type AllDocsQueryOpts, type AllDocsResponse, type BaseBlockstore, type BulkResponse, type CRDT, type CRDTClock, type CRDTEntry, CRDTImpl, type CRDTMeta, type CarTransaction, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, type Database, DatabaseImpl, type DbMeta, type DocBase, type DocFileMeta, type DocFiles, type DocFragment, type DocLiteral, type DocObject, type DocRecord, type DocResponse, type DocSet, type DocTypes, type DocUpdate, type DocValue, type DocWithId, type FPStats, type Falsy, type FileTransactionMeta, type HasCRDT, type HasLogger, type HasSuperThis, type IdxMeta, type IdxMetaMap, Index, type IndexKey, type IndexKeyType, type IndexRow, type IndexRows, type IndexTransactionMeta, type IndexUpdate, type IndexUpdateString, type Joiner, type KeyLiteral, type Ledger, LedgerFactory, type LedgerOpts, LedgerShell, type ListenerFn, type MapFn, type MetaType, type NoUpdateListenerFn, NotFoundError, PACKAGE_VERSION, PARAM, type PathOps, type PromiseToUInt8, type QueryOpts, type ReadyCloseDestroy, type RefLedger, type Store, type StoreType, type SuperThis, type SuperThisOpts, type SysFileSystem, type TextEndeCoder, type ToUInt8, UInt8ArrayEqual, type UnReg, type UnknownDoc, type UpdateListenerFn, type VoidFn, type WriteQueue, index$5 as blockstore, index$5 as bs, coerceIntoUint8, coercePromiseIntoUint8, defaultWriteQueueOpts, ensureLogger, ensureSuperLog, ensureSuperThis, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$4 as index, inplaceFilter, isDatabase, isFalsy, isLedger, isNotFoundError, keyConfigOpts, makeName, onSuperThis, index as rt, index as runtime, throwFalsy, toSortedArray, toStoreURIRuntime };
1689
+ export { type AllDocsQueryOpts, type AllDocsResponse, type BaseBlockstore, type BulkResponse, type CRDT, type CRDTClock, type CRDTEntry, CRDTImpl, type CRDTMeta, type CarTransaction, type ChangesOptions, type ChangesResponse, type ChangesResponseRow, type ClockHead, type ClockLink, type ConfigOpts, type Database, DatabaseImpl, type DbMeta, type DocBase, type DocFileMeta, type DocFiles, type DocFragment, type DocLiteral, type DocObject, type DocRecord, type DocResponse, type DocSet, type DocTypes, type DocUpdate, type DocValue, type DocWithId, type FPStats, type Falsy, type FileTransactionMeta, type HasCRDT, type HasLogger, type HasSuperThis, type IdxMeta, type IdxMetaMap, Index, type IndexKey, type IndexKeyType, type IndexRow, type IndexRows, type IndexTransactionMeta, type IndexUpdate, type IndexUpdateString, type Joiner, type KeyLiteral, type Ledger, LedgerFactory, type LedgerOpts, LedgerShell, type ListenerFn, type MapFn, type MetaType, type NoUpdateListenerFn, NotFoundError, PACKAGE_VERSION, PARAM, type PARAMS, type PathOps, type PromiseToUInt8, type QueryOpts, type ReadyCloseDestroy, type RefLedger, type Store, type StoreType, type SuperThis, type SuperThisOpts, type SysFileSystem, type TextEndeCoder, type ToUInt8, UInt8ArrayEqual, type UnReg, type UnknownDoc, type UpdateListenerFn, type VoidFn, type WriteQueue, index$5 as blockstore, index$5 as bs, coerceIntoUint8, coercePromiseIntoUint8, defaultWriteQueueOpts, ensureLogger, ensureSuperLog, ensureSuperThis, exceptionWrapper, falsyToUndef, fireproof, getKey, getName, getStore, index$4 as index, inplaceFilter, isDatabase, isFalsy, isLedger, isNotFoundError, keyConfigOpts, makeName, onSuperThis, index as rt, index as runtime, throwFalsy, toSortedArray, toStoreURIRuntime };
1635
1690
  declare module '@fireproof/core'