SelfBackendVerifier - API Reference

A backend verification class that validates zero-knowledge proofs generated by the Self mobile app.

Constructor

new SelfBackendVerifier(
  scope: string,
  endpoint: string,
  mockPassport: boolean = false,
  allowedIds: Map<AttestationId, boolean>,
  configStorage: IConfigStorage,
  userIdentifierType: UserIdType
)

Parameters

Parameter
Type
Description

scope

string

Your application's unique identifier. Must match the scope used in SelfAppBuilder. Max 30 characters.

endpoint

string

Your backend verification endpoint URL. Must be publicly accessible and match your frontend configuration.

mockPassport

boolean

false for real documents (mainnet), true for testing with mock documents (testnet). Default: false

allowedIds

Map<AttestationId, boolean>

Map of allowed document types. Key: attestation ID, Value: allowed status

configStorage

IConfigStorage

Configuration storage implementation that determines verification requirements.

userIdentifierType

UserIdType

Type of user identifier: 'uuid' or 'hex' (for blockchain addresses)

Methods

Validates zero-knowledge proofs from the Self mobile app.

Parameters

Parameter
Type
Description

attestationId

AttestationId

Document type identifier (1 = electronic passport, 2 = EU ID card, 3 = Aadhaar)

proof

VcAndDiscloseProof

Zero-knowledge proof object containing cryptographic proof arrays.

pubSignals

BigNumberish[]

Public signals from the zero-knowledge proof

userContextData

string

Hex-encoded string containing user context and configuration data

Return Value

The method returns a VerificationResult object with comprehensive verification details:

The method throws ConfigMismatchError when verification requirements don't match:

Common ConfigMismatch Types:

  • InvalidId - Attestation ID not in allowedIds

  • InvalidScope - Proof was generated for a different application

  • InvalidRoot - Merkle root not found on blockchain

  • InvalidForbiddenCountriesList - Countries don't match configuration

  • InvalidMinimumAge - Age requirement mismatch

  • InvalidTimestamp - Proof timestamp out of valid range (±1 day)

  • ConfigNotFound - Configuration not found in storage

Types

VerificationConfig

VcAndDiscloseProof

AttestationId

Document type identifiers:

  • 1 - Electronic passport

  • 2 - Biometric ID card

  • 3 - Aadhaar

Last updated