Components / Signer Flow with secure elements

Embedded signing

Signer Flow with secure elements

The signer's steps in your own UI, around three small frames from the signing server: identity, document, and consent with Sign.

  • @signnative/ui
  • MIT
  • Client only · mock server here
  • Prototype · ADR 0033 proposed

A prototype for ADR 0033 (proposed). No signing server serves secure elements yet, so every example here runs against a mock server in your browser, with a synthetic document. Nothing is sent and nothing is signed.

Your code cannot verify, consent or sign: those happen only inside the frames, on a press by the person. The flow reads the outcome back from the server before it says “signed”.

Theme
The CSS variables this sets
:root {
  --signing-accent: #3157e8;
  --sig-accent: #3157e8;
  --sig-accent-soft: color-mix(in oklab, #3157e8 14%, white);
  --sig-radius: 8px;
  --radius-control: 8px;
  --radius-panel: 12px;
  --font-sans: var(--font-inter), ui-sans-serif, system-ui, sans-serif;
}

In the signer page kit, set the accent with accentProps(accent) on the element around the surface; it sets data-signing-accent and --signing-accent. The secure elements take the same values as a checked appearance object instead.

Email code

The code is typed into the identity frame only. The mock accepts 123456; no email is sent.

Loading the document…

Mock server: waiting for the person.

Elements in your theme

The frames take a short list of named, checked values instead of CSS. This one follows the Theme control above.

Loading the document…

Mock server: waiting for the person.

One secure element

SecureElement on its own: a frame the host places and sizes, and hears events from. Here the document element.

Loading the element…

Error: an address that is not allowed

Elements load only from https, or http on localhost. Anything else shows an error and no frame.

Installation

npx shadcn@latest add …

Not published yet

Not in the registry (packages/ui/registry.json) yet.

API

className and children are left out: every component that takes them passes them on.

SignerFlow

NameTypeDefaultDescription
adapterElementsSignerAdapterYour connection to a signing server: getView, saveDraft and element. No sign, verify or consent.
onSigned() => voidCalled after the server's view says the person signed.
onDeclined() => voidCalled after the server's view says the person declined.
labelsPartial<SignerFlowLabels>EnglishEvery text, for translation.
headingLevel2 | 32Level of the envelope title.

SecureElement

NameTypeDefaultDescription
element"identity" | "document" | "consent"Which element. Each has a minimum size and refuses its actions when smaller.
sourceSecureElementSource{ kind: "url", origin, url } from a signing server, or { kind: "mock", html } for demos and tests.
instancestringUnique per mounted frame. Messages for another instance are ignored.
titlestringThe frame's accessible name.
onEvent(event: ElementEvent) => voidAccepted events only: ready, height, verified, viewed, signed, declined, error.

createMockElementsAdapter

NameTypeDefaultDescription
verification"sender_link" | "email_otp""sender_link"How the signer shows who they are.
frames"url" | "srcdoc""url"srcdoc: small pages in sandboxed frames, for demos. url: made-up addresses, for tests.
appearanceElementAppearance{}Named, checked style values for the elements: accent, radius, fontFamily and more.
codestring"123456"email_otp: the code the mock accepts. Never a real code.
titlestring"Synthetic NDA (test)"Envelope title.
fieldsSignerField[]Fields to fill in. Default: one required text field.

Accessibility

  • Each frame has an accessible name (title). Inside a frame, the element's own page handles focus and labels.
  • The flow sets aria-busy while it loads, saves and confirms, and announces the outcome in a status line.