@persona/relay
v0.1.4
Published
The official JavaScript client library for the Persona Relay flow
Readme
Persona Relay Client SDK
The official JavaScript client library for the Persona Relay flow.
Install
npm install @persona/relay
# or
yarn add @persona/relayQuick start
import Relay from '@persona/relay';
const container = document.getElementById('relay-container')!;
const relay = new Relay(container, {
accessToken: '<relay session access token>',
theme: 'auto', // 'light' | 'dark' | 'auto'
onComplete: () => console.log('verification complete'),
onError: (error) => console.error('relay error', error),
onExpire: () => console.warn('session expired'),
});
// when you're done with the widget:
relay.destroy();The accessToken is a short-lived JWT issued by your server when it creates a Relay session via
Persona's API. See RelayOptions and RelayError in the bundled type definitions for the full
surface.
