Skip to main content

Overview

The AliasesClient allows you to retrieve and manage aliases associated with identities. Aliases are alternative identifiers like phone numbers, email addresses, or blockchain addresses that can be used to look up an identity.
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 aliases = session.identity.aliases;

Methods

get()

Retrieve detailed information about a specific alias.
const alias = await bloque.identity.aliases.get('+1234567890');
console.log(alias.urn); // Identity URN
console.log(alias.type); // "phone"
console.log(alias.status); // "active"

Parameters

alias
string
required
The alias to look up (phone number, email address, or other identifier)Examples:
  • Phone: "+1234567890"
  • Email: "[email protected]"
  • Blockchain: "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6"

Returns

id
string
required
Unique identifier for this alias record
alias
string
required
The alias value (phone number, email, etc.)
type
string
required
Type of aliasCommon values:
  • "phone" - Phone number
  • "email" - Email address
  • Custom types for other identifiers
urn
string
required
URN of the identity associated with this alias
origin
string
required
Origin namespace where this alias was registered
status
'active' | 'inactive' | 'revoked'
required
Current status of the alias
  • active - Alias is valid and can be used
  • inactive - Alias is temporarily disabled
  • revoked - Alias has been permanently revoked
is_public
boolean
required
Whether this alias is publicly visible
is_primary
boolean
required
Whether this is the primary alias for the identity
details
object
required
Additional details specific to the alias type
metadata
object
required
Metadata associated with the alias
created_at
string
required
ISO 8601 timestamp when the alias was created
updated_at
string
required
ISO 8601 timestamp when the alias was last updated

Example Response

{
  "id": "alias_abc123",
  "alias": "+1234567890",
  "type": "phone",
  "urn": "did:bloque:origin:whatsapp:+1234567890",
  "origin": "bloque-whatsapp",
  "status": "active",
  "is_public": true,
  "is_primary": true,
  "details": {
    "phone": "+1 (234) 567-890"
  },
  "metadata": {
    "alias": "+1234567890"
  },
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Use Cases

Lookup User by Phone

try {
  const alias = await bloque.identity.aliases.get('+1234567890');
  console.log(`Found user: ${alias.urn}`);
  console.log(`Status: ${alias.status}`);
} catch (error) {
  console.error('Alias not found');
}

Verify Email Alias

const emailAlias = await bloque.identity.aliases.get('[email protected]');

if (emailAlias.status === 'active' && emailAlias.is_primary) {
  console.log('Primary email verified');
}

Check Blockchain Address

const address = '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6';
const blockchainAlias = await bloque.identity.aliases.get(address);

console.log(`Blockchain identity: ${blockchainAlias.urn}`);
console.log(`Origin: ${blockchainAlias.origin}`);

Build docs developers (and LLMs) love