@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.
@@ -9387,8 +9387,8 @@ __export(encrypted_block_exports, {
9387
9387
  // src/crypto-web.ts
9388
9388
  function getCrypto() {
9389
9389
  try {
9390
- if (window.crypto && window.crypto.subtle) {
9391
- return window.crypto;
9390
+ if (crypto && crypto.subtle) {
9391
+ return crypto;
9392
9392
  } else {
9393
9393
  return new Crypto();
9394
9394
  }
@@ -9396,11 +9396,11 @@ function getCrypto() {
9396
9396
  return null;
9397
9397
  }
9398
9398
  }
9399
- var crypto2 = getCrypto();
9399
+ var gotCrypto = getCrypto();
9400
9400
  function randomBytes(size3) {
9401
9401
  const bytes = new Uint8Array(size3);
9402
9402
  if (size3 > 0) {
9403
- crypto2.getRandomValues(bytes);
9403
+ crypto.getRandomValues(bytes);
9404
9404
  }
9405
9405
  return bytes;
9406
9406
  }
@@ -9438,7 +9438,7 @@ var decode14 = (bytes) => {
9438
9438
  };
9439
9439
  var code3 = 3145728 + 1337;
9440
9440
  async function subtleKey(key) {
9441
- return await crypto2.subtle.importKey(
9441
+ return await gotCrypto.subtle.importKey(
9442
9442
  "raw",
9443
9443
  // raw or jwk
9444
9444
  key,
@@ -9452,7 +9452,7 @@ async function subtleKey(key) {
9452
9452
  var decrypt = async ({ key, value }) => {
9453
9453
  let { bytes, iv } = value;
9454
9454
  const cryKey = await subtleKey(key);
9455
- const deBytes = await crypto2.subtle.decrypt(
9455
+ const deBytes = await gotCrypto.subtle.decrypt(
9456
9456
  {
9457
9457
  name: "AES-GCM",
9458
9458
  iv,
@@ -9473,7 +9473,7 @@ var encrypt = async ({ key, cid, bytes }) => {
9473
9473
  const msg = concat3([len, cid.bytes, bytes]);
9474
9474
  try {
9475
9475
  const cryKey = await subtleKey(key);
9476
- const deBytes = await crypto2.subtle.encrypt(
9476
+ const deBytes = await gotCrypto.subtle.encrypt(
9477
9477
  {
9478
9478
  name: "AES-GCM",
9479
9479
  iv,
@@ -11605,7 +11605,7 @@ replaceTraps((oldTraps) => ({
11605
11605
  }));
11606
11606
 
11607
11607
  // src/version.ts
11608
- var PACKAGE_VERSION = "0.14.7";
11608
+ var PACKAGE_VERSION = "0.14.9";
11609
11609
 
11610
11610
  // src/store.ts
11611
11611
  var match = PACKAGE_VERSION.match(/^([^.]*\.[^.]*)/);
@@ -12153,10 +12153,10 @@ var Loader = class {
12153
12153
  if (this.key && this.key !== key)
12154
12154
  throw new Error("key mismatch");
12155
12155
  this.key = key;
12156
- const crypto3 = getCrypto();
12157
- if (!crypto3)
12156
+ const crypto2 = getCrypto();
12157
+ if (!crypto2)
12158
12158
  throw new Error("missing crypto module");
12159
- const subtle = crypto3.subtle;
12159
+ const subtle = crypto2.subtle;
12160
12160
  const encoder = new TextEncoder();
12161
12161
  const data = encoder.encode(key);
12162
12162
  const hashBuffer = await subtle.digest("SHA-256", data);
@@ -21515,6 +21515,9 @@ var Database = class {
21515
21515
  }));
21516
21516
  return { rows, clock: head };
21517
21517
  }
21518
+ async allDocuments() {
21519
+ return this.allDocs();
21520
+ }
21518
21521
  subscribe(listener, updates) {
21519
21522
  if (updates) {
21520
21523
  if (!this._listening) {