@opengovsg/mockpass 4.3.3 → 4.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/assertions.js CHANGED
@@ -64,6 +64,9 @@ const oidc = {
64
64
  { nric: 'F1612358R', uuid: '45669f5c-e9ac-43c6-bcd2-9c3757f1fa1c' },
65
65
  { nric: 'F1612354N', uuid: 'c38ddb2d-9e5d-45c2-bb70-8ccb54fc8320' },
66
66
  { nric: 'F1612357U', uuid: 'f904a2b1-4b61-47e2-bdad-e2d606325e20' },
67
+ { nric: 'Y4581892I', uuid: 'acf8edda-bfdf-45fc-b140-a6ec6955d857' },
68
+ { nric: 'Y7654321K', uuid: '9916f054-488e-4894-8299-412e46d89e67' },
69
+ { nric: 'Y1234567P', uuid: '0fdcc18f-840b-4b35-80ee-44094a6cc66f' },
67
70
  ...Object.keys(myinfo.v3.personas).map((nric) => ({
68
71
  nric,
69
72
  uuid: myinfo.v3.personas[nric].uuid.value,
@@ -135,8 +138,20 @@ const oidc = {
135
138
  nonce,
136
139
  accessToken = crypto.randomBytes(15).toString('hex'),
137
140
  ) => {
138
- const sub = `s=${nric},u=${uuid}`
139
-
141
+ let sub
142
+ const sfa = {
143
+ Y4581892I: { fid: 'G730Z-H5P96', coi: 'DE', RP: 'CORPPASS' },
144
+ Y7654321K: { fid: '123456789', coi: 'CN', RP: 'IRAS' },
145
+ Y1234567P: { fid: 'G730Z-H5P96', coi: 'MY', RP: 'CORPPASS' },
146
+ }
147
+ if (nric.startsWith('Y')) {
148
+ const sfaAccount = sfa[nric]
149
+ ? sfa[nric]
150
+ : { fid: 'G730Z-H5P96', coi: 'DE', RP: 'CORPPASS' }
151
+ sub = `s=${nric},fid=${sfaAccount.fid},coi=${sfaAccount.coi},u=${uuid}`
152
+ } else {
153
+ sub = `s=${nric},u=${uuid}`
154
+ }
140
155
  const accessTokenHash = hashToken(accessToken)
141
156
 
142
157
  const refreshToken = crypto.randomBytes(20).toString('hex')
@@ -50,7 +50,7 @@ module.exports =
50
50
  const encryptedAndSignedPersona = await new jose.CompactEncrypt(
51
51
  Buffer.from(sign),
52
52
  )
53
- .setProtectedHeader({ alg: 'RSA-OAEP', enc: 'A128CBC-HS256' })
53
+ .setProtectedHeader({ alg: 'RSA-OAEP', enc: 'A256GCM' })
54
54
  .encrypt(publicKey)
55
55
  return encryptedAndSignedPersona
56
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengovsg/mockpass",
3
- "version": "4.3.3",
3
+ "version": "4.3.4",
4
4
  "description": "A mock SingPass/CorpPass server for dev purposes",
5
5
  "main": "app.js",
6
6
  "bin": {