Skip to main content
This example comes from the Compliance Explorer integration (BLU-4627). An asset page that no issuer has claimed shows a Claim this profile button. The button opens the KYI drawer, so the issuer can verify and claim the asset without leaving Explorer.
This integration is in review and isn’t live on explorer.bluprynt.com yet. The code below is the reviewed implementation, shortened. Use it as a template for your own app.

What it does

1. Configuration

The partner credentials are server-only environment variables. If either one is missing, the drawer is off and the page keeps its previous claim flow, so a missing configuration never breaks the page.
features/kyi-drawer/model/config.ts

2. The token handler

The handler is plain TypeScript with its dependencies passed in, so you can unit-test it without Next.js. sub is the signed-in researcher’s stable account ID from the session cookie. It never comes from the request.
features/kyi-drawer/api/token-handler.ts

3. The route

app/api/kyi/token/route.ts

Responses

Every response carries cache-control: no-store. A token is a bearer credential for one member’s verification, so no browser, CDN or proxy may cache it or serve it to someone else.

4. Open the drawer from the browser

The SDK loads on first click with a dynamic import(), so it adds nothing to the page’s initial bundle.
features/kyi-drawer/model/open-drawer.ts

5. A React hook

The hook makes sure only one drawer is ever open, retries once after sign-in, and destroys the drawer when the component unmounts.
features/kyi-drawer/ui/use-kyi-drawer.ts
Claim button

Things to note

  • No prefill. SDK 0.1.1 has no option to pass a chain or contract address, so the issuer pastes the token address into the drawer themselves, even when they start from that asset’s page.
  • Several buttons, one drawer. Explorer shows a claim link in the asset header and a claim banner. Both send an in-page CustomEvent (explorer:asset-claim-request) to one component that owns the drawer, so two clicks never open two drawers.
  • Tests. The handler takes config, resolveResearcher and sign as parameters, so all four responses can be unit-tested without network calls or real keys.
  • Origins. Every origin that renders the button, including staging and local development, has to be on the allow-list.
Related: Access tokens · API reference · Compliance Explorer