quantum-resistant-rustykey 0.12.9 → 0.12.12
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 +1 -1
- package/dist/index.d.ts +37 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +487 -107
- package/dist/index.js.map +1 -1
- package/dist/sqisign-accel-worker.js +1604 -0
- package/dist/sqisign-accel-worker.js.map +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ The three parameter sets (512/768/1024) use the same implementation family and d
|
|
|
77
77
|
|
|
78
78
|
### We predominantly use C, not Rust for our web-assembly (WASM) modules: Why?
|
|
79
79
|
|
|
80
|
-
- ***we're not cryptanalysts, not the smartypants type. We choose not to 'roll our own' cryptography as it's worrying enough we compile the C into web-assembly...what if our work strips out constant-time protections? Think of us as enthusiastic interweb equivalents of stonemasons, ironworkers, mechanics and logistics crew.
|
|
80
|
+
- ***we're not cryptanalysts, not the smartypants type. We choose not to 'roll our own' cryptography as it's worrying enough we compile the C into web-assembly...what if our work strips out constant-time protections? Think of us as enthusiastic interweb equivalents of stonemasons, ironworkers, mechanics and logistics crew. If you're OK that we'll definitely break a few things along the way, you know where to find us: well below decks in grubby overalls, keeping the engines humming. Far above us, topside, lounge the elegantly-dressed OG engineers who long ago earned their Hugo spritzes. We publish frequently 'into the wild' to guarantee our code is battle-tested, bugs found quickly. It only works because we rely absolutely on vetted, peer-reviewed designs from you and the rest of the research community.***
|
|
81
81
|
|
|
82
82
|
It seems all the cool cryptanalyst kids nowadays rely on Rust's proven memory and concurrency safety and high performance without a Garbage Collector. Hre it's old-school for the time being: shipped cryptographic WASM modules will continue to be built via Emscripten from vetted C/C++ upstream code. We do love Rust when used at the right time: Rust/TypeScript will be primarily used for package-level ergonomics and integration layers.
|
|
83
83
|
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ interface IMlKem {
|
|
|
15
15
|
decryptMessage(encryptedMessage: Uint8Array, secret: any): Promise<string>;
|
|
16
16
|
delete(): void;
|
|
17
17
|
}
|
|
18
|
+
type SqisignVariant = "lvl1" | "lvl3" | "lvl5";
|
|
18
19
|
interface IFnDsa {
|
|
19
20
|
keypair(): KeyPair;
|
|
20
21
|
sign(message: Uint8Array | ArrayBuffer | string, private_key: unknown): Promise<Uint8Array>;
|
|
@@ -59,10 +60,45 @@ declare const SQISIGN_LVL5_KAT0_SM_HEX = "6B8EF5D7689A1EA1CFCE9C6F7495E309E9D1D1
|
|
|
59
60
|
declare const SQISIGN_LVL5_KAT0_SIG_HEX: string;
|
|
60
61
|
declare const SQISIGN_LVL5_KAT0_MSG_HEX: string;
|
|
61
62
|
//#endregion
|
|
63
|
+
//#region src/sqisign-accel-env.d.ts
|
|
64
|
+
type SqisignWebGpuSupport = {
|
|
65
|
+
available: boolean;
|
|
66
|
+
crossOriginIsolated: boolean;
|
|
67
|
+
sharedArrayBuffer: boolean;
|
|
68
|
+
webGpu: boolean;
|
|
69
|
+
reason?: string;
|
|
70
|
+
};
|
|
71
|
+
declare const SQISIGN_WEBGPU_VARIANT_LABELS: {
|
|
72
|
+
readonly lvl1: "SQISign-L1-webGPU";
|
|
73
|
+
readonly lvl3: "SQISign-L3-webGPU";
|
|
74
|
+
readonly lvl5: "SQISign-L5-webGPU";
|
|
75
|
+
};
|
|
76
|
+
type SqisignWebGpuVariant = keyof typeof SQISIGN_WEBGPU_VARIANT_LABELS;
|
|
77
|
+
declare function getSqisignWebGpuSupport(): SqisignWebGpuSupport;
|
|
78
|
+
declare function isSqisignWebGpuAvailable(): boolean;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/sqisign-webgpu.d.ts
|
|
81
|
+
/** Host apps (e.g. Next.js) must serve dist/sqisign-accel-worker.js — see docs/SQISIGN-WEBGPU.md */
|
|
82
|
+
declare function setSqisignAccelWorkerUrl(url: string): void;
|
|
83
|
+
type SqisignBenchSteps = {
|
|
84
|
+
keygenMs: number;
|
|
85
|
+
signMs: number;
|
|
86
|
+
verifyMs: number;
|
|
87
|
+
};
|
|
88
|
+
declare function benchSqisignWebGpu(variant: SqisignVariant, message?: string): Promise<{
|
|
89
|
+
algorithm: string;
|
|
90
|
+
ok: boolean;
|
|
91
|
+
signatureBytes: number;
|
|
92
|
+
steps: SqisignBenchSteps;
|
|
93
|
+
}>;
|
|
94
|
+
declare function loadSqisignLvl1WebGpu(): Promise<IFnDsa>;
|
|
95
|
+
declare function loadSqisignLvl3WebGpu(): Promise<IFnDsa>;
|
|
96
|
+
declare function loadSqisignLvl5WebGpu(): Promise<IFnDsa>;
|
|
97
|
+
//#endregion
|
|
62
98
|
//#region src/index.d.ts
|
|
63
99
|
declare function loadMlKem768(): Promise<IMlKem>;
|
|
64
100
|
declare function loadMlKem512(): Promise<IMlKem>;
|
|
65
101
|
declare function loadMlKem1024(): Promise<IMlKem>;
|
|
66
102
|
//#endregion
|
|
67
|
-
export { SQISIGN_LVL1_KAT0_MSG_HEX, SQISIGN_LVL1_KAT0_PK_HEX, SQISIGN_LVL1_KAT0_SIG_HEX, SQISIGN_LVL1_KAT0_SM_HEX, SQISIGN_LVL3_KAT0_MSG_HEX, SQISIGN_LVL3_KAT0_PK_HEX, SQISIGN_LVL3_KAT0_SIG_HEX, SQISIGN_LVL3_KAT0_SM_HEX, SQISIGN_LVL5_KAT0_MSG_HEX, SQISIGN_LVL5_KAT0_PK_HEX, SQISIGN_LVL5_KAT0_SIG_HEX, SQISIGN_LVL5_KAT0_SM_HEX, loadFnDsa1024, loadFnDsa512, loadMlDsa3, loadMlDsa5, loadMlKem1024, loadMlKem512, loadMlKem768, loadSqisignLvl1, loadSqisignLvl3, loadSqisignLvl5 };
|
|
103
|
+
export { SQISIGN_LVL1_KAT0_MSG_HEX, SQISIGN_LVL1_KAT0_PK_HEX, SQISIGN_LVL1_KAT0_SIG_HEX, SQISIGN_LVL1_KAT0_SM_HEX, SQISIGN_LVL3_KAT0_MSG_HEX, SQISIGN_LVL3_KAT0_PK_HEX, SQISIGN_LVL3_KAT0_SIG_HEX, SQISIGN_LVL3_KAT0_SM_HEX, SQISIGN_LVL5_KAT0_MSG_HEX, SQISIGN_LVL5_KAT0_PK_HEX, SQISIGN_LVL5_KAT0_SIG_HEX, SQISIGN_LVL5_KAT0_SM_HEX, SQISIGN_WEBGPU_VARIANT_LABELS, type SqisignBenchSteps, type SqisignWebGpuSupport, type SqisignWebGpuVariant, benchSqisignWebGpu, getSqisignWebGpuSupport, isSqisignWebGpuAvailable, loadFnDsa1024, loadFnDsa512, loadMlDsa3, loadMlDsa5, loadMlKem1024, loadMlKem512, loadMlKem768, loadSqisignLvl1, loadSqisignLvl1WebGpu, loadSqisignLvl3, loadSqisignLvl3WebGpu, loadSqisignLvl5, loadSqisignLvl5WebGpu, setSqisignAccelWorkerUrl };
|
|
68
104
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/fndsa.ts","../src/mldsa.ts","../src/sqisign.ts","../src/sqisign-kat-lvl1.ts","../src/index.ts"],"mappings":";KAAY,YAAA,MAAkB,CAAA,GAAI,OAAA,CAAQ,CAAA;AAAA,UAEzB,OAAA;EAEhB,GAAA,CAAI,GAAA,iCAAoC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/fndsa.ts","../src/mldsa.ts","../src/sqisign.ts","../src/sqisign-kat-lvl1.ts","../src/sqisign-accel-env.ts","../src/sqisign-webgpu.ts","../src/index.ts"],"mappings":";KAAY,YAAA,MAAkB,CAAA,GAAI,OAAA,CAAQ,CAAA;AAAA,UAEzB,OAAA;EAEhB,GAAA,CAAI,GAAA,iCAAoC,YAAY;AAAA;AAAA,UAGpC,aAAA;EAEhB,GAAA,CAAI,GAAA,4BAA+B,YAAY;AAAA;AAAA,UAG/B,MAAA;EAChB,OAAA,IAAW,OAAA;EACX,OAAA,CAAQ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