WebAssembly wrapper for facebook/opaque-ke (client-side)
npm install @squirrelchat/opaque-wasm-clientWrapper 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:
- OPRF: ristretto255-SHA512
- KDF: HKDF-SHA-512
- MAC: HMAC-SHA-512
- Hash: SHA-512
- KSF: Argon2id(S = zeroes(16), p = 4, T = Nh, m = 2^16, t = 3, v = 0x13, K = nil, X = nil, y = 2)
- Group: ristretto255
vite-plugin-wasm--experimental-wasm-modules flag```
npm i @squirrelchat/opaque-wasm-client
yarn add @squirrelchat/opaque-wasm-client
pnpm add @squirrelchat/opaque-wasm-client
js
import { startRegistration } from '@squirrelchat/opaque-wasm-client'try {
const registration = startRegistration('mewn supy€w sekyuwe paffw0wdy! UwU')
console.log(registration.request) //
// ~> send this to the server
const response = ... // <~ response from the server
const { exportKey, serverPublicKey, record } = registration.finish(response)
console.log(record) //
// ~> send this to the server
console.log('export key:', exportKey) //
console.log('server public key:', serverPublicKey) //
} catch (e) {
console.error('Registration failed!', e)
}
`$3
`js
import { startLogin } from '@squirrelchat/opaque-wasm-client'try {
const login = startLogin('mewn supy€w sekyuwe paffw0wdy! UwU')
console.log(login.request) //
// ~> send this to the server
const response = ... // <~ response from the server
const { exportKey, sessionKey, serverPublicKey, message } = registration.finish(response)
console.log(record) //
// ~> send this to the server
console.log('export key:', exportKey)
console.log('session key:', sessionKey)
console.log('server public key:', serverPublicKey)
} catch (e) {
console.error('Login failed!', e)
}
``