Verify an Identity
Verify an identity and process the results.
Each Sudo Platform environment is configured to support Secure ID Verification of identities from a specific set of countries. To get a list of supported countries, use the
listSupportedCountries()
method. The results are ISO 3166-1 alpha-2 codes, e.g. US
for the United States.Swift
Kotlin
TypeScript
do {
let countries = try await identityVerificationClient.listSupportedCountries()
} catch let error {
// Handle error. An error may be thrown if the backend is unable to perform
// requested operation due to availability or security issues.
// An error might be also be thrown for unrecoverable circumstances arising
// from programmatic error or configuration error. For example, if the keychain
// access entitlement is not set up correctly or basic system resources are
// unavailable.
}
CoroutineScope(Dispatchers.IO).launch {
try {
// countries: list of strings containing the country codes
val countries = identityVerificationClient.listSupportedCountries()
} catch (e: SudoIdentityVerificationException) {
// Handle errors.
}
}
try {
const supportedCountries = await identityVerificationClient.listSupportedCountries()
}
catch (err) {
// Handle errors
}
Verify identity using the name, address and date of birth provided by a user. This information is verified using trusted data sources.
Swift
Kotlin
TypeScript
do {
let verifiedIdentity = try await identityVerificationClient.verifyIdentity(
input: VerifyIdentityInput(
firstName: firstName,
lastName: lastName,
address: address,
city: city,
state: state,
postalCode: postalCode,
country: country,
dateOfBirth: dateOfBirth
)
if verifiedIdentity.verified {
// Identity verified succcessfully.
} else {
// Identity could not be verified.
}
} catch let error {
// Handle error. An error may be thrown if the backend is unable to perform
// requested operation due to availability or security issues.
// An error might be also be thrown for unrecoverable circumstances arising
// from programmatic error or configuration error. For example, if the keychain
// access entitlement is not set up correctly or basic system resources are
// unavailable.
}
val input = VerifyIdentityInput(
firstName = "John",
lastName = "Smith",
address = "222333 Peachtree Place",
city = "Atlanta",
state = "GA",
postalCode = "30318",
country = "US",
dateOfBirth = "1975-02-28"
)
launch {
try {
val verifiedIdentity = withContext(Dispatchers.IO) {
identityVerificationClient.verifyIdentity(
input
)
}
// The returned [verifiedIdentity] result has been verified.
} catch (e: SudoIdentityVerificationException) {
// Handle errors.
}
}
try {
const verifiedIdentity = await identityVerificationClient.verifyIdentity({
firstName: 'John',
lastName: 'Smith',
address: '222333 Peachtree Place',
city: 'Atlanta',
state: 'GA',
postalCode: '30318',
country: 'US',
dateOfBirth: '1975-02-28',
})
if (verifiedIdentity.verified) {
// proceed to the next stage of the app
}
else {
if (verifiedIdentity.canAttemptVerificationAgain) {
// user is permitted to try again
}
else {
if (verifiedIdentity.requiredVerificationMethod === 'GOVERNMENT_ID') {
// can attempt verification with government issued
// identity documents.
}
else {
// maximum retries exceeded, or the reason for failed
// verification prevents retry, e.g. PII is of a deceased
// person.
}
}
}
}
catch (err) {
// Handle errors
}
- Name and address fields are case-insensitive.
- City and state are optional fields.
- The country value must be an ISO 3166-1 alpha-2 code returned in the supported countries (see above).
- The format required for dateOfBirth is
yyyy-mm-dd
As well as returning a boolean indicator of the result of identity verification, the verified identity also provides the following information about the state of the identity verification attempt:
- The
verificationMethod
property indicates the level of identity verification achieved for this user. Possible values areNONE
,KNOWLEDGE_OF_PII
andGOVERNMENT_ID
. - The
requiredVerificationMethod
property indicates the level of identity verification required for this user in order to successfully complete identity verification. Different Sudo Platform environments may have different minimum required levels as well as cases where some users may require to achieve a higher level of verification, either to unlock greater entitlements or to manage risk. - The
canAttemptVerificationAgain
property indicates whether the Sudo Platform will accept new identity verification attempts for this user. This property will be set tofalse
if the configured maximum number of retries is exceeded or earlier verification results do not permit retries to mitigate the risk of fraud, e.g. providing the PII of a deceased person. - In Sudo Platform environments performing identity verification against live data sources, the
idScanUrl
property provides a link to a web page where a user can interactively take photos of their government issued identity documents and upload them for verification.
The
requiredVerificationMethod
and canAttemptVerificationAgain
properties can be used in a client application to guide a user's identity verification journey. For example, an application might attempt to verify using PII until achieving success, or canAttemptVerificationAgain
is set to false. In the latter case, if the requiredVerificationMethod
is set to GOVERNMENT_ID
, the user could be directed to upload their id document, either via the verifyIdentityDocument
API described below, or by rendering the web page indicated by the idScanUrl
property described above.Once the user's identity has been verified successfully the verification status, including verification method, is persisted on the user record in Sudo Platform and the user is not required to verify their identity again.
Verify identity by validating images of a driver's license, passport or other government issued identity document.
Before a user's identity can be verified using identity documents, they must first attempt identity verification using personally identifiable information (see the API above).
Swift
Kotlin
TypeScript
do {
let verifiedIdentity = try await identityVerificationClient.verifyIdentityDocument(
input: VerifyIdentityDocument(
image: frontImage,
backImage: backImage,
country: country,
documentType: .driverLicense
)
)
if verifiedIdentity.verified {
// Identity verified succcessfully.
} else {
// Identity could not be verified.
}
} catch {
// Handle error.
}
val input = VerifyIdentityDocumentInput(
documentType = IdDocumentType.driverLicense,
country = "US",
imageBase64 = encodedDocumentFrontImage,
backImageBase64 = encodedDocumentBackImage
)
launch {
try {
val verifiedIdentity = withContext(Dispatchers.IO) {
identityVerificationClient.verifyIdentityDocument(
input
)
}
// The returned [verifiedIdentity] result has been verified.
} catch (e: SudoIdentityVerificationException) {
// Handle errors.
}
}
try {
const verifiedIdentity = await identityVerificationClient.verifyIdentityDocument({
documentType: IdDocumentType.driverLicense,
country: 'US',
imageBase64: encodedDocumentFrontImage,
backImageBase64: encodedDocumentBackImage,
})
}
catch (err) {
// Handle errors
}
- Identity documents must be issued by a government agency.
- The document type can be one of
driverLicense
,passport
oridCard
. - The country value must be an ISO 3166-1 alpha-2 code returned in the supported countries (see above).
- Images of identification documents should be taken against a dark background, in a well-lit room and fill the majority of the image, with only a small border of the background surface showing.
- All four corners of the identification document must be visible in the image.
- Prior to Base64 encoding, the images should be in PNG, JPG or GIF format, and not exceed 5 MB in size each.
- When submitting a passport for verification, use the photo page image for both the front and back images.
Once the user's identity has been verified successfully the verification status is persisted on the user record and the user is not required to verify their identity again.
To check the identity verification status of a user:
Swift
Kotlin
TypeScript
do {
let verifiedIdentity = try await identityVerificationClient.checkIdentityVerification(option: .remoteOnly) { (result) in
if verifiedIdentity.verified {
// Identity was verified succcessfully.
} else {
// Identity could not be verified.
}
} catch let error {
// Handle error. An error may be thrown if the backend is unable to perform
// requested operation due to availability or security issues.
// An error might be also be thrown for unrecoverable circumstances arising
// from programmatic error or configuration error. For example, if the keychain
// access entitlement is not set up correctly or basic system resources are
// unavailable.
}
CoroutineScope(Dispatchers.IO).launch {
try {
// verifiedIdentity: result of the last verification attempt.
val verifiedIdentity = identityVerificationClient.checkIdentityVerification(QueryOption.REMOTE_ONLY) { result ->
} catch (e: SudoIdentityVerificationException) {
// Handle errors.
}
}
try {
const verifiedIdentity = await identityVerificationClient.checkIdentityVerification()
if (verifiedIdentity.verified) {
// Identity was verified succcessfully.
switch (verifiedIdentity.verificationMethod) {
case VerificationMethod.KnowledgeOfPII:
// provide access to regulated service
break
case VerificationMethod.GovernmentID:
// perhaps provide a different level of service, e.g. higher
// entitlements
break
}
} else {
// Identity could not be verified.
}
}
catch (err) {
// Handle errors
}