@fireproof/core 0.14.7 → 0.14.9

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.
@@ -9365,8 +9365,8 @@ __export(encrypted_block_exports, {
9365
9365
  // src/crypto-web.ts
9366
9366
  function getCrypto() {
9367
9367
  try {
9368
- if (window.crypto && window.crypto.subtle) {
9369
- return window.crypto;
9368
+ if (crypto && crypto.subtle) {
9369
+ return crypto;
9370
9370
  } else {
9371
9371
  return new Crypto();
9372
9372
  }
@@ -9374,11 +9374,11 @@ function getCrypto() {
9374
9374
  return null;
9375
9375
  }
9376
9376
  }
9377
- var crypto2 = getCrypto();
9377
+ var gotCrypto = getCrypto();
9378
9378
  function randomBytes(size3) {
9379
9379
  const bytes = new Uint8Array(size3);
9380
9380
  if (size3 > 0) {
9381
- crypto2.getRandomValues(bytes);
9381
+ crypto.getRandomValues(bytes);
9382
9382
  }
9383
9383
  return bytes;
9384
9384
  }
@@ -9416,7 +9416,7 @@ var decode14 = (bytes) => {
9416
9416
  };
9417
9417
  var code3 = 3145728 + 1337;
9418
9418
  async function subtleKey(key) {
9419
- return await crypto2.subtle.importKey(
9419
+ return await gotCrypto.subtle.importKey(
9420
9420
  "raw",
9421
9421
  // raw or jwk
9422
9422
  key,
@@ -9430,7 +9430,7 @@ async function subtleKey(key) {
9430
9430
  var decrypt = async ({ key, value }) => {
9431
9431
  let { bytes, iv } = value;
9432
9432
  const cryKey = await subtleKey(key);
9433
- const deBytes = await crypto2.subtle.decrypt(
9433
+ const deBytes = await gotCrypto.subtle.decrypt(
9434
9434
  {
9435
9435
  name: "AES-GCM",
9436
9436
  iv,
@@ -9451,7 +9451,7 @@ var encrypt = async ({ key, cid, bytes }) => {
9451
9451
  const msg = concat3([len, cid.bytes, bytes]);
9452
9452
  try {
9453
9453
  const cryKey = await subtleKey(key);
9454
- const deBytes = await crypto2.subtle.encrypt(
9454
+ const deBytes = await gotCrypto.subtle.encrypt(
9455
9455
  {
9456
9456
  name: "AES-GCM",
9457
9457
  iv,
@@ -11583,7 +11583,7 @@ replaceTraps((oldTraps) => ({
11583
11583
  }));
11584
11584
 
11585
11585
  // src/version.ts
11586
- var PACKAGE_VERSION = "0.14.7";
11586
+ var PACKAGE_VERSION = "0.14.9";
11587
11587
 
11588
11588
  // src/store.ts
11589
11589
  var match = PACKAGE_VERSION.match(/^([^.]*\.[^.]*)/);
@@ -12131,10 +12131,10 @@ var Loader = class {
12131
12131
  if (this.key && this.key !== key)
12132
12132
  throw new Error("key mismatch");
12133
12133
  this.key = key;
12134
- const crypto3 = getCrypto();
12135
- if (!crypto3)
12134
+ const crypto2 = getCrypto();
12135
+ if (!crypto2)
12136
12136
  throw new Error("missing crypto module");
12137
- const subtle = crypto3.subtle;
12137
+ const subtle = crypto2.subtle;
12138
12138
  const encoder = new TextEncoder();
12139
12139
  const data = encoder.encode(key);
12140
12140
  const hashBuffer = await subtle.digest("SHA-256", data);
@@ -21493,6 +21493,9 @@ var Database = class {
21493
21493
  }));
21494
21494
  return { rows, clock: head };
21495
21495
  }
21496
+ async allDocuments() {
21497
+ return this.allDocs();
21498
+ }
21496
21499
  subscribe(listener, updates) {
21497
21500
  if (updates) {
21498
21501
  if (!this._listening) {