@forgezero/runtime 0.1.18 → 0.1.19

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.
@@ -6,9 +6,9 @@
6
6
  * for one operation. Keeping the algorithms here makes their byte formats
7
7
  * independently testable without making `@forgezero/vault.get()` a signer.
8
8
  */
9
- export declare const VAULT_RUNTIME_KINDS: readonly ["random-password", "data-encryption-key", "key-encryption-key", "hmac-key", "jwt-hmac-key", "ed25519-key", "secp256k1-key", "ssh-ca-key", "chain-key"];
9
+ export declare const VAULT_RUNTIME_KINDS: readonly ["random-password", "data-encryption-key", "key-encryption-key", "hmac-key", "jwt-hmac-key", "ed25519-key", "ml-dsa-65-key", "secp256k1-key", "ssh-ca-key", "chain-key"];
10
10
  export type VaultRuntimeKind = typeof VAULT_RUNTIME_KINDS[number];
11
- export declare const VAULT_RUNTIME_ALGORITHM_IDS: readonly ["password-v1", "aes-256-gcm", "aes-256-kw", "hmac-sha256", "hmac-sha512", "jws-hs256", "ed25519", "secp256k1", "ssh-ed25519-ca", "ethereum-secp256k1", "solana-ed25519"];
11
+ export declare const VAULT_RUNTIME_ALGORITHM_IDS: readonly ["password-v1", "aes-256-gcm", "aes-256-kw", "hmac-sha256", "hmac-sha512", "jws-hs256", "ed25519", "ml-dsa-65", "secp256k1", "ssh-ed25519-ca", "ethereum-secp256k1", "solana-ed25519"];
12
12
  export type VaultRuntimeAlgorithm = typeof VAULT_RUNTIME_ALGORITHM_IDS[number];
13
13
  export type VaultRuntimeOperation = 'generate-password' | 'encrypt' | 'decrypt' | 'wrap' | 'unwrap' | 'sign' | 'verify' | 'sign-jwt' | 'verify-jwt' | 'issue-ssh-certificate' | 'derive-public-key' | 'derive-address';
14
14
  export interface VaultRuntimeAlgorithmDefinition {
@@ -66,6 +66,12 @@ export declare const VAULT_RUNTIME_ALGORITHMS: readonly [{
66
66
  readonly operations: readonly ["derive-public-key", "sign", "verify"];
67
67
  readonly exports: "public-only";
68
68
  readonly standard: "RFC 8032";
69
+ }, {
70
+ readonly kind: "ml-dsa-65-key";
71
+ readonly algorithm: "ml-dsa-65";
72
+ readonly operations: readonly ["derive-public-key", "sign", "verify"];
73
+ readonly exports: "public-only";
74
+ readonly standard: "FIPS 204 ML-DSA-65";
69
75
  }, {
70
76
  readonly kind: "secp256k1-key";
71
77
  readonly algorithm: "secp256k1";
@@ -182,6 +188,9 @@ export declare function verifyCompactJws(key: Uint8Array, token: string, options
182
188
  export declare const ed25519PublicKey: (secret: Uint8Array) => Uint8Array;
183
189
  export declare const ed25519Sign: (secret: Uint8Array, message: Uint8Array) => Uint8Array;
184
190
  export declare const ed25519Verify: (publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array) => boolean;
191
+ export declare const mlDsa65PublicKey: (seed: Uint8Array) => Uint8Array;
192
+ export declare const mlDsa65Sign: (seed: Uint8Array, message: Uint8Array) => Uint8Array;
193
+ export declare const mlDsa65Verify: (publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array) => boolean;
185
194
  export declare const secp256k1PublicKey: (secret: Uint8Array, compressed?: boolean) => Uint8Array;
186
195
  export declare const secp256k1SignDigest: (secret: Uint8Array, digest: Uint8Array) => Uint8Array;
187
196
  export declare const secp256k1VerifyDigest: (publicKey: Uint8Array, digest: Uint8Array, signature: Uint8Array) => boolean;
@@ -13,6 +13,7 @@ import { secp256k1 } from "@noble/curves/secp256k1.js";
13
13
  import { hmac } from "@noble/hashes/hmac.js";
14
14
  import { keccak_256 } from "@noble/hashes/sha3.js";
15
15
  import { sha256, sha512 } from "@noble/hashes/sha2.js";
16
+ import { ml_dsa65 } from "@noble/post-quantum/ml-dsa.js";
16
17
  import { base58 } from "@scure/base";
17
18
  var VAULT_RUNTIME_KINDS = [
18
19
  "random-password",
@@ -21,6 +22,7 @@ var VAULT_RUNTIME_KINDS = [
21
22
  "hmac-key",
22
23
  "jwt-hmac-key",
23
24
  "ed25519-key",
25
+ "ml-dsa-65-key",
24
26
  "secp256k1-key",
25
27
  "ssh-ca-key",
26
28
  "chain-key"
@@ -33,6 +35,7 @@ var VAULT_RUNTIME_ALGORITHM_IDS = [
33
35
  "hmac-sha512",
34
36
  "jws-hs256",
35
37
  "ed25519",
38
+ "ml-dsa-65",
36
39
  "secp256k1",
37
40
  "ssh-ed25519-ca",
38
41
  "ethereum-secp256k1",
@@ -46,6 +49,7 @@ var VAULT_RUNTIME_ALGORITHMS = [
46
49
  { kind: "hmac-key", algorithm: "hmac-sha512", operations: ["sign", "verify"], exports: "none", standard: "RFC 2104 / SHA-512" },
47
50
  { kind: "jwt-hmac-key", algorithm: "jws-hs256", operations: ["sign-jwt", "verify-jwt"], exports: "none", standard: "RFC 7515 / RFC 7518" },
48
51
  { kind: "ed25519-key", algorithm: "ed25519", operations: ["derive-public-key", "sign", "verify"], exports: "public-only", standard: "RFC 8032" },
52
+ { kind: "ml-dsa-65-key", algorithm: "ml-dsa-65", operations: ["derive-public-key", "sign", "verify"], exports: "public-only", standard: "FIPS 204 ML-DSA-65" },
49
53
  { kind: "secp256k1-key", algorithm: "secp256k1", operations: ["derive-public-key", "sign", "verify"], exports: "public-only", standard: "SEC 2 secp256k1" },
50
54
  { kind: "ssh-ca-key", algorithm: "ssh-ed25519-ca", operations: ["derive-public-key", "issue-ssh-certificate"], exports: "public-only", standard: "OpenSSH PROTOCOL.certkeys" },
51
55
  { kind: "chain-key", algorithm: "ethereum-secp256k1", operations: ["derive-public-key", "derive-address", "sign", "verify"], exports: "public-only", standard: "BIP-32/BIP-44/SLIP-44/EIP-55" },
@@ -208,6 +212,9 @@ function verifyCompactJws(key, token, options = {}) {
208
212
  var ed25519PublicKey = (secret) => ed25519.getPublicKey(secret);
209
213
  var ed25519Sign = (secret, message) => ed25519.sign(message, secret);
210
214
  var ed25519Verify = (publicKey, message, signature) => ed25519.verify(signature, message, publicKey);
215
+ var mlDsa65PublicKey = (seed) => ml_dsa65.keygen(seed).publicKey;
216
+ var mlDsa65Sign = (seed, message) => ml_dsa65.sign(message, ml_dsa65.keygen(seed).secretKey);
217
+ var mlDsa65Verify = (publicKey, message, signature) => ml_dsa65.verify(signature, message, publicKey);
211
218
  var secp256k1PublicKey = (secret, compressed = true) => secp256k1.getPublicKey(secret, compressed);
212
219
  var secp256k1SignDigest = (secret, digest) => {
213
220
  if (digest.length !== 32)
@@ -254,6 +261,9 @@ export {
254
261
  secp256k1SignDigest,
255
262
  secp256k1PublicKey,
256
263
  passwordFromBytes,
264
+ mlDsa65Verify,
265
+ mlDsa65Sign,
266
+ mlDsa65PublicKey,
257
267
  hmacVerify,
258
268
  hmacSign,
259
269
  fromBase64Url,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgezero/runtime",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",