Identity Verification (IDV)
Web3 Identity Made Simple
Think of IDV like OAuth for web3 - a familiar redirect flow that handles all the complexity of web3 identity 🔗. Just redirect your users to Royal, and we’ll handle everything: wallet setup, account creation 🔗, and delegation 🔗. When they return to your app, you’ll receive a verifiable identity token - use it to store the users Royal ID and you’re done!
Flow Overview
Loading graph...
sequenceDiagram participant App as Your App participant User participant Royal Note over App,Royal: One-time Setup Flow App->>User: Redirect to Royal IDV User->>Royal: Arrives at Royal rect rgb(240, 240, 240) Note over Royal: Royal Handles All Complexity Royal->>Royal: Check/Setup Wallet Royal->>Royal: Create/Verify Account Royal->>Royal: Setup Delegation end Royal->>User: Redirect back to app User->>App: Return with identity token Note over App: Store Royal ID Note over App,Royal: All Future Operations App->>Royal: Use stored Royal ID
Implementation Guide
1. Redirect Users to IDV
Construct the IDV URL with your registrar username (e.g., “yourApp”):
URL Parameters
redirect_uri
: (Required) Must match one of your registered redirect URLsstate
: (Recommended) Session validation value, returned unchangedresponse_type
: (Optional) Currently only supports “token”scope
: (Optional) Returned unchanged in callback
2. Handle the Callback
Users return to your redirect_uri
with the following query parameters:
token
: JWT containing identity informationstate
: Your original state parameterdelegated
: “true” if delegation was successful
3. Token Verification
Get Royal’s public key from the well-known endpoint:
The library we use in this example for JWT, jsonwebtoken
🔗, expects to get the public key in PEM format, not JSON.
You can use an online calculator 🔗 to get the PEM version.
Token Structure
The verified token contains: