@reallyme/crypto 0.2.0 → 0.3.1
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/README.md +107 -17
- package/dist/aead.js +15 -8
- package/dist/aesKw.d.ts +7 -4
- package/dist/aesKw.js +69 -22
- package/dist/algorithms.d.ts +12 -4
- package/dist/algorithms.js +8 -2
- package/dist/argon2id.d.ts +1 -0
- package/dist/argon2id.js +13 -4
- package/dist/cryptoFacade.d.ts +33 -8
- package/dist/cryptoFacade.js +42 -29
- package/dist/hkdf.d.ts +1 -0
- package/dist/hkdf.js +5 -1
- package/dist/hmac.d.ts +3 -0
- package/dist/hmac.js +24 -3
- package/dist/hpke.d.ts +1 -2
- package/dist/hpke.js +33 -22
- package/dist/index.d.ts +9 -7
- package/dist/index.js +8 -6
- package/dist/jwk.d.ts +2 -1
- package/dist/jwk.js +104 -63
- package/dist/kmac.d.ts +11 -0
- package/dist/kmac.js +49 -0
- package/dist/mlDsa.js +22 -11
- package/dist/mlKem.d.ts +0 -3
- package/dist/mlKem.js +19 -37
- package/dist/operationResponse.d.ts +16 -0
- package/dist/operationResponse.js +46 -0
- package/dist/pbkdf2.d.ts +6 -8
- package/dist/pbkdf2.js +12 -12
- package/dist/proto/generated/reallyme/crypto/v1/crypto_pb.d.ts +1741 -328
- package/dist/proto/generated/reallyme/crypto/v1/crypto_pb.js +731 -344
- package/dist/proto.d.ts +6 -22
- package/dist/proto.js +124 -102
- package/dist/rsa.d.ts +2 -1
- package/dist/rsa.js +5 -1
- package/dist/slhDsa.js +21 -11
- package/dist/validateBytes.d.ts +6 -1
- package/dist/validateBytes.js +57 -3
- package/dist/wasm/reallyme_crypto_wasm.js +91 -134
- package/dist/wasm/reallyme_crypto_wasm_bg.wasm +0 -0
- package/dist/wasmModuleTypes.d.ts +7 -10
- package/dist/wasmProvider.d.ts +11 -13
- package/dist/wasmProvider.js +16 -19
- package/dist/xWing.d.ts +0 -5
- package/dist/xWing.js +20 -52
- package/package.json +15 -2
package/dist/pbkdf2.js
CHANGED
|
@@ -6,27 +6,27 @@ import { sha256, sha512 } from "@noble/hashes/sha2.js";
|
|
|
6
6
|
import { ReallyMeCryptoError } from "./errors.js";
|
|
7
7
|
export const PBKDF2_MIN_INPUT_LENGTH = 1;
|
|
8
8
|
export const PBKDF2_MAX_INPUT_LENGTH = 4096;
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// the
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
// Public derivation routes enforce a modern baseline. Historical hashes with a
|
|
10
|
+
// lower work factor require an explicit migration tool, not a silent downgrade
|
|
11
|
+
// in the v0.3 API.
|
|
12
|
+
export const PBKDF2_MIN_ITERATIONS = 100_000;
|
|
13
|
+
// Bound hostile work-factor inputs before the provider begins CPU-expensive
|
|
14
|
+
// derivation. This matches the Rust, Swift, and Kotlin public lanes.
|
|
15
|
+
export const PBKDF2_MAX_ITERATIONS = 10_000_000;
|
|
14
16
|
export const PBKDF2_MIN_OUTPUT_LENGTH = 1;
|
|
15
17
|
export const PBKDF2_MAX_OUTPUT_LENGTH = 4096;
|
|
16
18
|
/**
|
|
17
19
|
* OWASP Password Storage Cheat Sheet minimum iteration counts for deriving a
|
|
18
20
|
* *new* password key.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* pass at least the value for their PRF.
|
|
21
|
+
* These stronger profile recommendations remain above the enforced public
|
|
22
|
+
* baseline and should be selected when protocol latency budgets permit.
|
|
22
23
|
*/
|
|
23
24
|
export const PBKDF2_RECOMMENDED_MIN_ITERATIONS_SHA256 = 600_000;
|
|
24
25
|
export const PBKDF2_RECOMMENDED_MIN_ITERATIONS_SHA512 = 220_000;
|
|
25
26
|
export const ReallyMePbkdf2 = {
|
|
26
27
|
/**
|
|
27
28
|
* PBKDF2-HMAC-SHA-256. For a new password key pass at least
|
|
28
|
-
* {@link PBKDF2_RECOMMENDED_MIN_ITERATIONS_SHA256} iterations
|
|
29
|
-
* are accepted only to verify hashes created elsewhere.
|
|
29
|
+
* {@link PBKDF2_RECOMMENDED_MIN_ITERATIONS_SHA256} iterations.
|
|
30
30
|
*/
|
|
31
31
|
deriveHmacSha256(password, salt, iterations, outputLength) {
|
|
32
32
|
validate(password, salt, iterations, outputLength);
|
|
@@ -34,8 +34,7 @@ export const ReallyMePbkdf2 = {
|
|
|
34
34
|
},
|
|
35
35
|
/**
|
|
36
36
|
* PBKDF2-HMAC-SHA-512. For a new password key pass at least
|
|
37
|
-
* {@link PBKDF2_RECOMMENDED_MIN_ITERATIONS_SHA512} iterations
|
|
38
|
-
* are accepted only to verify hashes created elsewhere.
|
|
37
|
+
* {@link PBKDF2_RECOMMENDED_MIN_ITERATIONS_SHA512} iterations.
|
|
39
38
|
*/
|
|
40
39
|
deriveHmacSha512(password, salt, iterations, outputLength) {
|
|
41
40
|
validate(password, salt, iterations, outputLength);
|
|
@@ -49,6 +48,7 @@ function validate(password, salt, iterations, outputLength) {
|
|
|
49
48
|
salt.length > PBKDF2_MAX_INPUT_LENGTH ||
|
|
50
49
|
!Number.isInteger(iterations) ||
|
|
51
50
|
iterations < PBKDF2_MIN_ITERATIONS ||
|
|
51
|
+
iterations > PBKDF2_MAX_ITERATIONS ||
|
|
52
52
|
!Number.isInteger(outputLength) ||
|
|
53
53
|
outputLength < PBKDF2_MIN_OUTPUT_LENGTH ||
|
|
54
54
|
outputLength > PBKDF2_MAX_OUTPUT_LENGTH) {
|