Skip to content

An implementation of the OPAQUE key exchange protocol in WASM

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT
Notifications You must be signed in to change notification settings

marucjmar/opaque-wasm

Repository files navigation

Important: This project is not maintained anymore. If you are looking for an alternative please check out github.com/serenity-kit/opaque.

Build Status

opaque-wasm

An implementation of the OPAQUE key exchange protocol in WASM(WebAssembly). This implementation is based on the opaque-ke.

Installation

npm install --save opaque-wasm
yarn add opaque-wasm

JS simple example of usage

Check full implementation in this file

import { Registration, Login } from "opaque-wasm";

const password = "asdf123";
const email = "[email protected]";

try {
  const registration = new Registration();
  const firstMessage = registration.start(password);
  const secondMessage = await sendMessageToServer(firstMessage);
  const thirdMessage = registration.finish(password, secondMessage);
  const { status } = await sendMessageToServer(thirdMessage, { email });

  console.log(status); // 204 - Server Return ok, user account has been created

  const login = new Login();
  const firstLoginMessage = login.start(password);
  const secondLoginMessage = await sendMessageToServer(firstLoginMessage, email);
  const thirdLoginMessage = login.finish(password, secondLoginMessage);
  const sessionKey = login.getSessionKey();
  await sendMessageToServer(thirdLoginMessage);

  console.log(sessionKey); // eyhojo55....
} catch (e) {
  console.error(e);
}

Build ES6 package

wasm-pack build

Build for NodeJs

wasm-pack build --target nodejs

About

An implementation of the OPAQUE key exchange protocol in WASM

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT

Stars

Watchers

Forks

Packages

No packages published