@bcts/crypto 1.0.0-alpha.9 → 1.0.0-beta.0

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.
@@ -1,6 +1,12 @@
1
+ /**
2
+ * Copyright © 2023-2026 Blockchain Commons, LLC
3
+ * Copyright © 2025-2026 Parity Technologies
4
+ *
5
+ */
6
+
1
7
  // Ported from bc-crypto-rust/src/schnorr_signing.rs
2
8
 
3
- import { schnorr } from "@noble/curves/secp256k1";
9
+ import { schnorr } from "@noble/curves/secp256k1.js";
4
10
  import type { RandomNumberGenerator } from "@bcts/rand";
5
11
  import { SecureRandomNumberGenerator } from "@bcts/rand";
6
12
  import { ECDSA_PRIVATE_KEY_SIZE, SCHNORR_PUBLIC_KEY_SIZE } from "./ecdsa-keys.js";
package/src/scrypt.ts CHANGED
@@ -1,10 +1,19 @@
1
+ /**
2
+ * Copyright © 2023-2026 Blockchain Commons, LLC
3
+ * Copyright © 2025-2026 Parity Technologies
4
+ *
5
+ */
6
+
1
7
  // Ported from bc-crypto-rust/src/scrypt.rs
2
8
 
3
- import { scrypt as nobleScrypt } from "@noble/hashes/scrypt";
9
+ import { scrypt as nobleScrypt } from "@noble/hashes/scrypt.js";
4
10
 
5
11
  /**
6
12
  * Derive a key using Scrypt with recommended parameters.
7
- * Uses N=2^15 (32768), r=8, p=1 as recommended defaults.
13
+ *
14
+ * Mirrors Rust `bc_crypto::scrypt` which calls `scrypt::Params::recommended()`.
15
+ * The recommended parameters per the upstream `scrypt` crate are
16
+ * `log_n = 17` (N = 2^17 = 131072), `r = 8`, `p = 1`.
8
17
  *
9
18
  * @param password - Password or passphrase
10
19
  * @param salt - Salt value
@@ -12,7 +21,7 @@ import { scrypt as nobleScrypt } from "@noble/hashes/scrypt";
12
21
  * @returns Derived key
13
22
  */
14
23
  export function scrypt(password: Uint8Array, salt: Uint8Array, outputLen: number): Uint8Array {
15
- return scryptOpt(password, salt, outputLen, 15, 8, 1);
24
+ return scryptOpt(password, salt, outputLen, 17, 8, 1);
16
25
  }
17
26
 
18
27
  /**
@@ -1,6 +1,12 @@
1
+ /**
2
+ * Copyright © 2023-2026 Blockchain Commons, LLC
3
+ * Copyright © 2025-2026 Parity Technologies
4
+ *
5
+ */
6
+
1
7
  // Ported from bc-crypto-rust/src/symmetric_encryption.rs
2
8
 
3
- import { chacha20poly1305 } from "@noble/ciphers/chacha";
9
+ import { chacha20poly1305 } from "@noble/ciphers/chacha.js";
4
10
  import { CryptoError, AeadError } from "./error.js";
5
11
 
6
12
  // Constants