@lanitlabs/pqc-lnqc714 1.0.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.
@@ -0,0 +1,32 @@
1
+ export class KeyPair {
2
+ readonly public_key_a: Uint8Array;
3
+ readonly public_key_t: Uint8Array;
4
+ readonly private_key: Uint8Array;
5
+ private constructor();
6
+ free(): void;
7
+ [Symbol.dispose](): void;
8
+ }
9
+
10
+ export class Ciphertext {
11
+ readonly u: Uint8Array;
12
+ readonly v: Uint8Array;
13
+ readonly byte_length: number;
14
+ private constructor();
15
+ free(): void;
16
+ [Symbol.dispose](): void;
17
+ }
18
+
19
+ export const LNQC: {
20
+ keyGen(): KeyPair;
21
+ encapsulate(publicKeyA: Uint8Array, publicKeyT: Uint8Array, message: Uint8Array): Ciphertext;
22
+ decapsulate(privateKey: Uint8Array, u: Uint8Array, v: Uint8Array): Uint8Array;
23
+ constantTimeVerify(a: Uint8Array, b: Uint8Array): boolean;
24
+ randomBits(len: number): Uint8Array;
25
+ getNCols(): number;
26
+ getMRows(): number;
27
+ getNoiseWeight(): number;
28
+ getLdpcDataBits(): number;
29
+ getLdpcCodewordBits(): number;
30
+ };
31
+
32
+ export default LNQC;
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ const isNode = typeof process !== 'undefined' && process.release && process.release.name === 'node';
2
+
3
+ let engine: typeof import('../pkg/node/pqc_lnqc714');
4
+
5
+ if (isNode) {
6
+ engine = require('../pkg/node/pqc_lnqc714');
7
+ } else {
8
+ engine = require('../pkg/browser/pqc_lnqc714');
9
+ }
10
+
11
+ export type { KeyPair, Ciphertext } from '../pkg/browser/pqc_lnqc714';
12
+
13
+ export const LNQC = {
14
+ keyGen: (): import('../pkg/browser/pqc_lnqc714').KeyPair => engine.key_gen(),
15
+
16
+ encapsulate: (
17
+ publicKeyA: Uint8Array,
18
+ publicKeyT: Uint8Array,
19
+ message: Uint8Array,
20
+ ): import('../pkg/browser/pqc_lnqc714').Ciphertext =>
21
+ engine.encapsulate(publicKeyA, publicKeyT, message),
22
+
23
+ decapsulate: (
24
+ privateKey: Uint8Array,
25
+ u: Uint8Array,
26
+ v: Uint8Array,
27
+ ): Uint8Array => engine.decapsulate(privateKey, u, v),
28
+
29
+ constantTimeVerify: (a: Uint8Array, b: Uint8Array): boolean =>
30
+ engine.constant_time_verify(a, b),
31
+
32
+ randomBits: (len: number): Uint8Array => engine.random_bits(len),
33
+
34
+ getNCols: (): number => engine.get_n_cols(),
35
+ getMRows: (): number => engine.get_m_rows(),
36
+ getNoiseWeight: (): number => engine.get_noise_weight(),
37
+ getLdpcDataBits: (): number => engine.get_ldpc_data_bits(),
38
+ getLdpcCodewordBits: (): number => engine.get_ldpc_codeword_bits(),
39
+ };
40
+
41
+ export default LNQC;
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@lanitlabs/pqc-lnqc714",
3
+ "version": "1.0.0",
4
+ "description": "Post-Quantum KEM — LPN-based key encapsulation with LDPC error correction. Constant-time Rust/WASM engine.",
5
+ "license": "MIT",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "node": "./pkg/node/pqc_lnqc714.js",
12
+ "default": "./pkg/browser/pqc_lnqc714.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "pkg/node/pqc_lnqc714.js",
17
+ "pkg/node/pqc_lnqc714_bg.wasm",
18
+ "pkg/node/pqc_lnqc714.d.ts",
19
+ "pkg/node/pqc_lnqc714_bg.wasm.d.ts",
20
+ "pkg/browser/pqc_lnqc714.js",
21
+ "pkg/browser/pqc_lnqc714_bg.wasm",
22
+ "pkg/browser/pqc_lnqc714.d.ts",
23
+ "pkg/browser/pqc_lnqc714_bg.wasm.d.ts",
24
+ "dist/index.js",
25
+ "dist/index.d.ts"
26
+ ],
27
+ "engines": {
28
+ "node": ">=18"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ }
33
+ }