@dbx-tools/shared-core 0.3.32 → 0.3.33

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/hash.ts +12 -1
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "publishConfig": {
23
23
  "access": "public"
24
24
  },
25
- "version": "0.3.32",
25
+ "version": "0.3.33",
26
26
  "types": "index.ts",
27
27
  "type": "module",
28
28
  "exports": {
package/src/hash.ts CHANGED
@@ -45,9 +45,20 @@ export function id(length?: number): string {
45
45
  return id;
46
46
  }
47
47
 
48
+ /**
49
+ * The two `crypto` members this module uses, declared structurally. `Crypto`
50
+ * itself is not nameable here: this package compiles with neither the DOM nor
51
+ * the Node lib, and a consumer that does pull in Node types resolves `Crypto`
52
+ * to a global value rather than a type.
53
+ */
54
+ type CryptoLike = {
55
+ randomUUID?: () => string;
56
+ getRandomValues?: (bytes: Uint8Array) => unknown;
57
+ };
58
+
48
59
  /** A v4 UUID from the strongest randomness source this runtime offers. */
49
60
  function uuidV4(): string {
50
- const webCrypto = globalThis.crypto as Crypto | undefined;
61
+ const webCrypto = globalThis.crypto as CryptoLike | undefined;
51
62
  if (typeof webCrypto?.randomUUID === "function") return webCrypto.randomUUID();
52
63
 
53
64
  const bytes = new Uint8Array(16);