@noisytransfer/noisyauth
Authentication state machines for establishing a NoisyTransfer session.
@noisytransfer/noisyauth
Currently everything is under heavy development and in a very early alpha stage. APIs are thus unstable and can change without notice.
Small state machines to mutually authenticate peers, exchange public materials (HPKE key and signature verification key), and derive the session needed before streaming. The implementation is based on my work on the formal modelling of bootstrapping a secure message transfer out of a short authentication string and an authenticated out-of-band channel. I have written a small post discussing this approach. You can find the according eprint here.
Install
npm i @noisytransfer/noisyauth
Exports (v0.2.x)
createAuthSender(tx, hooks?, opts?)
createAuthReceiver(tx, hooks?, opts?)
tx
is an ordered transport interface ({ send, onMessage }
). Hooks let you surface SAS (short authentication string) to users and confirm it before proceeding.
Example shape
import { createAuthSender, createAuthReceiver } from "@noisytransfer/noisyauth";
const receiver = createAuthReceiver(txB, {
onSAS: showSAS, // display SAS to user
waitConfirm: confirmSAS, // wait for user confirmation
onDone: ({ msgS }) => savePeerBundle(msgS), // store peer materials
}, { session: { policy: "rtc", sessionId }, recvMsg: hpkePubBytes });
const sender = createAuthSender(txA, {
onSAS: showSAS,
waitConfirm: confirmSAS,
onDone: ({ msgR }) => savePeerBundle(msgR),
}, { session: { policy: "rtc", sessionId }, sendMsg: verificationKey });