Skip to main content

Function Signature

function checkIdentityStatus(
  walletAddress: string
): Promise<Response>;
walletAddress
string
required
Valid Solana wallet address (Base58 format) to check verification status for.
Promise
Promise<[Response](/sdk-reference/types#checkidentitystatus-response)>
A promise that resolves with the current identity verification session data.
Type Definitions: For detailed type information including all properties and their descriptions, visit the Types page.

Usage

import { TrustEngineSDK } from '@trust-engine/sdk';
import { useState, useEffect } from 'react';

const sdk = new TrustEngineSDK();

export default function IdentityStatusChecker() {
  const [walletAddress, setWalletAddress] = useState('');
  const [status, setStatus] = useState<any | null>(null);
  const [isLoading, setIsLoading] = useState(false);

  const checkStatus = async () => {
    if (!walletAddress) return;
    setIsLoading(true);
    try {
      const statusResult = await sdk.checkIdentityStatus(walletAddress);
      setStatus(statusResult);
    } catch (error) {
      console.error('❌ Failed to check status:', error.message);
      setStatus(null);
    } finally {
      setIsLoading(false);
    }
  };

  // Poll for status updates every 30 seconds for pending verifications
  useEffect(() => {
    if (status?.details?.status === 'pending') {
      const interval = setInterval(checkStatus, 30000);
      return () => clearInterval(interval);
    }
  }, [status?.details?.status]);

  return (
    <div>
      <input 
        type="text" 
        placeholder="Enter wallet address"
        value={walletAddress}
        onChange={(e) => setWalletAddress(e.target.value)}
      />
      <button onClick={checkStatus} disabled={!walletAddress || isLoading}>
        {isLoading ? 'Checking...' : 'Check Status'}
      </button>
      
      {status && (
        <div>
          <h3>Status: {status.details.status}</h3>
          <p>Created: {new Date(status.details.createdAt).toLocaleString()}</p>
          <p>Expires: {new Date(status.details.expiresAt).toLocaleString()}</p>
          
          {status.details.status === 'verified' && status.details.verifiedData && (
            <div>
              <h4>Verified Data:</h4>
              <pre>{JSON.stringify(status.details.verifiedData, null, 2)}</pre>
            </div>
          )}
          
          {status.details.status === 'pending' && (
            <p>⏳ Verification pending... Status will refresh automatically.</p>
          )}
        </div>
      )}
    </div>
  );
}

Response Patterns

Pending Session

When a verification session exists but hasn’t been completed yet:
{
  message: "Identity verification session retrieved successfully",
  details: {
    walletAddress: "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    status: "pending",
    createdAt: "2024-01-15T10:30:00.000Z",
    expiresAt: "2024-01-16T10:30:00.000Z",
    verifiedAt: null,
    requestedDisclosures: {
      name: true,
      nationality: true,
      date_of_birth: true,
      issuing_state: false,
      passport_number: false,
      gender: false,
      expiry_date: false
    },
    verifiedData: null
  }
}

Verified Session

When identity verification has been completed successfully:
{
  message: "Identity verification session retrieved successfully",
  details: {
    walletAddress: "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    status: "verified",
    createdAt: "2024-01-15T10:30:00.000Z",
    expiresAt: "2024-01-16T10:30:00.000Z",
    verifiedAt: "2024-01-15T11:15:30.000Z",
    requestedDisclosures: {
      name: true,
      nationality: true,
      date_of_birth: true,
      issuing_state: false,
      passport_number: false,
      gender: false,
      expiry_date: false
    },
    verifiedData: {
      verified_name: "John Doe",
      verified_nationality: "USA",
      verified_date_of_birth: "1990-05-15",
      verified_passport_number: null,
      verified_gender: null,
      verified_issuing_state: null,
      verified_expiry_date: null,
      self_user_id: "0x7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
    }
  }
}

Status Meanings

The verification session has been created but the user has not yet completed identity verification using the Self.xyz app. The session is still active and can be completed.
The user has successfully completed identity verification. The verifiedData object will contain the actual verified identity information that was requested.
The identity verification failed due to invalid documents, failed verification checks, or other Self.xyz validation issues.
The verification session expired (after 24 hours) before the user completed verification. A new session must be created to attempt verification again.

Integration Tips

Polling Strategy: For real-time status updates, poll this method periodically (every 30-60 seconds) while verification is pending.
Data Privacy: Verified data is only returned when the session status is ‘verified’. All other statuses return verifiedData: null.
Session Lifecycle: Sessions expire after 24 hours. Check the expiresAt timestamp to determine if a new verification session needs to be created.
I