Nighttime Peanut Migrations

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

    3.2.5 • Public • Published

    rlwe

    Note

    This package is no longer recommended. The underlying implementation is unmaintained, meanwhile more robust alternatives have been developed. Instead prefer Kyber, a NIST PQC winner that has been selected for standardization. An implementation of Kyber is provided by kyber-crystals.


    Overview

    The RLWE post-quantum asymmetric cypher compiled to WebAssembly using Emscripten. The specific implementation in use is from Microsoft Research. A simple JavaScript wrapper is provided to make RLWE easy to use in web applications.

    The parameters are configured to 128-bit strength. (More specifically, the security level is 128 quantum bits and 128 classical bits.)

    Example Usage

    import {rlwe} from 'rlwe';
    
    const aliceKeyPair /*: {privateKey: Uint8Array; publicKey: Uint8Array} */ =
    	await rlwe.aliceKeyPair()
    ;
    
    const bob /*: {publicKey: Uint8Array; secret: Uint8Array} */ =
    	await rlwe.bobSecret(aliceKeyPair.publicKey)
    ;
    
    const aliceSecret /*: Uint8Array */ =
    	await rlwe.aliceSecret(bob.publicKey, aliceKeyPair.privateKey) // equal to bob.secret
    ;
    
    console.log(aliceKeyPair);
    console.log(bob);
    console.log(aliceSecret);
    

    Note: This library only handles generating shared secrets; you'll need to handle key derivation and symmetric encryption from there.

    Changelog

    Breaking changes in major versions:

    3.0.0:

    • As part of upgrading from asm.js to WebAssembly (with asm.js included as a fallback), the API is fully asynchronous.

    2.0.0:

    • Removed some undocumented functions as part of minor API cleanup.

    Install

    npm i rlwe

    DownloadsWeekly Downloads

    30

    Version

    3.2.5

    License

    MIT

    Unpacked Size

    109 kB

    Total Files

    9

    Last publish

    Collaborators

    • cyphinc