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
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.
Methods
Validates zero-knowledge proofs from the Self mobile app.
Parameters
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 allowedIdsInvalidScope- Proof was generated for a different applicationInvalidRoot- Merkle root not found on blockchainInvalidForbiddenCountriesList- Countries don't match configurationInvalidMinimumAge- Age requirement mismatchInvalidTimestamp- Proof timestamp out of valid range (±1 day)ConfigNotFound- Configuration not found in storage
Types
VerificationConfig
VcAndDiscloseProof
AttestationId
Document type identifiers:
1- Electronic passport2- Biometric ID card3- Aadhaar
Last updated