An API endpoint for verify.gov.sg
to perform verification of OpenAttestation documents.
NodeJS lts/hydrogen (v18)
. If you're using nvm, run nvm use
to ensure you're using the same Node version in local and in your lambda's runtime.
To run locally, ensure the required environment variables are set in .env
. Refer to .env.example:
/serverless/api-verify-gov-sg/NETWORK_NAME=mainnet
/serverless/api-verify-gov-sg/INFURA_API_KEY=somekey
/serverless/api-verify-gov-sg/ALCHEMY_API_KEY=somekey
/serverless/api-verify-gov-sg/WHITELISTED_ISSUERS=gov.sg,openattestation.com
npm i
npm run dev
curl --location --request POST 'localhost:3000/dev/verify' \
--header 'Content-Type: application/json' \
--data-binary '@./fixtures/pdt_pcr_notarized_with_nric_wrapped.json'
Sample response:
{
"isValid": true,
"fragments": [
{
"type": "DOCUMENT_INTEGRITY",
"name": "OpenAttestationHash",
"data": true,
"status": "VALID"
}
// Other fragments...
],
"diagnostics": []
}