npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cymony/cryptomonyjs-opaque

v1.0.0

Published

OPAQUE protocol implementation based on https://github.com/cymony/cryptomony

Downloads

1

Readme

About

This library implements the OPAQUE key exchange protocol using Webassembly.

The implementation is based on Cryptomony

Installation

npm install --save @cymony/cryptomonyjs-opaque

Example Usage

import { Client, Server, initializeWasm } from '@cymony/cryptomonyjs-opaque';

(async () => {
    // Configuration Constants
    const clientPassword = "SuperSecurePassword";
    const clientIdentity = "[email protected]";
    const serverID = "example.com";
    const suiteName = "Ristretto255Suite";
    const credentialID = "UniqueCredIdentifier";

    //// Initialization Part
    console.log("*".repeat(10) + " Initialization Part " + "*".repeat(10));

    // run wasm / initialize wasm
    await initializeWasm().then(() => {
        console.log("Wasm initialized !!");
    });

    // create new client
    const client = new Client();
    console.log("New client created !!");

    // create new server
    const server = new Server();
    console.log("New server created !!");

    // check client initialized
    await client.isInitialized().then((result) => {
        console.log("client.isInitialized Result: ", result);
    });

    // initialize client / load configuration
    await client
        .initClient({
            suiteName: suiteName,
            serverID: serverID,
        })
        .then(() => {
            console.log("Client initialized !!");
        });

    // check client initialized
    await client.isInitialized().then((result) => {
        console.log("client.isInitialized Result: ", result);
    });

    // check server initialized
    await server.isInitialized().then((result) => {
        console.log("server.isInitialized Result: ", result);
    });

    // initialize server / load configuration
    await server
        .initServer({
            suiteName: suiteName,
            serverID: serverID,
        })
        .then(() => {
            console.log("Server initialized !!");
        });

    // check server initialized
    await server.isInitialized().then((result) => {
        console.log("server.isInitialized Result: ", result);
    });

    //// Registration Part
    console.log("*".repeat(10) + " Registration Part " + "*".repeat(10));

    // client registration init
    const { registrationState: clRegistrationState, registrationRequest } =
        await client.registrationInit(clientPassword).then((obj) => {
            console.log("RegistrationState: ", obj.registrationState);
            console.log("RegistrationRequest: ", obj.registrationRequest);
            return obj;
        });

    // server generate oprf key
    const oprfSeed = await server.generateOprfSeed().then((seed) => {
        console.log("Generated oprf seed: ", seed);
        return seed;
    });

    // server registration evulation
    const registrationResponse = await server
        .registrationEval(registrationRequest, oprfSeed, credentialID)
        .then((registrationResponse) => {
            console.log("Registration Response: ", registrationResponse);
            return registrationResponse;
        });

    // client registration finalize
    const { registrationRecord, exportKey: registrationExportKey } =
        await client
            .registrationFinalize(
                clRegistrationState,
                registrationResponse,
                clientIdentity
            )
            .then((obj) => {
                console.log("Registration Record: ", obj.registrationRecord);
                console.log("Registration ExportKey: ", obj.exportKey);
                return obj;
            });

    //// Login Part
    console.log("*".repeat(10) + " Login Part " + "*".repeat(10));

    // client login init
    const { loginState: clLoginState, ke1 } = await client
        .loginInit(clientPassword)
        .then((obj) => {
            console.log("Client Login State: ", obj.loginState);
            console.log("KE1: ", obj.ke1);
            return obj;
        });

    // server login init
    const { loginState: svLoginState, ke2 } = await server
        .loginInit(
            registrationRecord,
            ke1,
            oprfSeed,
            credentialID,
            clientIdentity
        )
        .then((obj) => {
            console.log("Server Login State: ", obj.loginState);
            console.log("KE2: ", obj.ke2);
            return obj;
        });

    // client login finish
    const {
        exportKey: loginExportKey,
        sessionKey: clSessionKey,
        ke3,
    } = await client
        .loginFinish(clLoginState, ke2, clientIdentity)
        .then((obj) => {
            console.log("Client Session Key: ", obj.sessionKey);
            console.log("Login Export Key: ", obj.exportKey);
            console.log("KE3: ", obj.ke3);
            return obj;
        });

    // server login finish
    const svSessionKey = await server
        .loginFinish(svLoginState, ke3)
        .then((svSessionKey) => {
            console.log("Server Session Key:", svSessionKey);
            return svSessionKey;
        });

    console.log("*".repeat(10) + " Equality Part " + "*".repeat(10));
    console.log(
        "Is Session Keys Equal: ",
        JSON.stringify(svSessionKey) === JSON.stringify(clSessionKey)
    );
    console.log(
        "Is Registration and Login Export Keys Equal: ",
        JSON.stringify(registrationExportKey) ===
        JSON.stringify(loginExportKey)
    );
})();

License

This project is licensed under the BSD 3-Clause