@fireproof/core 0.20.0-dev-preview-24 → 0.20.0-dev-preview-26

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,57 @@ 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
+ readonly id: string;
117
+ static from(keyBag: KeyBag, named: KeysItem): Promise<KeysByFingerprint>;
118
+ constructor(keyBag: KeyBag, name: string);
119
+ get(fingerPrint?: Uint8Array | string): Promise<KeyWithFingerPrint | undefined>;
120
+ upsert(materialStrOrUint8: string | Uint8Array, def?: boolean, keyBagAction?: boolean): Promise<Result<KeyUpsertResult>>;
121
+ asKeysItem(): Promise<KeysItem>;
122
+ }
101
123
  declare class KeyBag {
102
- readonly rt: KeyBagRuntime;
103
124
  readonly logger: Logger;
125
+ readonly rt: KeyBagRuntime;
104
126
  constructor(rt: KeyBagRuntime);
105
127
  readonly _warnOnce: ResolveOnce<void>;
106
- subtleKey(key: string): Promise<CryptoKey>;
128
+ subtleKey(materialStrOrUint8: string | Uint8Array): Promise<CryptoKey>;
107
129
  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 {
130
+ private toKeysItem;
131
+ flush(): Promise<void>;
132
+ readonly _seq: ResolveSeq<Result<KeysByFingerprint>>;
133
+ _upsertNamedKey(ksi: KeysByFingerprint): Promise<Result<KeysByFingerprint>>;
134
+ private _namedKeyCache;
135
+ private _getNamedKey;
136
+ getNamedKey(name: string, failIfNotFound?: boolean, material?: string | Uint8Array): Promise<Result<KeysByFingerprint>>;
137
+ }
138
+ interface V1StorageKeyItem {
116
139
  readonly name: string;
117
140
  readonly key: string;
118
141
  }
119
- type KeyBagFile = Record<string, KeyItem>;
142
+ interface V2StorageKeyItem {
143
+ readonly key: string;
144
+ readonly fingerPrint: string;
145
+ readonly default: boolean;
146
+ }
147
+ interface KeysItem {
148
+ readonly name: string;
149
+ readonly keys: Record<string, V2StorageKeyItem>;
150
+ }
151
+ type KeyBagFile = Record<string, KeysItem>;
120
152
  interface KeyBagOpts {
121
153
  readonly url: CoerceURI;
122
154
  readonly crypto: CryptoRuntime;
@@ -124,8 +156,8 @@ interface KeyBagOpts {
124
156
  readonly keyRuntime: KeyBagRuntime;
125
157
  }
126
158
  interface KeyBagProvider {
127
- get(id: string): Promise<KeyItem | undefined>;
128
- set(id: string, item: KeyItem): Promise<void>;
159
+ get(id: string): Promise<V1StorageKeyItem | KeysItem | undefined>;
160
+ set(item: KeysItem): Promise<void>;
129
161
  }
130
162
  interface KeyBagRuntime {
131
163
  readonly url: URI;
@@ -155,13 +187,18 @@ type keyBag_KeyBagOpts = KeyBagOpts;
155
187
  type keyBag_KeyBagProvider = KeyBagProvider;
156
188
  type keyBag_KeyBagProviderFactoryItem = KeyBagProviderFactoryItem;
157
189
  type keyBag_KeyBagRuntime = KeyBagRuntime;
158
- type keyBag_KeyItem = KeyItem;
190
+ type keyBag_KeysItem = KeysItem;
191
+ type keyBag_V1StorageKeyItem = V1StorageKeyItem;
192
+ type keyBag_V2StorageKeyItem = V2StorageKeyItem;
159
193
  declare const keyBag_defaultKeyBagOpts: typeof defaultKeyBagOpts;
160
194
  declare const keyBag_defaultKeyBagUrl: typeof defaultKeyBagUrl;
161
195
  declare const keyBag_getKeyBag: typeof getKeyBag;
196
+ type keyBag_keysByFingerprint = keysByFingerprint;
197
+ declare const keyBag_keysByFingerprint: typeof keysByFingerprint;
162
198
  declare const keyBag_registerKeyBagProviderFactory: typeof registerKeyBagProviderFactory;
199
+ declare const keyBag_toKeyWithFingerPrint: typeof toKeyWithFingerPrint;
163
200
  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 };
201
+ 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
202
  }
166
203
 
167
204
  declare class TaskManager {
@@ -199,30 +236,31 @@ declare function coerceIntoUint8(raw: ToUInt8): Result<Uint8Array>;
199
236
  declare function coercePromiseIntoUint8(raw: PromiseToUInt8): Promise<Result<Uint8Array>>;
200
237
  declare function makeName(fnString: string): string;
201
238
 
202
- declare enum FPEnvelopeType {
203
- CAR = "car",
204
- FILE = "file",
205
- META = "meta",
206
- WAL = "wal"
207
- }
239
+ declare const FPEnvelopeTypes: {
240
+ readonly CAR: "car";
241
+ readonly FILE: "file";
242
+ readonly META: "meta";
243
+ readonly WAL: "wal";
244
+ };
245
+ type FPEnvelopeType = (typeof FPEnvelopeTypes)[keyof typeof FPEnvelopeTypes];
208
246
  interface FPEnvelope<T> {
209
247
  readonly type: FPEnvelopeType;
210
248
  readonly payload: T;
211
249
  }
212
250
  interface FPEnvelopeCar extends FPEnvelope<Uint8Array> {
213
- readonly type: FPEnvelopeType.CAR;
251
+ readonly type: typeof FPEnvelopeTypes.CAR;
214
252
  }
215
253
  interface FPEnvelopeFile extends FPEnvelope<Uint8Array> {
216
- readonly type: FPEnvelopeType.FILE;
254
+ readonly type: typeof FPEnvelopeTypes.FILE;
217
255
  }
218
256
  interface FPEnvelopeMeta extends FPEnvelope<DbMetaEvent[]> {
219
- readonly type: FPEnvelopeType.META;
257
+ readonly type: typeof FPEnvelopeTypes.META;
220
258
  }
221
259
  interface FPWALCarsOps {
222
260
  readonly cars: CID[];
223
261
  }
224
262
  interface FPEnvelopeWAL extends FPEnvelope<WALState> {
225
- readonly type: FPEnvelopeType.WAL;
263
+ readonly type: typeof FPEnvelopeTypes.WAL;
226
264
  }
227
265
  declare function Car2FPMsg(fpcar: Uint8Array): Result<FPEnvelopeCar>;
228
266
  declare function File2FPMsg(fpfile: Uint8Array): Result<FPEnvelopeFile>;
@@ -375,12 +413,14 @@ interface IvKeyIdData {
375
413
  readonly keyId: Uint8Array;
376
414
  readonly data: Uint8Array;
377
415
  }
378
- interface IvAndBytes {
416
+ interface IvAndKeyAndBytes {
379
417
  readonly bytes: Uint8Array;
418
+ readonly key: CTCryptoKey;
380
419
  readonly iv: Uint8Array;
381
420
  }
382
- interface BytesWithIv {
421
+ interface BytesAndKeyWithIv {
383
422
  readonly bytes: Uint8Array;
423
+ readonly key: CTCryptoKey;
384
424
  readonly iv?: Uint8Array;
385
425
  }
386
426
  interface AnyDecodedBlock {
@@ -404,7 +444,7 @@ interface TransactionWrapper<M extends TransactionMeta> {
404
444
  }
405
445
  type TransactionMeta = unknown;
406
446
  interface EncryptedBlock {
407
- readonly value: IvAndBytes;
447
+ readonly value: IvAndKeyAndBytes;
408
448
  }
409
449
  interface KeyMaterial {
410
450
  readonly key: Uint8Array;
@@ -413,28 +453,37 @@ interface KeyMaterial {
413
453
  interface KeyWithFingerPrint {
414
454
  readonly fingerPrint: string;
415
455
  readonly key: CTCryptoKey;
416
- }
417
- interface KeyWithFingerExtract extends KeyWithFingerPrint {
418
456
  extract(): Promise<KeyMaterial>;
419
457
  }
420
458
  interface CodecOpts {
421
459
  readonly ivCalc: "random" | "hash";
422
460
  readonly noIVVerify: boolean;
423
461
  }
424
- interface KeyedCrypto {
462
+ interface KeyUpsertResult {
463
+ readonly modified: boolean;
464
+ readonly kfp: KeyWithFingerPrint;
465
+ }
466
+ interface KeysByFingerprint {
467
+ readonly id: string;
468
+ readonly name: string;
469
+ get(fingerPrint?: Uint8Array | string): Promise<KeyWithFingerPrint | undefined>;
470
+ upsert(key: string | Uint8Array, def?: boolean): Promise<Result<KeyUpsertResult>>;
471
+ asKeysItem(): Promise<KeysItem>;
472
+ }
473
+ interface CryptoAction {
425
474
  readonly ivLength: number;
426
475
  readonly logger: Logger;
427
476
  readonly crypto: CryptoRuntime;
428
477
  readonly url: URI;
429
- fingerPrint(): Promise<string>;
478
+ readonly key: KeysByFingerprint;
430
479
  algo(iv?: Uint8Array): {
431
480
  name: string;
432
481
  iv: Uint8Array;
433
482
  tagLength: number;
434
483
  };
435
484
  codec(iv?: Uint8Array, codecOpts?: Partial<CodecOpts>): BlockCodec<number, Uint8Array>;
436
- _decrypt(data: IvAndBytes): Promise<Uint8Array>;
437
- _encrypt(data: BytesWithIv): Promise<Uint8Array>;
485
+ _decrypt(data: IvAndKeyAndBytes): Promise<Uint8Array>;
486
+ _encrypt(data: BytesAndKeyWithIv): Promise<Uint8Array>;
438
487
  }
439
488
  interface BlobLike {
440
489
  stream: () => ReadableStream;
@@ -516,7 +565,7 @@ interface BaseStore {
516
565
  url(): URI;
517
566
  onStarted(fn: () => void): void;
518
567
  onClosed(fn: () => void): void;
519
- keyedCrypto(): Promise<KeyedCrypto>;
568
+ keyedCrypto(): Promise<CryptoAction>;
520
569
  close(): Promise<Result<void>>;
521
570
  destroy(): Promise<Result<void>>;
522
571
  readonly ready?: () => Promise<void>;
@@ -788,7 +837,7 @@ type index$5_BlockFetcher = BlockFetcher;
788
837
  type index$5_BlockstoreOpts = BlockstoreOpts;
789
838
  type index$5_BlockstoreParams = BlockstoreParams;
790
839
  type index$5_BlockstoreRuntime = BlockstoreRuntime;
791
- type index$5_BytesWithIv = BytesWithIv;
840
+ type index$5_BytesAndKeyWithIv = BytesAndKeyWithIv;
792
841
  type index$5_CIDBlock = CIDBlock;
793
842
  declare const index$5_Car2FPMsg: typeof Car2FPMsg;
794
843
  type index$5_CarClockHead = CarClockHead;
@@ -809,6 +858,7 @@ declare const index$5_CompactionFetcher: typeof CompactionFetcher;
809
858
  type index$5_Connection = Connection;
810
859
  type index$5_ConnectionBase = ConnectionBase;
811
860
  declare const index$5_ConnectionBase: typeof ConnectionBase;
861
+ type index$5_CryptoAction = CryptoAction;
812
862
  type index$5_DataSaveOpts = DataSaveOpts;
813
863
  type index$5_DataStore = DataStore;
814
864
  type index$5_DbMeta = DbMeta;
@@ -825,7 +875,7 @@ type index$5_FPEnvelopeCar = FPEnvelopeCar;
825
875
  type index$5_FPEnvelopeFile = FPEnvelopeFile;
826
876
  type index$5_FPEnvelopeMeta = FPEnvelopeMeta;
827
877
  type index$5_FPEnvelopeType = FPEnvelopeType;
828
- declare const index$5_FPEnvelopeType: typeof FPEnvelopeType;
878
+ declare const index$5_FPEnvelopeTypes: typeof FPEnvelopeTypes;
829
879
  type index$5_FPEnvelopeWAL = FPEnvelopeWAL;
830
880
  type index$5_FPWALCarsOps = FPWALCarsOps;
831
881
  declare const index$5_File2FPMsg: typeof File2FPMsg;
@@ -834,12 +884,12 @@ type index$5_GatewayOpts = GatewayOpts;
834
884
  type index$5_GetResult = GetResult;
835
885
  type index$5_InterceptorGateway = InterceptorGateway;
836
886
  declare const index$5_InterceptorGateway: typeof InterceptorGateway;
837
- type index$5_IvAndBytes = IvAndBytes;
887
+ type index$5_IvAndKeyAndBytes = IvAndKeyAndBytes;
838
888
  type index$5_IvKeyIdData = IvKeyIdData;
839
889
  type index$5_KeyMaterial = KeyMaterial;
840
- type index$5_KeyWithFingerExtract = KeyWithFingerExtract;
890
+ type index$5_KeyUpsertResult = KeyUpsertResult;
841
891
  type index$5_KeyWithFingerPrint = KeyWithFingerPrint;
842
- type index$5_KeyedCrypto = KeyedCrypto;
892
+ type index$5_KeysByFingerprint = KeysByFingerprint;
843
893
  type index$5_LoadHandler = LoadHandler;
844
894
  type index$5_Loadable = Loadable;
845
895
  type index$5_Loader = Loader;
@@ -899,7 +949,7 @@ declare const index$5_registerStoreProtocol: typeof registerStoreProtocol;
899
949
  declare const index$5_toCIDBlock: typeof toCIDBlock;
900
950
  declare const index$5_toStoreRuntime: typeof toStoreRuntime;
901
951
  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 };
952
+ 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
953
  }
904
954
 
905
955
  interface WriteQueueParams {
@@ -965,25 +1015,27 @@ declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFra
965
1015
 
966
1016
  type Falsy = false | null | undefined;
967
1017
  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
- }
1018
+ declare const PARAM: {
1019
+ SUFFIX: string;
1020
+ URL_GEN: string;
1021
+ STORE_KEY: string;
1022
+ STORE: string;
1023
+ KEY: string;
1024
+ INDEX: string;
1025
+ NAME: string;
1026
+ VERSION: string;
1027
+ RUNTIME: string;
1028
+ FRAG_SIZE: string;
1029
+ IV_VERIFY: string;
1030
+ IV_HASH: string;
1031
+ FRAG_FID: string;
1032
+ FRAG_OFS: string;
1033
+ FRAG_LEN: string;
1034
+ FRAG_HEAD: string;
1035
+ EXTRACTKEY: string;
1036
+ SELF_REFLECT: string;
1037
+ };
1038
+ type PARAMS = (typeof PARAM)[keyof typeof PARAM];
987
1039
  declare function throwFalsy<T>(value: T | Falsy): T;
988
1040
  declare function falsyToUndef<T>(value: T | Falsy): T | undefined;
989
1041
  type StoreType = "data" | "wal" | "meta";
@@ -1458,14 +1510,14 @@ declare namespace files {
1458
1510
  declare class BlockIvKeyIdCodec implements BlockCodec<0x300539, Uint8Array> {
1459
1511
  readonly code = 3147065;
1460
1512
  readonly name = "Fireproof@encrypted-block:aes-gcm";
1461
- readonly ko: KeyedCrypto;
1513
+ readonly ko: CryptoAction;
1462
1514
  readonly iv?: Uint8Array;
1463
1515
  readonly opts: Partial<CodecOpts>;
1464
- constructor(ko: KeyedCrypto, iv?: Uint8Array, opts?: CodecOpts);
1516
+ constructor(ko: CryptoAction, iv?: Uint8Array, opts?: CodecOpts);
1465
1517
  encode(data: Uint8Array): Promise<Uint8Array>;
1466
1518
  decode(abytes: Uint8Array | ArrayBuffer): Promise<Uint8Array>;
1467
1519
  }
1468
- declare function keyedCryptoFactory(url: URI, kb: KeyBag, sthis: SuperThis): Promise<KeyedCrypto>;
1520
+ declare function keyedCryptoFactory(url: URI, kb: KeyBag, sthis: SuperThis): Promise<CryptoAction>;
1469
1521
 
1470
1522
  type keyedCrypto_BlockIvKeyIdCodec = BlockIvKeyIdCodec;
1471
1523
  declare const keyedCrypto_BlockIvKeyIdCodec: typeof BlockIvKeyIdCodec;
@@ -1532,8 +1584,8 @@ declare class KeyBagProviderFile implements KeyBagProvider {
1532
1584
  readonly logger: Logger;
1533
1585
  readonly sthis: SuperThis;
1534
1586
  constructor(url: URI, sthis: SuperThis);
1535
- get(id: string): Promise<KeyItem | undefined>;
1536
- set(id: string, item: KeyItem): Promise<void>;
1587
+ get(id: string): Promise<V1StorageKeyItem | KeysItem | undefined>;
1588
+ set(item: KeysItem): Promise<void>;
1537
1589
  }
1538
1590
 
1539
1591
  declare function sysFileSystemFactory(uri: URI): Promise<SysFileSystem>;
@@ -1616,20 +1668,25 @@ type index_KeyBagOpts = KeyBagOpts;
1616
1668
  type index_KeyBagProvider = KeyBagProvider;
1617
1669
  type index_KeyBagProviderFactoryItem = KeyBagProviderFactoryItem;
1618
1670
  type index_KeyBagRuntime = KeyBagRuntime;
1619
- type index_KeyItem = KeyItem;
1671
+ type index_KeysItem = KeysItem;
1672
+ type index_V1StorageKeyItem = V1StorageKeyItem;
1673
+ type index_V2StorageKeyItem = V2StorageKeyItem;
1620
1674
  declare const index_defaultKeyBagOpts: typeof defaultKeyBagOpts;
1621
1675
  declare const index_defaultKeyBagUrl: typeof defaultKeyBagUrl;
1622
1676
  declare const index_files: typeof files;
1623
1677
  declare const index_getFileName: typeof getFileName;
1624
1678
  declare const index_getKeyBag: typeof getKeyBag;
1625
1679
  declare const index_getPath: typeof getPath;
1680
+ type index_keysByFingerprint = keysByFingerprint;
1681
+ declare const index_keysByFingerprint: typeof keysByFingerprint;
1626
1682
  declare const index_registerKeyBagProviderFactory: typeof registerKeyBagProviderFactory;
1627
1683
  declare const index_runtimeFn: typeof runtimeFn;
1684
+ declare const index_toKeyWithFingerPrint: typeof toKeyWithFingerPrint;
1628
1685
  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 };
1686
+ 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
1687
  }
1631
1688
 
1632
1689
  declare const PACKAGE_VERSION: string;
1633
1690
 
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 };
1691
+ 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
1692
  declare module '@fireproof/core'