Skip to main content
The package has two entry points: a browser entry point that opens the widget, and a server entry point that signs access tokens. This page covers version 0.1.1. The types come straight from the SDK’s published typings. Both entry points ship as ESM and CommonJS, with TypeScript declarations.

kyi()

Opens the widget and returns a handle to it.
Calling kyi() does the following:
  1. It injects one <style id="bluprynt-kyi-styles"> element into <head>, once per page.
  2. It appends a backdrop and a drawer (role="dialog", aria-modal="true") to <body>.
  3. It loads https://app.bluprynt.com/widget/<scope>?token=<accessToken>&embed=true in an iframe inside the drawer.

Scopes

See every screen in Verification flow.

Callbacks

The SDK only passes on messages that come from a bluprynt.com origin and from its own iframe. Messages from anything else are ignored.

KYIWidget

Drawer behavior

Don’t restyle these classes beyond z-index fixes. They aren’t a versioned API and can change between releases.

generateToken()

Signs a short-lived access token for one of your members. Server only.
The result is a compact JWT signed with HS256:
Header
Payload
iat is the signing time and exp is iat + expiresIn, both in Unix seconds. The values above are an example. To sign tokens in another language, see Access tokens.

Errors

All errors are thrown synchronously from kyi(), or rejected from generateToken(), as plain Error objects. Problems the SDK can’t detect, such as an origin that isn’t allowlisted, a wrong partner ID or an expired token, show up inside the drawer. See Errors and troubleshooting.

TypeScript types

The source and typings also accept a 'modal' mode. Bluprynt’s official SDK docs cover only drawer, so treat modal as unsupported.