@vexahub/opaque-server
v0.1.0-alpha.1
Published
OPAQUE (RFC 9807) server (WASM)
Downloads
279
Maintainers
Readme
@vexahub/opaque-server
OPAQUE (RFC 9807) server library for Node.js. Built in Rust, compiled to WASM.
Part of the @vexahub/opaque project.
Install
npm install @vexahub/opaque-serverServer Setup
Generate a one-time server setup string. Store it securely (e.g. environment variable), never commit to git.
import { createSetup } from '@vexahub/opaque-server';
const serverSetup = createSetup();
// Store in OPAQUE_SERVER_SETUP env varChanging
serverSetupinvalidates all existing user accounts.
CLI
Generate a server setup or extract the public key directly from the command line:
npx @vexahub/opaque-server create-server-setup
npx @vexahub/opaque-server get-server-pubkey <SERVER_SETUP>Usage
import {
createSetup,
getPublicKey,
createRegistrationResponse,
startLogin,
finishLogin,
} from '@vexahub/opaque-server';
// Registration
const { registrationResponse } = createRegistrationResponse({
serverSetup,
userIdentifier: '[email protected]',
registrationRequest, // from client
});
// Login
const { loginResponse, serverLoginState } = startLogin({
serverSetup,
userIdentifier: '[email protected]',
registrationRecord, // stored at registration
startLoginRequest, // from client
});
// ... send loginResponse to client, receive finishLoginRequest ...
const { sessionKey } = finishLogin({
serverLoginState,
finishLoginRequest,
});Server Static Public Key
Extract the public key for client-side pinning:
const publicKey = getPublicKey(serverSetup);
// Hardcode this in your client buildsRelated packages
| Package | Description |
|----------------------------------------------------------------------------------|--------------------------|
| @vexahub/opaque | Client + server combined |
| @vexahub/opaque-client | Client only |
License
This package is dual-licensed under the MIT License or Apache-2.0 License.
