s3db.js 3.2.1 → 3.2.2

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/dist/s3db.iife.js CHANGED
@@ -739,7 +739,7 @@ ${JSON.stringify(rest, null, 2)}`;
739
739
  }
740
740
  class NoSuchKey extends BaseError {
741
741
  constructor({ bucket, key, ...rest }) {
742
- super({ ...rest, bucket, message: `Key does not exists [bucket:${bucket}/${key}]` });
742
+ super({ ...rest, bucket, message: `Key [${key}] does not exists [bucket:${bucket}/${key}]` });
743
743
  this.key = key;
744
744
  }
745
745
  }
@@ -1178,11 +1178,19 @@ ${JSON.stringify(validation, null, 2)}`
1178
1178
  }
1179
1179
 
1180
1180
  async function dynamicCrypto() {
1181
- if (lodashEs.isObject(process)) {
1182
- return (await Promise.resolve().then(function () { return _polyfillNode_crypto; })).webcrypto;
1183
- } else {
1184
- return window.crypto;
1181
+ let lib;
1182
+ if (process) {
1183
+ try {
1184
+ const { webcrypto } = await Promise.resolve().then(function () { return _polyfillNode_crypto; });
1185
+ lib = webcrypto;
1186
+ } catch (error) {
1187
+ throw new Error("Crypto API not available");
1188
+ }
1189
+ } else if (window) {
1190
+ lib = window.crypto;
1185
1191
  }
1192
+ if (!lib) throw new Error("Could not load any crypto library");
1193
+ return lib;
1186
1194
  }
1187
1195
  async function sha256(message) {
1188
1196
  const cryptoLib = await dynamicCrypto();