@abraca/dabra 2.0.1 → 2.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/dabra",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "abracadabra provider",
5
5
  "keywords": [
6
6
  "abracadabra",
@@ -29,10 +29,10 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@lifeomic/attempt": "^3.1.0",
32
- "@noble/curves": "^2.0.1",
33
- "@noble/ed25519": "^2.3.0",
34
- "@noble/hashes": "^1.8.0",
35
- "@scure/bip39": "^1.5.0",
32
+ "@noble/curves": "^2.2.0",
33
+ "@noble/ed25519": "^3.1.0",
34
+ "@noble/hashes": "^2.2.0",
35
+ "@scure/bip39": "^2.2.0",
36
36
  "lib0": "^0.2.117",
37
37
  "ws": "^8.19.0"
38
38
  },
@@ -188,7 +188,7 @@ export class AbracadabraWS extends EventEmitter {
188
188
 
189
189
  this.configuration.WebSocketPolyfill = configuration.WebSocketPolyfill
190
190
  ? configuration.WebSocketPolyfill
191
- : WebSocket;
191
+ : (globalThis as { WebSocket?: typeof WebSocket }).WebSocket;
192
192
 
193
193
  this.on("open", this.configuration.onOpen);
194
194
  this.on("open", this.onOpen.bind(this));
@@ -18,9 +18,14 @@
18
18
  */
19
19
 
20
20
  import * as ed from "@noble/ed25519";
21
- import { hkdf } from "@noble/hashes/hkdf";
22
- import { sha256 } from "@noble/hashes/sha256";
21
+ import { hkdf } from "@noble/hashes/hkdf.js";
22
+ import { sha256, sha512 } from "@noble/hashes/sha2.js";
23
23
  import { ed25519 as nobleEd25519Curves } from "@noble/curves/ed25519.js";
24
+
25
+ // @noble/ed25519 v3: wire sha512 for sync paths and define an async hook so
26
+ // signAsync/verifyAsync don't require a Web Crypto fallback in Node.
27
+ ed.hashes.sha512 = sha512;
28
+ ed.hashes.sha512Async = (m: Uint8Array) => Promise.resolve(sha512(m));
24
29
  import {
25
30
  mnemonicToKeyPair,
26
31
  mnemonicToEd25519Seed,
@@ -6,8 +6,8 @@
6
6
  */
7
7
 
8
8
  import { x25519 } from "@noble/curves/ed25519.js";
9
- import { hkdf } from "@noble/hashes/hkdf";
10
- import { sha256 } from "@noble/hashes/sha256";
9
+ import { hkdf } from "@noble/hashes/hkdf.js";
10
+ import { sha256 } from "@noble/hashes/sha2.js";
11
11
  import type { AbracadabraClient } from "./AbracadabraClient.ts";
12
12
  import type { CryptoIdentityKeystore } from "./CryptoIdentityKeystore.ts";
13
13
 
@@ -1,5 +1,5 @@
1
1
  import * as Y from "yjs";
2
- import { sha256 } from "@noble/hashes/sha256";
2
+ import { sha256 } from "@noble/hashes/sha2.js";
3
3
  import EventEmitter from "./EventEmitter.ts";
4
4
  import { AbracadabraProvider } from "./AbracadabraProvider.ts";
5
5
  import type { AbracadabraProviderConfiguration } from "./AbracadabraProvider.ts";
@@ -21,11 +21,15 @@
21
21
  */
22
22
 
23
23
  import * as ed from "@noble/ed25519";
24
- import { hkdf } from "@noble/hashes/hkdf";
25
- import { sha256 } from "@noble/hashes/sha256";
24
+ import { hkdf } from "@noble/hashes/hkdf.js";
25
+ import { sha256, sha512 } from "@noble/hashes/sha2.js";
26
26
  import { ed25519 as nobleEd25519Curves } from "@noble/curves/ed25519.js";
27
27
  import { generateMnemonic as _generateMnemonic, validateMnemonic as _validateMnemonic, mnemonicToSeedSync } from "@scure/bip39";
28
- import { wordlist } from "@scure/bip39/wordlists/english";
28
+ import { wordlist } from "@scure/bip39/wordlists/english.js";
29
+
30
+ // @noble/ed25519 v3 hash hook (idempotent across modules).
31
+ ed.hashes.sha512 = sha512;
32
+ ed.hashes.sha512Async = (m: Uint8Array) => Promise.resolve(sha512(m));
29
33
 
30
34
  // ── Constants ───────────────────────────────────────────────────────────────
31
35
 
@@ -10,7 +10,7 @@
10
10
  * DataChannelRouter, and E2EEChannel (X25519 ECDH + AES-256-GCM).
11
11
  */
12
12
 
13
- import { sha256 } from "@noble/hashes/sha256";
13
+ import { sha256 } from "@noble/hashes/sha2.js";
14
14
  import EventEmitter from "../EventEmitter.ts";
15
15
  import { AbracadabraClient } from "../AbracadabraClient.ts";
16
16
  import { AbracadabraWebRTC } from "./AbracadabraWebRTC.ts";
@@ -21,8 +21,8 @@
21
21
  */
22
22
 
23
23
  import { x25519, ed25519 as nobleEd25519 } from "@noble/curves/ed25519.js";
24
- import { hkdf } from "@noble/hashes/hkdf";
25
- import { sha256 } from "@noble/hashes/sha256";
24
+ import { hkdf } from "@noble/hashes/hkdf.js";
25
+ import { sha256 } from "@noble/hashes/sha2.js";
26
26
  import EventEmitter from "../EventEmitter.ts";
27
27
 
28
28
  const HKDF_INFO = new TextEncoder().encode("abracadabra-webrtc-e2ee-v1");