🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

epolite

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

epolite - npm Package Compare versions

Comparing version

to
0.2.0

2

package.json

@@ -17,3 +17,3 @@ {

},
"version": "0.1.0",
"version": "0.2.0",
"description": "A public-private key library for post-quantum cryptography (early stage, use with caution)",

@@ -20,0 +20,0 @@ "bugs": {

@@ -41,4 +41,4 @@ export type KeyPair = {

*
* @returns Whether the signature is valid.
* @returns The signed message, or null if invalid.
*/
export declare function verify(signature: string, publicKey: string): Promise<boolean>;
export declare function verify(signature: string, publicKey: string): Promise<{message: string} | null>;

@@ -227,5 +227,5 @@ import { ml_kem512 } from "@noble/post-quantum/ml-kem";

*
* @returns Whether the signature is valid.
* @returns The signed message, or null if invalid.
*/
export async function verify(signature: string, publicKey: string): Promise<boolean> {
export async function verify(signature: string, publicKey: string): Promise<{message: string} | null> {
//extract and decode the public key

@@ -245,9 +245,11 @@ const publicKeyEncoded = publicKey

const message = new TextEncoder().encode(JSON.parse(Buffer.from(signature, "base64").toString("utf-8")).raw);
const signatureArray = new Uint8Array(Buffer.from(JSON.parse(Buffer.from(signature, "base64").toString("utf-8")).sig, "base64"));
const jp = JSON.parse(Buffer.from(signature, "base64").toString("utf-8"));
const message = new TextEncoder().encode(jp.raw);
const signatureArray = new Uint8Array(Buffer.from(jp.sig, "base64"));
const isValid = await sign.verify(signatureArray, message, falconPublicKey);
return isValid;
return isValid ? {message: jp.raw} : null;
}