falcon-crypto
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

falcon-crypto

Overview

The Falcon post-quantum cryptographic signing scheme compiled to WebAssembly using Emscripten. A simple JavaScript wrapper is provided to make Falcon easy to use in Web applications.

N.B. Unless interoperability with other Falcon implementations is a hard requirement, it is recommended to use superfalcon instead.

Example Usage

import {falcon} from 'falcon-crypto';

const keyPair /*: {privateKey: Uint8Array; publicKey: Uint8Array} */ =
	await falcon.keyPair()
;

const message /*: Uint8Array */ =
	new Uint8Array([104, 101, 108, 108, 111, 0]) // "hello"
;

/* Combined signatures */

const signed /*: Uint8Array */ =
	await falcon.sign(message, keyPair.privateKey)
;

const verified /*: Uint8Array */ =
	await falcon.open(signed, keyPair.publicKey) // same as message
;

/* Detached signatures */

const signature /*: Uint8Array */ =
	await falcon.signDetached(message, keyPair.privateKey)
;

const isValid /*: boolean */ =
	await falcon.verifyDetached(signature, message, keyPair.publicKey) // true
;

console.log(keyPair);
console.log(message);
console.log(signed);
console.log(verified);
console.log(signature);
console.log(isValid);

Dependents (2)

Package Sidebar

Install

npm i falcon-crypto

Weekly Downloads

8

Version

1.0.6

License

MIT

Unpacked Size

259 kB

Total Files

9

Last publish

Collaborators

  • cyphinc