Skip to main content

Overview

The OriginsClient manages identity origins and handles user registration. Origins represent entry points for identities - organizations, blockchains, or authentication providers that can hold a set of identities.
import { SDK } from '@bloque/sdk';

const bloque = new SDK({
  origin: 'your-origin',
  auth: {
    type: 'apiKey',
    apiKey: 'your-api-key'
  },
  mode: 'production'
});

const session = await bloque.connect('[email protected]');
const origins = session.identity.origins;

Properties

whatsapp

whatsapp
OriginClient<OTPAssertionWhatsApp>
Pre-configured client for WhatsApp-based identity verification
const assertion = await bloque.identity.origins.whatsapp.assert('+1234567890');

email

email
OriginClient<OTPAssertionEmail>
Pre-configured client for email-based identity verification
const assertion = await bloque.identity.origins.email.assert('[email protected]');

Methods

list()

Retrieve all available origins with their current status. Origins are the entry points for user identities and represent organizations, startups, chains, or any entity that can hold a set of identities.
const origins = await bloque.identity.origins.list();

// Filter active origins
const activeOrigins = origins.filter(o => o.status === 'active');

// Find specific provider origins
const evmOrigins = origins.filter(o => o.provider === 'evm');

Returns

Array of origin objects:
namespace
string
required
Unique namespace identifier for the originExamples: "ethereum-mainnet", "bloque-whatsapp", "bloque-api"
provider
string
required
Provider type for the originPossible values:
  • "evm" - Ethereum and EVM-compatible chains
  • "auth0" - Auth0 authentication
  • "whatsapp" - WhatsApp verification
  • "email" - Email verification
  • "api-key" - API key authentication
status
'active' | 'inactive' | 'disabled'
required
Current operational status of the origin
metadata
Record<string, unknown>
required
Additional metadata for the origin
created_at
string
required
ISO 8601 timestamp when the origin was created
updated_at
string
required
ISO 8601 timestamp when the origin was last updated

custom()

Create a client for a custom origin namespace.
const customOrigin = bloque.identity.origins.custom('my-custom-origin');
const assertion = await customOrigin.assert('user-alias');

Parameters

origin
string
required
The namespace of the custom origin to use

Returns

Returns an OriginClient<OTPAssertion> instance for the specified origin.

register()

Register a new user or business identity to a specific origin. Creates a new identity by verifying the assertion result (challenge response) and storing the profile information. Supports both:
  • Individual users (KYC): Personal identity verification
  • Business entities (KYB): Business identity verification
Different origins support different challenge types:
  • SIGNING_CHALLENGE - Blockchain signature verification (Ethereum, Solana)
  • API_KEY - Traditional API key authentication
  • OAUTH_REDIRECT - OAuth-based authentication flows
  • WEBAUTHN - WebAuthn/passkey authentication
  • OTP - One-time password verification
  • PASSWORD - Password-based authentication
// Register individual user with blockchain signature (KYC)
const individual = await bloque.identity.origins.register(
  '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
  'ethereum-mainnet',
  {
    assertionResult: {
      alias: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
      challengeType: 'SIGNING_CHALLENGE',
      value: {
        signature: '0x1234567890abcdef...',
        alias: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6'
      },
      originalChallengeParams: {
        challenge: 'bloque-challenge-1234567890',
        timestamp: 1640995200
      }
    },
    type: 'individual',
    profile: {
      firstName: 'John',
      lastName: 'Doe',
      email: '[email protected]',
      phone: '+1234567890',
      birthdate: '1990-01-15',
      city: 'New York',
      state: 'NY',
      postalCode: '10001',
      countryOfBirthCode: 'USA',
      countryOfResidenceCode: 'USA'
    }
  }
);

// Access token for authenticated session
console.log(individual.accessToken);

Parameters

alias
string
required
The unique alias for the identity (e.g., blockchain address, email, phone)
origin
string
required
The origin namespace to register the identity toExamples: "ethereum-mainnet", "bloque-api", "bloque-whatsapp"
params
RegisterParams
required
Registration parameters including assertion result and profile

Returns

accessToken
string
required
JWT access token for the registered identity. Use this token for authenticated API requests.

Example: Business Registration

const business = await bloque.identity.origins.register(
  'business-123',
  'bloque-api',
  {
    assertionResult: {
      alias: 'business-123',
      challengeType: 'API_KEY',
      value: {
        apiKey: 'sk_live_abc123def456',
        alias: 'business-123'
      }
    },
    type: 'business',
    profile: {
      legalName: 'Acme Corporation',
      name: 'Acme Corp',
      taxId: '12-3456789',
      type: 'LLC',
      incorporationDate: '2020-01-15',
      addressLine1: '123 Business St',
      city: 'New York',
      state: 'NY',
      postalCode: '10001',
      country: 'United States',
      email: '[email protected]',
      phone: '+1-555-0123',
      ownerName: 'Jane Smith',
      ownerIdType: 'SSN',
      ownerIdNumber: '123-45-6789'
    }
  }
);

console.log(business.accessToken); // JWT token

Build docs developers (and LLMs) love