Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@opengovsg/myinfo-gov-client
Advanced tools
A lightweight client to easily call the MyInfo TUO endpoint for the Singapore government. Compatible with NodeJS version >=6.
A lightweight client to easily call the MyInfo TUO endpoint for the Singapore government. Compatible with NodeJS version >=10.
'use strict'
const fs = require('fs')
const {
MyInfoGovClient,
CATEGORICAL_DATA_DICT, // Use this to look up code values
} = require('@opengovsg/myinfo-gov-client')
function main() {
// Your application configuration
const realm = '<Your Realm>'
const appId = '<Your App ID>'
const clientId = appId; // Usually the same value
const singpassEserviceId = '<Your SingPass e-Service ID>'
// Used for signing your request basestring with private key
const privateKey = fs.readFileSync('./secrets/privateKey.pem')
// MyInfo client
const myInfo = new MyInfoGovClient({
realm,
appId,
clientId,
singpassEserviceId,
privateKey,
mode: 'stg', // Set to 'dev' to call dev endpoint, leave empty for prod
});
// API params
const uinFin = 'S3000024B' // See list of dev/staging NRICs below
const requestedAttributes = [
'name',
'marriedname',
'hanyupinyinname',
'aliasname',
'hanyupinyinaliasname',
'sex',
'race',
'dialect',
'nationality',
'dob',
'birthcountry',
'secondaryrace',
'residentialstatus',
'passportnumber',
'passportexpirydate',
'email',
'mobileno',
'regadd',
'housingtype',
'hdbtype',
'mailadd',
'billadd',
'marital',
'edulevel',
'marriagecertno',
'countryofmarriage',
'marriagedate',
'divorcedate',
'childrenbirthrecords',
'relationships',
'edulevel',
'gradyear',
'schoolname',
'occupation',
'employment',
'workpassstatus',
'workpassexpirydate',
'householdincome',
'vehno',
];
const txnNo = 1234 // an optional transaction number
// API parameters
var params = {uinFin, requestedAttributes, txnNo}
// Make API call
myInfo.getPersonBasic(params)
.then(function(personObject) {
console.log('Results of Person-Basic endpoint:\n', personObject)
})
.catch(function(error) {
console.log('Error:\n', error)
})
}
main()
See a list of available MyInfo test accounts here.
We welcome contributions to code open-sourced by the Government Technology Agency of Singapore. All contributors will be asked to sign a Contributor License Agreement (CLA) in order to ensure that everybody is free to use their contributions.
FAQs
A lightweight client to easily call the MyInfo Person v3.2 endpoint for the Singapore government. Tested with NodeJS version >=12.
The npm package @opengovsg/myinfo-gov-client receives a total of 211 weekly downloads. As such, @opengovsg/myinfo-gov-client popularity was classified as not popular.
We found that @opengovsg/myinfo-gov-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.