@fireproof/core 0.14.7 → 0.14.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,3 @@
1
-
2
- import { createRequire } from 'module';
3
- const require = createRequire(import.meta.url);
4
-
5
1
  var __create = Object.create;
6
2
  var __defProp = Object.defineProperty;
7
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -9330,8 +9326,8 @@ __export(encrypted_block_exports, {
9330
9326
  // src/crypto-web.ts
9331
9327
  function getCrypto() {
9332
9328
  try {
9333
- if (window.crypto && window.crypto.subtle) {
9334
- return window.crypto;
9329
+ if (crypto && crypto.subtle) {
9330
+ return crypto;
9335
9331
  } else {
9336
9332
  return new Crypto();
9337
9333
  }
@@ -9339,11 +9335,11 @@ function getCrypto() {
9339
9335
  return null;
9340
9336
  }
9341
9337
  }
9342
- var crypto2 = getCrypto();
9338
+ var gotCrypto = getCrypto();
9343
9339
  function randomBytes(size3) {
9344
9340
  const bytes = new Uint8Array(size3);
9345
9341
  if (size3 > 0) {
9346
- crypto2.getRandomValues(bytes);
9342
+ crypto.getRandomValues(bytes);
9347
9343
  }
9348
9344
  return bytes;
9349
9345
  }
@@ -9381,7 +9377,7 @@ var decode14 = (bytes) => {
9381
9377
  };
9382
9378
  var code3 = 3145728 + 1337;
9383
9379
  async function subtleKey(key) {
9384
- return await crypto2.subtle.importKey(
9380
+ return await gotCrypto.subtle.importKey(
9385
9381
  "raw",
9386
9382
  // raw or jwk
9387
9383
  key,
@@ -9395,7 +9391,7 @@ async function subtleKey(key) {
9395
9391
  var decrypt = async ({ key, value }) => {
9396
9392
  let { bytes, iv } = value;
9397
9393
  const cryKey = await subtleKey(key);
9398
- const deBytes = await crypto2.subtle.decrypt(
9394
+ const deBytes = await gotCrypto.subtle.decrypt(
9399
9395
  {
9400
9396
  name: "AES-GCM",
9401
9397
  iv,
@@ -9416,7 +9412,7 @@ var encrypt = async ({ key, cid, bytes }) => {
9416
9412
  const msg = concat3([len, cid.bytes, bytes]);
9417
9413
  try {
9418
9414
  const cryKey = await subtleKey(key);
9419
- const deBytes = await crypto2.subtle.encrypt(
9415
+ const deBytes = await gotCrypto.subtle.encrypt(
9420
9416
  {
9421
9417
  name: "AES-GCM",
9422
9418
  iv,
@@ -11341,7 +11337,7 @@ var parse2 = (data) => decode16(utf8Encoder.encode(data));
11341
11337
  var utf8Encoder = new TextEncoder();
11342
11338
 
11343
11339
  // src/version.ts
11344
- var PACKAGE_VERSION = "0.14.7";
11340
+ var PACKAGE_VERSION = "0.14.9";
11345
11341
 
11346
11342
  // src/store.ts
11347
11343
  var match = PACKAGE_VERSION.match(/^([^.]*\.[^.]*)/);
@@ -11856,10 +11852,10 @@ var Loader = class {
11856
11852
  if (this.key && this.key !== key)
11857
11853
  throw new Error("key mismatch");
11858
11854
  this.key = key;
11859
- const crypto3 = getCrypto();
11860
- if (!crypto3)
11855
+ const crypto2 = getCrypto();
11856
+ if (!crypto2)
11861
11857
  throw new Error("missing crypto module");
11862
- const subtle = crypto3.subtle;
11858
+ const subtle = crypto2.subtle;
11863
11859
  const encoder = new TextEncoder();
11864
11860
  const data = encoder.encode(key);
11865
11861
  const hashBuffer = await subtle.digest("SHA-256", data);
@@ -21212,6 +21208,9 @@ var Database = class {
21212
21208
  }));
21213
21209
  return { rows, clock: head };
21214
21210
  }
21211
+ async allDocuments() {
21212
+ return this.allDocs();
21213
+ }
21215
21214
  subscribe(listener, updates) {
21216
21215
  if (updates) {
21217
21216
  if (!this._listening) {