package
WebAssembly wrapper for facebook/opaque-ke (client-side)
npm install @squirrelchat/opaque-wasm-clientGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Estimated unpacked size across 1 packages.
140.6 kB
Includes dependencies.
Wrapper for opaque-ke to implement the OPAQUE protocol in JavaScript/WASM.
This library uses the following OPAQUE configuration, based on the recommendations of the OPAQUE draft and the Argon2 RFC:
The client requires an environment compatible with WebAssembly ESM. For example,
vite-plugin-wasm--experimental-wasm-modules flagnpm i @squirrelchat/opaque-wasm-client
yarn add @squirrelchat/opaque-wasm-client
pnpm add @squirrelchat/opaque-wasm-clientimport { startRegistration } from '@squirrelchat/opaque-wasm-client'
try {
const registration = startRegistration('mewn supy€w sekyuwe paffw0wdy! UwU')
console.log(registration.request) // <Uint8Array ...>
// ~> send this to the server
const response = ... // <~ response from the server
const { exportKey, serverPublicKey, record } = registration.finish(response)
console.log(record) // <Uint8Array ...>
// ~> send this to the server
console.log('export key:', exportKey) // <Uint8Array ...>
console.log('server public key:', serverPublicKey) // <Uint8Array ...>
} catch (e) {
import { startLogin } from '@squirrelchat/opaque-wasm-client'
try {
const login = startLogin('mewn supy€w sekyuwe paffw0wdy! UwU')
console.log(login.request) // <Uint8Array ...>
// ~> send this to the server
const response = ... // <~ response from the server
const { exportKey, sessionKey, serverPublicKey, message } = registration.finish(response)
console.log(record) // <Uint8Array ...>
// ~> send this to the server
console.log('export key:', exportKey)
console.log('session key:', sessionKey)
console.log('server public key:', serverPublicKey)