uqudo
HomeCustomer PortalBook a Demo
  • KYC
    • Getting Started
      • Use Cases
        • User Enrolment
        • Face Authentication
      • Integration Options
        • Uqudo SDK
        • Uqudo API
        • No-code KYC
      • Customer Portal
        • Manage your SDK/API credentials
        • Create a new secret
        • Create a support request
    • Uqudo SDK
      • Integration
        • Android
          • Prepare Environment
          • Enrolment Flow
          • Lookup Flow
          • Face Session Flow
          • UI Customisation
            • UX & Branding
            • Dark / Night mode
            • Text & Language
              • General Strings
              • Scanning
              • Reading
              • Face Recognition
              • Background Check
              • Lookup
          • Analytics
        • iOS
          • Prepare Environment
          • Usage
          • Enrolment Flow
          • Lookup Flow
          • Face Session Flow
          • UI Customisation
            • UX & Branding
            • Dark / Night mode
            • Text & Language
          • Analytics
        • Web
          • SDK installation
            • Vanilla HTML+JS project
            • JS Frameworks (React, Angular, VueJs, etc...)
          • SDK Initialisation
          • CORS
          • Enrolment Flow
          • Face Session Flow
          • Javascript Usage
          • Typescript Usage
          • Operation Error
          • UI Customisation
            • Styles Configuration
            • Text & Language
            • Assets & Images
          • Webview Usage
          • Analytics
        • Capacitor
          • Plugin Installation
          • Enrolment Flow
          • Lookup Flow
          • Face Session Flow
        • Cordova
          • Plugin Installation
          • Enrolment Flow
          • Lookup Flow
          • Face Session Flow
        • Flutter
          • Plugin Installation
          • Enrolment Flow
          • Lookup Flow
          • Face Session Flow
        • React Native
          • Plugin Installation
          • Enrolment Flow
          • Lookup Flow
          • Face Session Flow
        • Xamarin and .NET
          • Plugin Installation
          • Enrolment Flow
          • Lookup Flow
          • Face Session Flow
          • Analytics
      • SDK result
        • Validation and Parsing
        • Data Structure
          • Common Object
          • Scan Object
          • Reading Object
            • Algerian ID
            • Bahrain ID
            • Ghana ID
            • Iraqi ID
            • Netherlands DL
            • Oman ID
            • Moroccan ID
            • Qatar ID
            • Saudi ID
            • Senegal ID
            • Turkish ID
            • UAE ID
            • Passports
          • Face Object
          • Lookup Object
            • Ghana SSNIT
            • Ghana Voter ID
            • Ghana Passport
            • Ghana Driving Licence
            • India PAN card
            • India Aadhaar ID
            • Nigeria Voter ID
            • Nigeria Driving Licence
            • Nigeria NIN
            • Nigeria BVN
            • Kenya National ID
            • South Africa ID
            • Uganda Voter ID
            • UAE Emirates ID
          • Verification Object
        • Download a Resource
        • Encrypt the SDK result
        • Security & Best Practices
      • Upgrade the SDK
      • Changelog
        • Mobile SDK
        • Web SDK
    • Uqudo API
      • Authorisation API
      • Scan API
        • Passports
          • AUS (Australia)
          • BEL (Belgium)
          • BHR (Bahrain)
          • CAN (Canada)
          • CHE (Switzerland)
          • DEU (Germany)
          • EGY (Egypt)
          • FRA (France)
          • GBR (UK)
          • IND (India)
          • JOR (Jordan)
          • KWT (Kuwait)
          • LBN (Lebanon)
          • MAR (Morocco)
          • OMN (Oman)
          • PAK (Pakistan)
          • PHL (Philippines)
          • PSE (Palestine)
          • QAT (Qatar)
          • SAU (Saudi Arabia)
          • SDN (Sudan)
          • SYR (Syria)
          • TUN (Tunisia)
          • TUR (Turkey)
          • UAE (UAE)
          • USA (USA)
          • YEM (Yemen)
          • ZAF (South Africa)
        • Generic National IDs
        • Country Specific IDs
          • BHR_DL (Bahrain Driving Licence)
          • BHR_ID (Bahrain ID)
          • BHR_VL (Bahrain Vehicle License)
          • COD_DL (DRC Driving Licence)
          • COD_VOTER_ID (DRC Voter ID)
          • DZA_ID (Algerian ID)
          • EGY_ID (Egypt ID)
          • GBR DL (UK Driving License)
          • GBR_ID (UK Resident ID)
          • GHA_DL (Ghana Driving Licence)
          • GHA_ID (Ghana National ID)
          • GHA_SSNIT (Ghana Social Security and National Insurance Trust)
          • GHA_VOTER_ID (Ghana Voter ID)
          • IND_ID (India Identity Card)
          • IND_PAN (Indian PAN Card)
          • IRQ_ID (Iraqi ID)
          • JOR_VL (Jordan Vehicle License)
          • KEN_ID (Kenya ID)
          • KWT_ID (Kuwait ID)
          • LBN DL (Lebanese Driving Licence)
          • LBN_ID (Lebanese ID)
          • MAR_ID (Moroccan ID)
          • NGA_DL (Nigeria Driving Licence)
          • NGA_NIN (Nigeria Digital NIN)
          • NGA_VOTER_ID (Nigeria Voter Card)
          • NLD_DL (Netherlands Driving Licence)
          • OMN_DL (Oman Driving Licence)
          • OMN_ID (Oman ID)
          • OMN_VL (Oman Vehicle License)
          • PAK_ID (Pakistan ID)
          • PHL_DL (Philippines Driving License)
          • QAT_DL (Qatar Driving Licence)
          • QAT_ID (Qatar ID)
          • RSL_ID (Somaliland National ID)
          • RWA_ID (Rwanda ID)
          • SAU_DL (Saudi Arabia Driving Licence)
          • SAU_ID (Saudi Arabia ID)
          • SAU_VL (Saudi Vehicle License)
          • SDN_DL (Sudan Driving Licence)
          • SDN_ID (Sudan ID)
          • SDN_VL (Sudan Vehicle License)
          • SEN_ID (Senegal ID)
          • SOM_ID (Somali ID)
          • TUN_ID (Tunisian ID)
          • TUR_ID (Turkish ID)
          • UAE_DL (UAE Driving Licence)
          • UAE_ID (UAE Emirates ID)
          • UAE_ID_DIGITAL (UAE Emirates ID digital version)
          • UAE_VISA (UAE Visa)
          • UAE_VL (UAE Vehicle Licence)
          • UAE_EVISA (UAE e-visa)
          • UAE_ID_APPLICATION_FORM (UAE ID application form)
          • UAE_PASSPORT_DIGITAL (Digital Emirates Passport)
          • UGA_ID (Uganda ID)
          • UGA_VOTER_ID (Uganda Voter ID)
          • USA_DL (USA Driving Licence)
          • ZAF_DL (South Africa Driving License)
          • ZAF_ID (South Africa ID)
        • MRZ only (TD1 or TD3)
      • Info API
      • Face API
      • Lookup API
        • Ghana
        • India
        • Kenya
        • Nigeria
        • South Africa
        • Uganda
        • UAE
      • Background Check API
    • No-code KYC
      • Workflow Settings
      • Text Settings
      • Other Settings
      • Onboard Users
  • KYB
    • Getting Started
      • Use Cases
        • Low-complexity
        • Medium-complexity
        • High-complexity
      • Integration Options
        • Uqudo API
    • Uqudo API
      • Company API
      • Screening API
      • Data Matching API
      • Session API
  • Coverage
    • Middle East
      • 🇧🇭Bahrain
      • 🇮🇷Iran
      • 🇮🇶Iraq
      • 🇮🇱Israel
      • 🇯🇴Jordan
      • 🇰🇼Kuwait
      • 🇱🇧Lebanon
      • 🇴🇲Oman
      • 🇵🇸Palestine
      • 🇶🇦Qatar
      • 🇸🇦Saudi Arabia
      • 🇸🇾Syria
      • 🇹🇷Turkey
      • 🇦🇪United Arab Emirates
      • 🇾🇪Yemen
    • Africa
      • 🇩🇿Algeria
      • 🇦🇴Angola
      • 🇧🇯Benin
      • 🇧🇼Botswana
      • 🇧🇫Burkina Faso
      • 🇧🇮Burundi
      • 🇨🇲Cameroon
      • 🇨🇻Cape Verde
      • 🇨🇫Central African Republic
      • 🇹🇩Chad
      • 🇰🇲Comoros
      • 🇨🇩Democratic Republic of Congo
      • 🇩🇯Djibouti
      • 🇪🇬Egypt
      • 🇬🇶Equatorial Guinea
      • 🇪🇷Eritrea
      • 🇸🇿Eswatini
      • 🇪🇹Ethiopia
      • 🇬🇦Gabon
      • 🇬🇲Gambia
      • 🇬🇭Ghana
      • 🇬🇳Guinea
      • 🇬🇼Guinea-Bissau
      • 🇨🇮Ivory Coast
      • 🇰🇪Kenya
      • 🇱🇸Lesotho
      • 🇱🇷Liberia
      • 🇱🇾Libya
      • 🇲🇬Madagascar
      • 🇲🇼Malawi
      • 🇲🇱Mali
      • 🇲🇷Mauritania
      • 🇲🇺Mauritius
      • 🇲🇦Morocco
      • 🇲🇿Mozambique
      • 🇳🇦Namibia
      • 🇳🇪Niger
      • 🇳🇬Nigeria
      • 🇨🇩Republic of Congo
      • 🇷🇼Rwanda
      • 🇸🇹Sao Tome and Principe
      • 🇸🇳Senegal
      • 🇸🇨Seychelles
      • 🇸🇱Sierra Leone
      • 🇸🇴Somalia
      • 🇸🇴Somaliland
      • 🇿🇦South Africa
      • 🇸🇸South Sudan
      • 🇸🇩Sudan
      • 🇹🇿Tanzania
      • 🇹🇬Togo
      • 🇹🇳Tunisia
      • 🇺🇬Uganda
      • 🇿🇲Zambia
      • 🇿🇼Zimbabwe
    • Asia
      • 🇦🇫Afghanistan
      • 🇦🇲Armenia
      • 🇦🇿Azerbaijan
      • 🇧🇩Bangladesh
      • 🇧🇹Bhutan
      • 🇧🇳Brunei
      • 🇰🇭Cambodia
      • 🇨🇳China
      • 🇹🇱East Timor
      • 🇬🇪Georgia
      • 🇭🇰Hong-Kong (China)
      • 🇮🇳India
      • 🇮🇩Indonesia
      • 🇯🇵Japan
      • 🇰🇿Kazakhstan
      • 🇰🇬Kyrgyzstan
      • 🇱🇦Laos
      • 🇲🇴Macau (China)
      • 🇲🇾Malaysia
      • 🇲🇻Maldives
      • 🇲🇳Mongolia
      • 🇲🇲Myanmar
      • 🇳🇵Nepal
      • 🇰🇵North Korea
      • 🇵🇰Pakistan
      • 🇵🇭Philippines
      • 🇸🇬Singapore
      • 🇰🇷South Korea
      • 🇱🇰Sri Lanka
      • 🇹🇼Taiwan (China)
      • 🇹🇯Tajikistan
      • 🇹🇭Thailand
      • 🇹🇲Turkmenistan
      • 🇺🇿Uzbekistan
      • 🇻🇳Vietnam
    • Europe
      • 🇦🇱Albania
      • 🇦🇩Andorra
      • 🇦🇹Austria
      • 🇧🇾Belarus
      • 🇧🇪Belgium
      • 🇧🇦Bosnia and Herzegovina
      • 🇧🇬Bulgaria
      • 🇭🇷Croatia
      • 🇨🇾Cyprus
      • 🇨🇿Czech Republic
      • 🇩🇰Denmark
      • 🇪🇪Estonia
      • 🇫🇴Faroe Islands (Denmark)
      • 🇫🇮Finland
      • 🇫🇷France
      • 🇩🇪Germany
      • 🇬🇮Gibraltar (UK)
      • 🇬🇷Greece
      • 🇬🇱Greenland (Denmark)
      • 🇬🇬Guernsey (UK)
      • 🇭🇺Hungary
      • 🇮🇸Iceland
      • 🇮🇪Ireland
      • 🇮🇲Isle of Man (UK)
      • 🇮🇹Italy
      • 🇯🇪Jersey (UK)
      • 🇽🇰Kosovo
      • 🇱🇻Latvia
      • 🇱🇮Liechtenstein
      • 🇱🇹Lithuania
      • 🇱🇺Luxembourg
      • 🇲🇹Malta
      • 🇲🇩Moldova
      • 🇲🇨Monaco
      • 🇲🇪Montenegro
      • 🇳🇱Netherlands
      • 🇲🇰North Macedonia
      • 🇨🇾Northern Cyprus
      • 🇳🇴Norway
      • 🇵🇱Poland
      • 🇵🇹Portugal
      • 🇷🇴Romania
      • 🇷🇺Russia
      • 🇸🇲San Marino
      • 🇷🇸Serbia
      • 🇸🇰Slovakia
      • 🇸🇮Slovenia
      • 🇪🇸Spain
      • 🇸🇪Sweden
      • 🇨🇭Switzerland
      • 🇺🇦Ukraine
      • 🇬🇧United Kingdom
      • 🇻🇦Vatican City
    • North America
      • 🇦🇮Anguilla (UK)
      • 🇦🇬Antigua and Barbuda
      • 🇧🇸Bahamas
      • 🇧🇧Barbados
      • 🇧🇿Belize
      • 🇧🇲Bermuda (UK)
      • 🇻🇬British Virgin Islands (UK)
      • 🇨🇦Canada
      • 🇰🇾Cayman Islands (UK)
      • 🇨🇷Costa Rica
      • 🇨🇺Cuba
      • 🇩🇲Dominica
      • 🇩🇴Dominican Republic
      • 🇸🇻El Salvador
      • 🇬🇩Grenada
      • 🇬🇹Guatemala
      • 🇭🇹Haiti
      • 🇭🇳Honduras
      • 🇯🇲Jamaica
      • 🇲🇽Mexico
      • 🇲🇸Montserrat (UK)
      • 🇵🇦Panama
      • 🇰🇳Saint Kitts and Nevis
      • 🇱🇨Saint Lucia
      • 🇻🇨Saint Vincent and the Grenadines
      • 🇹🇨Turks and Caicos Islands (UK)
      • 🇺🇸United States of America
    • South America
      • 🇦🇷Argentina
      • 🇧🇴Bolivia
      • 🇧🇷Brazil
      • 🇨🇱Chile
      • 🇨🇴Colombia
      • 🇪🇨Ecuador
      • 🇬🇾Guyana
      • 🇳🇮Nicaragua
      • 🇵🇾Paraguay
      • 🇵🇪Peru
      • 🇸🇷Suriname
      • 🇹🇹Trinidad and Tobago
      • 🇺🇾Uruguay
      • 🇻🇪Venezuela
    • Oceania
      • 🇦🇺Australia
      • 🇫🇯Fiji
      • 🇵🇫French Polynesia (France)
      • 🇰🇮Kiribati
      • 🇲🇭Marshall Islands
      • 🇫🇲Micronesia
      • 🇳🇷Nauru
      • 🇳🇨New Caledonia (France)
      • 🇳🇿New Zealand
      • 🇵🇼Palau
      • 🇵🇬Papua New Guinea
      • 🇸🇭Saint Helena (UK)
      • 🇼🇸Samoa
      • 🇸🇧Solomon Islands
      • 🇹🇴Tonga
      • 🇹🇻Tuvalu
      • 🇻🇺Vanuatu
Powered by GitBook
On this page
  • JWS structure
  • JWS validation and parsing

Was this helpful?

  1. KYC
  2. Uqudo SDK
  3. SDK result

Validation and Parsing

PreviousSDK resultNextData Structure

Last updated 1 year ago

Was this helpful?

Note: Parsing and validation of the JWS should happen only in your backend. Doing the parsing on the client side defeats the purpose of our digital signature

JWS structure

The result is a string representing a JWS Compact Serialization, a representation of the JWS as a compact, URL-safe string, see for details. The decoded JWS is composed of a header that defines the algorithm and the token type and the payload that contains the data.

Header example:

{
  "kid": "e49b9f971574455ba969b20697a2c7b6",
  "alg": "RS256"
}

The “kid” attribute contains the key identifier that is needed to retrieve the public key to validate the JWS signature, see for details.

Enrollment payload example

{
  "aud": "clientid",
  "data": {
    "documents": [
      {
        "face": {
          "auditTrailImageId": "5f290764076cff0e3f7b3a2f",
          "matchLevel": 2,
          "match": true
        },
        "documentType": "PASSPORT",
        "scan": {
          "faceImageId": "5e9960242d35cc7ca0328729",
          "frontImageId": "5e9960232d35cc7ca0328725",
          "back": {},
          "front": {
            "documentCode": "P<",
            "dateOfExpiry": "220315",
            "secondaryId": "MARIO",
            "nationality": "ITA",
            "documentNumber": "YAXXXXXX",
            "mrzVerified": true,
            "sex": "M",
            "dateOfBirth": "800825",
            "opt1": "<<<<<<<<<<<<<<",
            "primaryId": "CASOLA",
            "mrzText": "P<ITACASOLA<<MARIO<<<<<<<<<<<<<<<<<<<<<<<<<<\nYAXXXXXX52ITA8008253M2203159<<<<<<<<<<<<<<00",
            "issuer": "ITA"
          },
          "backImageId": null
        },
        "reading": {
          "data": {
            "mrz": {
              "documentCode": "P",
              "dateOfExpiry": "220315",
              "optionalData2": null,
              "gender": "MALE",
              "nationality": "ITA",
              "documentNumber": "YAXXXXXX",
              "dateOfBirth": "800825",
              "issuingState": "ITA",
              "secondaryIdentifier": "MARIO",
              "primaryIdentifier": "CASOLA",
              "optionalData1": "<<<<<<<<<<<<<<0"
            },
            "countrySigningCertificate": {
              "serialNumber": "1",
              "publicKeyAlgorithm": "RSA",
              "subject": "C=IT,O=MINISTERO DELL'INTERNO,OU=PE,CN=CERTIFICATION AUTHORITY 01",
              "certificateThumbprint": "9cb8d31734faa68009d1f7fef68a5cc802cb8a2e",
              "validFrom": "2011-12-14T10:29:04.000+0000",
              "signatureAlgorithm": "SHA1WITHRSA",
              "issuer": "C=IT,O=MINISTERO DELL'INTERNO,OU=PE,CN=CERTIFICATION AUTHORITY 01",
              "validTo": "2027-03-10T10:29:04.000+0000"
            },
            "ldsVersion": null,
            "documentSigningCertificate": {
              "serialNumber": "464",
              "publicKeyAlgorithm": "RSA",
              "subject": "C=IT,O=MINISTERO DELL'INTERNO,OU=PE,CN=DOCUMENT SIGNER.24",
              "certificateThumbprint": "3f0b7bac9adde63916a2c4ebd0e3f38c916a3a97",
              "validFrom": "2012-03-14T11:02:41.000+0000",
              "signatureAlgorithm": "SHA1WITHRSA",
              "issuer": "C=IT,O=MINISTERO DELL'INTERNO,OU=PE,CN=CERTIFICATION AUTHORITY 01",
              "validTo": "2022-06-15T11:02:41.000+0000"
            },
            "photo": "",
            "dataGroupHashes": [
              {
                "computedHash": "86525f4741b3504765f4100f2ddf9bf1f17380ef",
                "dataGroupNumber": 1,
                "storedHash": "86525f4741b3504765f4100f2ddf9bf1f17380ef",
                "match": true
              },
              {
                "computedHash": "b01c95fc9d381f6a7f5fd9f3fae767ea0d9fd2a0",
                "dataGroupNumber": 2,
                "storedHash": "b01c95fc9d381f6a7f5fd9f3fae767ea0d9fd2a0",
                "match": true
              }
            ],
            "photoMimeType": "image/jp2",
            "validity": {
              "dataGroupHashesSucceeded": true,
              "documentSignerSucceeded": true,
              "countrySignerSucceeded": true,
              "sodSignerSucceeded": true
            }
          }
        }
      }
    ],
    "nonce": ""
  },
  "iss": "https://id.uqudo.io",
  "exp": 1587111760,
  "iat": 1587109960,
  "jti": "5a5cb56b-ef3d-434c-9f86-5ab24c4953ec"
}

Face Session payload example

{
 "aud": "client_id",
 "data": {
   "face": {
 	"auditTrailImageId": "5eabf184827ca836b8e28cf0",
 	"matchLevel": 5,
 	"match": true
   },
   "sessionId": "962cd61a-87b2-4c53-b415-27c053c9b281"
 },
 "iss": "https://id.uqudo.io",
 "exp": 1588327388,
 "iat": 1588326788,
 "jti": "6049f9c6-756e-48d7-b1ca-bbd00fef7d14"
}

JWS validation and parsing

Note: Parsing and validation of the JWS should happen only in your backend. Doing the parsing on the client side defeats the purpose of our digital signature

The JWS can be validated using the list of public keys available on https://id.uqudo.io/api/.well-known/jwks.json. It is a public endpoint:

$ curl https://id.uqudo.io/api/.well-known/jwks.json | jq
{
  "keys": [
    {
      "kty": "RSA",
      "e": "AQAB",
      "kid": "e49b9f971574455ba969b20697a2c7b6",
      "alg": "RS256",
      "n": "rEFxuU7IZiiKzyjVQ9U3yW594Hll-jjuWK-vYZBC9JZ4FmWMSsG3auvkpieUjrkMKKEP5YSLbhOOzjcRPRxSEcDfJl7jSD6mvWN05wokYFxUc9RT2p4kOkXPq26Wio4ksVJhFp1dkuJRyPIBW3xT2ipqnDmzUPzC4nKEwZC6vRz0sU4I7fFKLqGf4fmvi2nmJile-ctfcN8GV2Cam84WAgiIg7LrzYFQMeIj0fAmeBUXO4TAddsF6l6_JJu3uDXnzrDYJL9bEZiTk3Anf4SVeTle-hLDeAkTGbHI0Juqf1SEegGMRQ0mM0xcZe7Hmn3CFul3ahfEvGAYyny2tzHNUw"
    }
  ]
}

The kid in the JWS header is used to identify the key in the list above.

Below you can find an example on how to parse and validate the JWS using io.jsonwebtoken:

import io.jsonwebtoken.Jwts;
import com.auth0.jwk.UrlJwkProvider;import yourpackage.JwkKeyResolver;

....

var claims = Jwts.parserBuilder()
    .setSigningKeyResolver(new JwkKeyResolver(new UrlJwkProvider("https://<--server-->/api")))
    .build()
    .parseClaimsJws(jws)

Below you can find an example on how to parse and validate the JWS using com.auth0:

import com.auth0.jwk.JwkProvider;
import java.security.Key;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwsHeader;
import io.jsonwebtoken.SigningKeyResolver;

public class JwkKeyResolver implements SigningKeyResolver {

    private final JwkProvider keyStore;

    public JwkKeyResolver(JwkProvider keyStore) {
        this.keyStore = keyStore;
    }

    @Override
    public Key resolveSigningKey(JwsHeader header, Claims claims) {
        return this.getKey(header);
    }

    @Override
    public Key resolveSigningKey(JwsHeader header, String plaintext) {
        return this.getKey(header);
    }

    private Key getKey(JwsHeader header) throws Exception {
        var keyId = header.getKeyId();
        return keyStore.get(keyId).getPublicKey();
    }
}

Note: Check for the best library you can use according to your environment and programming language. Make sure the libary you choose supports JWKs through URL and make sure it caches the list of keys in memory and refresh the cache only if the kid is not found.

https://jwt.io/libraries
https://tools.ietf.org/html/rfc7515
JWS validation and parsing