@push.rocks/smartcrypto 3.3.0 → 3.4.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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartcrypto',
6
- version: '3.3.0',
6
+ version: '3.4.0',
7
7
  description: 'A library providing easy methods for cryptographic operations, including key pair generation.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx5QkFBeUI7SUFDL0IsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLCtGQUErRjtDQUM3RyxDQUFBIn0=
@@ -7,5 +7,6 @@ export { SmartCryptoError } from './smartcrypto.errors.js';
7
7
  export type { ISmartCryptoErrorJson, TSmartCryptoErrorCode, } from './smartcrypto.errors.js';
8
8
  export * from './smartcrypto.webcrypto.js';
9
9
  export * from './smartcrypto.x25519.js';
10
+ export * from './smartcrypto.mlkem768.js';
10
11
  export * from './smartcrypto.hash.js';
11
12
  export * from './smartcrypto.x509.js';
package/dist_ts/index.js CHANGED
@@ -5,6 +5,7 @@ export * from './smartcrypto.classes.publickey.js';
5
5
  export { SmartCryptoError } from './smartcrypto.errors.js';
6
6
  export * from './smartcrypto.webcrypto.js';
7
7
  export * from './smartcrypto.x25519.js';
8
+ export * from './smartcrypto.mlkem768.js';
8
9
  export * from './smartcrypto.hash.js';
9
10
  export * from './smartcrypto.x509.js';
10
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHNDQUFzQyxDQUFDO0FBQ3JELGNBQWMsa0NBQWtDLENBQUM7QUFDakQsY0FBYyxxQ0FBcUMsQ0FBQztBQUNwRCxjQUFjLG9DQUFvQyxDQUFDO0FBS25ELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBSzNELGNBQWMsNEJBQTRCLENBQUM7QUFDM0MsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsdUJBQXVCLENBQUMifQ==
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHNDQUFzQyxDQUFDO0FBQ3JELGNBQWMsa0NBQWtDLENBQUM7QUFDakQsY0FBYyxxQ0FBcUMsQ0FBQztBQUNwRCxjQUFjLG9DQUFvQyxDQUFDO0FBS25ELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBSzNELGNBQWMsNEJBQTRCLENBQUM7QUFDM0MsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyx1QkFBdUIsQ0FBQyJ9
@@ -0,0 +1,54 @@
1
+ export declare const MLKEM768_PUBLIC_KEY_BYTES = 1184;
2
+ export declare const MLKEM768_SECRET_KEY_BYTES = 2400;
3
+ export declare const MLKEM768_CIPHERTEXT_BYTES = 1088;
4
+ export declare const MLKEM768_SHARED_SECRET_BYTES = 32;
5
+ export declare const MLKEM768_SEED_BYTES = 64;
6
+ export declare const MLKEM768_SPKI_BYTES: number;
7
+ export interface IMlKem768KeyPair {
8
+ /** Raw 1184-byte FIPS 203 encapsulation key (`ek`). */
9
+ publicKey: Uint8Array;
10
+ /** Raw 2400-byte FIPS 203 decapsulation key (`dk`). */
11
+ secretKey: Uint8Array;
12
+ }
13
+ export interface IMlKem768EncapsulationResult {
14
+ /** 1088-byte FIPS 203 ciphertext (`c`). */
15
+ ciphertext: Uint8Array;
16
+ /** 32-byte shared secret (`K`). */
17
+ sharedSecret: Uint8Array;
18
+ }
19
+ /**
20
+ * Validates a raw 1184-byte FIPS 203 ML-KEM-768 encapsulation key (length and
21
+ * FIPS 203 §7.2 modulus check on every 12-bit coefficient).
22
+ */
23
+ export declare const assertValidMlKem768PublicKey: (publicKeyArg: Uint8Array) => void;
24
+ /**
25
+ * Deterministic FIPS 203 `ML-KEM.KeyGen_internal(d, z)` from a 64-byte seed (`d || z`).
26
+ */
27
+ export declare const mlKem768KeyGenFromSeed: (seedArg: Uint8Array) => IMlKem768KeyPair;
28
+ /**
29
+ * Generates a fresh random FIPS 203 ML-KEM-768 keypair.
30
+ */
31
+ export declare const generateMlKem768KeyPair: () => IMlKem768KeyPair;
32
+ /**
33
+ * Deterministic FIPS 203 `ML-KEM.Encaps_internal(ek, m)` from a 32-byte message `m`.
34
+ */
35
+ export declare const mlKem768EncapsulateDeterministic: (publicKeyArg: Uint8Array, messageArg: Uint8Array) => IMlKem768EncapsulationResult;
36
+ /**
37
+ * FIPS 203 `ML-KEM.Encaps(ek)`: encapsulates a fresh 32-byte shared secret to `publicKeyArg`.
38
+ */
39
+ export declare const mlKem768Encapsulate: (publicKeyArg: Uint8Array) => IMlKem768EncapsulationResult;
40
+ /**
41
+ * FIPS 203 `ML-KEM.Decaps(dk, c)`: decapsulates `ciphertextArg` with constant-time
42
+ * implicit rejection on ciphertext mismatch.
43
+ */
44
+ export declare const mlKem768Decapsulate: (secretKeyArg: Uint8Array, ciphertextArg: Uint8Array) => Uint8Array;
45
+ /**
46
+ * Wraps a validated raw 1184-byte ML-KEM-768 public key in canonical ASN.1 DER
47
+ * SubjectPublicKeyInfo (1206 bytes, compatible with OpenSSL 3.5 / Node.js).
48
+ */
49
+ export declare const mlKem768PublicKeyToSpki: (publicKeyArg: Uint8Array) => Uint8Array;
50
+ /**
51
+ * Extracts and validates the raw 1184-byte ML-KEM-768 public key from a canonical
52
+ * 1206-byte ASN.1 DER SubjectPublicKeyInfo buffer.
53
+ */
54
+ export declare const spkiToMlKem768PublicKey: (spkiArg: Uint8Array) => Uint8Array;