@connectid-tools/rp-nodejs-sdk 4.2.1 → 5.0.0

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.
Files changed (97) hide show
  1. package/README.md +60 -71
  2. package/package.json +4 -5
  3. package/{config.js → src/config.js} +2 -31
  4. package/src/conformance/api/conformance-api.d.ts +38 -0
  5. package/src/conformance/api/conformance-api.js +53 -0
  6. package/src/conformance/config.json +60 -0
  7. package/src/conformance/conformance-config.d.ts +2 -0
  8. package/src/conformance/conformance-config.js +34 -0
  9. package/src/conformance/conformance.test.js +101 -0
  10. package/src/conformance/variant.json +1 -0
  11. package/src/crypto/crypto-loader.d.ts +32 -0
  12. package/src/crypto/crypto-loader.js +49 -0
  13. package/src/crypto/jwt-helper.d.ts +61 -0
  14. package/src/crypto/jwt-helper.js +92 -0
  15. package/src/crypto/pkce-helper.d.ts +43 -0
  16. package/src/crypto/pkce-helper.js +75 -0
  17. package/src/endpoints/participants-endpoint.d.ts +55 -0
  18. package/src/endpoints/participants-endpoint.js +137 -0
  19. package/src/endpoints/pushed-authorisation-request-endpoint.d.ts +87 -0
  20. package/src/endpoints/pushed-authorisation-request-endpoint.js +192 -0
  21. package/src/endpoints/retrieve-token-endpoint.d.ts +66 -0
  22. package/src/endpoints/retrieve-token-endpoint.js +159 -0
  23. package/src/endpoints/userinfo-endpoint.d.ts +24 -0
  24. package/src/endpoints/userinfo-endpoint.js +50 -0
  25. package/src/fapi/fapi-utils.d.ts +6 -0
  26. package/src/fapi/fapi-utils.js +9 -0
  27. package/src/http/http-client-extensions.d.ts +60 -0
  28. package/src/http/http-client-extensions.js +106 -0
  29. package/src/http/http-client-factory.d.ts +27 -0
  30. package/src/http/http-client-factory.js +45 -0
  31. package/src/integration/integration.test.d.ts +1 -0
  32. package/src/integration/integration.test.js +30 -0
  33. package/src/model/callback-params.d.ts +31 -0
  34. package/src/model/callback-params.js +1 -0
  35. package/src/model/claims.d.ts +100 -0
  36. package/src/model/claims.js +1 -0
  37. package/src/model/consolidated-token-set.d.ts +74 -0
  38. package/src/model/consolidated-token-set.js +100 -0
  39. package/src/model/discovery-service.d.ts +46 -0
  40. package/src/model/discovery-service.js +112 -0
  41. package/src/model/issuer-metadata.d.ts +165 -0
  42. package/src/model/issuer-metadata.js +1 -0
  43. package/src/model/jwks.d.ts +12 -0
  44. package/src/model/jwks.js +1 -0
  45. package/src/model/token-response.d.ts +31 -0
  46. package/src/model/token-response.js +1 -0
  47. package/src/model/token-set.d.ts +73 -0
  48. package/src/model/token-set.js +179 -0
  49. package/src/relying-party-client-sdk.d.ts +68 -0
  50. package/src/relying-party-client-sdk.js +150 -0
  51. package/src/test-data/large-participants-test-data.d.ts +865 -0
  52. package/src/test-data/large-participants-test-data.js +18907 -0
  53. package/src/test-data/participants-test-data.d.ts +149 -0
  54. package/src/test-data/participants-test-data.js +458 -0
  55. package/src/test-data/sandbox-participants-test-data.d.ts +865 -0
  56. package/src/test-data/sandbox-participants-test-data.js +3794 -0
  57. package/src/tests/cert-utils.test.d.ts +1 -0
  58. package/src/tests/cert-utils.test.js +13 -0
  59. package/src/tests/functional-utils.test.d.ts +1 -0
  60. package/src/tests/functional-utils.test.js +13 -0
  61. package/src/tests/participant-filters.test.d.ts +1 -0
  62. package/src/tests/participant-filters.test.js +151 -0
  63. package/src/tests/pushed-authorisation-request-endpoint.test.d.ts +1 -0
  64. package/src/tests/pushed-authorisation-request-endpoint.test.js +159 -0
  65. package/src/tests/relying-party-client-sdk.test.d.ts +1 -0
  66. package/src/tests/relying-party-client-sdk.test.js +313 -0
  67. package/src/tests/request-utils.test.d.ts +1 -0
  68. package/src/tests/request-utils.test.js +16 -0
  69. package/src/tests/system-information.test.d.ts +1 -0
  70. package/src/tests/system-information.test.js +16 -0
  71. package/src/tests/user-agent.test.d.ts +1 -0
  72. package/src/tests/user-agent.test.js +23 -0
  73. package/src/tests/validator.test.d.ts +1 -0
  74. package/src/tests/validator.test.js +38 -0
  75. package/{types.d.ts → src/types.d.ts} +61 -32
  76. package/src/types.js +1 -0
  77. package/{utils → src/utils}/request-utils.d.ts +1 -1
  78. package/src/utils/request-utils.js +8 -0
  79. package/{utils → src/utils}/user-agent.d.ts +1 -1
  80. package/{utils → src/utils}/user-agent.js +1 -1
  81. package/relying-party-client-sdk.d.ts +0 -37
  82. package/relying-party-client-sdk.js +0 -364
  83. package/utils/request-utils.js +0 -8
  84. /package/{config.d.ts → src/config.d.ts} +0 -0
  85. /package/{types.js → src/conformance/conformance.test.d.ts} +0 -0
  86. /package/{filter → src/filter}/participant-filters.d.ts +0 -0
  87. /package/{filter → src/filter}/participant-filters.js +0 -0
  88. /package/{logger.d.ts → src/logger.d.ts} +0 -0
  89. /package/{logger.js → src/logger.js} +0 -0
  90. /package/{utils → src/utils}/cert-utils.d.ts +0 -0
  91. /package/{utils → src/utils}/cert-utils.js +0 -0
  92. /package/{utils → src/utils}/functional-utils.d.ts +0 -0
  93. /package/{utils → src/utils}/functional-utils.js +0 -0
  94. /package/{utils → src/utils}/system-information.d.ts +0 -0
  95. /package/{utils → src/utils}/system-information.js +0 -0
  96. /package/{validator.d.ts → src/validator.d.ts} +0 -0
  97. /package/{validator.js → src/validator.js} +0 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert';
3
+ import { getCertificate } from '../utils/cert-utils.js';
4
+ test('should use content when certificate content and path are passed', () => {
5
+ assert.strictEqual(getCertificate('.gitignore', 'abcdefg'), 'abcdefg');
6
+ });
7
+ test('should use path when content is falsy', () => {
8
+ assert.ok(getCertificate('.gitignore', '').toString().includes('# These are some examples of commonly ignored file patterns.'));
9
+ // @ts-ignore
10
+ assert.ok(getCertificate('.gitignore', 0).toString().includes('# These are some examples of commonly ignored file patterns.'));
11
+ // @ts-ignore
12
+ assert.ok(getCertificate('.gitignore', null).toString().includes('# These are some examples of commonly ignored file patterns.'));
13
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import test from 'node:test';
2
+ import { partition } from '../utils/functional-utils.js';
3
+ import assert from 'node:assert';
4
+ test('should partition list', () => {
5
+ const [odd, even] = partition([1, 2, 3, 4, 5], (input) => input % 2 == 1);
6
+ assert.deepEqual(odd, [1, 3, 5]);
7
+ assert.deepEqual(even, [2, 4]);
8
+ });
9
+ test('should partition empty list', () => {
10
+ const [odd, even] = partition([], (input) => input % 2 == 1);
11
+ assert.deepEqual(odd, []);
12
+ assert.deepEqual(even, []);
13
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,151 @@
1
+ import ParticipantFilter from '../filter/participant-filters.js';
2
+ import { participantsTestData } from '../test-data/participants-test-data.js';
3
+ import { describe, it } from 'node:test';
4
+ import assert from 'node:assert';
5
+ const participantsFilter = new ParticipantFilter();
6
+ describe('removeOutOfDateCertifications', () => {
7
+ it('should remove all certifications as they are all after the specified date', () => {
8
+ const filteredParticipants = participantsFilter.removeOutOfDateCertifications(getParticipantsTestData(), new Date('2005-01-01'));
9
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers[0].AuthorisationServerCertifications.length, 0);
10
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers[1].AuthorisationServerCertifications.length, 0);
11
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers[0].AuthorisationServerCertifications.length, 0);
12
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers[0].AuthorisationServerCertifications.length, 0);
13
+ });
14
+ it('should keep all certification as they span the specified date', () => {
15
+ const filteredParticipants = participantsFilter.removeOutOfDateCertifications(getParticipantsTestData(), new Date('2024-01-01'));
16
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers[0].AuthorisationServerCertifications.length, 4);
17
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers[1].AuthorisationServerCertifications.length, 4);
18
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers[0].AuthorisationServerCertifications.length, 4);
19
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers[0].AuthorisationServerCertifications.length, 1);
20
+ });
21
+ it('should keep all certification that span the specified date', () => {
22
+ const filteredParticipants = participantsFilter.removeOutOfDateCertifications(getParticipantsTestData(), new Date('2024-05-20'));
23
+ const testData = getParticipantsTestData();
24
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers[0].AuthorisationServerCertifications.length, 3);
25
+ assert.ok(!filteredParticipants[0].AuthorisationServers[0].AuthorisationServerCertifications.includes(testData[0].AuthorisationServers[0].AuthorisationServerCertifications[0]));
26
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers[1].AuthorisationServerCertifications.length, 2);
27
+ assert.ok(!filteredParticipants[0].AuthorisationServers[1].AuthorisationServerCertifications.includes(testData[0].AuthorisationServers[1].AuthorisationServerCertifications[0]));
28
+ assert.ok(!filteredParticipants[0].AuthorisationServers[1].AuthorisationServerCertifications.includes(testData[0].AuthorisationServers[1].AuthorisationServerCertifications[1]));
29
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers[0].AuthorisationServerCertifications.length, 1);
30
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers[0].AuthorisationServerCertifications.length, 0);
31
+ });
32
+ it('should remove all certifications as they are all before the specified date', () => {
33
+ const filteredParticipants = participantsFilter.removeOutOfDateCertifications(getParticipantsTestData(), new Date('2025-01-01'));
34
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers[0].AuthorisationServerCertifications.length, 0);
35
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers[1].AuthorisationServerCertifications.length, 0);
36
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers[0].AuthorisationServerCertifications.length, 0);
37
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers[0].AuthorisationServerCertifications.length, 0);
38
+ });
39
+ });
40
+ describe('removeUnofficialCertifications', () => {
41
+ it('should remove certifications that do not have status "Certified"', () => {
42
+ const filteredParticipants = participantsFilter.removeUnofficialCertifications(getParticipantsTestData());
43
+ const testData = getParticipantsTestData();
44
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers[0].AuthorisationServerCertifications.length, 3);
45
+ assert.ok(!filteredParticipants[0].AuthorisationServers[0].AuthorisationServerCertifications.includes(testData[0].AuthorisationServers[0].AuthorisationServerCertifications[3]));
46
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers[1].AuthorisationServerCertifications.length, 3);
47
+ assert.ok(!filteredParticipants[0].AuthorisationServers[1].AuthorisationServerCertifications.includes(testData[0].AuthorisationServers[1].AuthorisationServerCertifications[2]));
48
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers[0].AuthorisationServerCertifications.length, 0);
49
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers[0].AuthorisationServerCertifications.length, 1);
50
+ });
51
+ });
52
+ describe('removeInactiveAuthServers', () => {
53
+ it('should remove Auth Servers that do not have the Redirect:FAPI certification', () => {
54
+ const filteredParticipants = participantsFilter.removeInactiveAuthServers(getParticipantsTestData());
55
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers.length, 2);
56
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers.length, 0);
57
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers.length, 0);
58
+ });
59
+ });
60
+ describe('removeParticipantsWithoutAuthServers', () => {
61
+ it('should remove Participants that do not have any auth servers', () => {
62
+ const participants = getParticipantsTestData();
63
+ participants[1].AuthorisationServers = [];
64
+ const filteredParticipants = participantsFilter.removeParticipantsWithoutAuthServers(participants);
65
+ assert.strictEqual(filteredParticipants.length, 2);
66
+ assert.ok(filteredParticipants.includes(participants[0]));
67
+ assert.ok(filteredParticipants.includes(participants[2]));
68
+ });
69
+ });
70
+ describe('filterAuthServersForSupportedClaims', () => {
71
+ it('should filter auth servers that do not have the over25 required claims', () => {
72
+ const filteredParticipants = participantsFilter.filterAuthServersForSupportedClaims(getParticipantsTestData(), ['over25']);
73
+ const testData = getParticipantsTestData();
74
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers.length, 1);
75
+ assert.deepStrictEqual(filteredParticipants[0].AuthorisationServers[0], testData[0].AuthorisationServers[0]);
76
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers.length, 0);
77
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers.length, 0);
78
+ });
79
+ it('should filter auth servers that match multiple required claims', () => {
80
+ const filteredParticipants = participantsFilter.filterAuthServersForSupportedClaims(getParticipantsTestData(), ['address', 'over18']);
81
+ const testData = getParticipantsTestData();
82
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers.length, 0);
83
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers.length, 1);
84
+ assert.deepStrictEqual(filteredParticipants[1].AuthorisationServers[0], testData[1].AuthorisationServers[0]);
85
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers.length, 0);
86
+ });
87
+ it('should find auth servers with the name claim when asking for a name component', () => {
88
+ const filteredParticipants = participantsFilter.filterAuthServersForSupportedClaims(getParticipantsTestData(), ['given_name']);
89
+ const testData = getParticipantsTestData();
90
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers.length, 1);
91
+ assert.deepStrictEqual(filteredParticipants[0].AuthorisationServers[0], testData[0].AuthorisationServers[0]);
92
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers.length, 0);
93
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers.length, 0);
94
+ });
95
+ });
96
+ describe('removeFallbackIdentityServiceProvider', () => {
97
+ it('should filter out any manual verification auth servers', () => {
98
+ const filteredParticipants = participantsFilter.removeFallbackIdentityServiceProvider(getParticipantsTestData());
99
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers.length, 2);
100
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers.length, 1);
101
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers.length, 0);
102
+ });
103
+ });
104
+ describe('filterForFallbackIdentityServiceProviders', () => {
105
+ it('should return any auth servers that have the fallback provider certification', () => {
106
+ const filteredParticipants = participantsFilter.filterForFallbackIdentityServiceProviders(getParticipantsTestData());
107
+ const testData = getParticipantsTestData();
108
+ assert.strictEqual(filteredParticipants.length, 3);
109
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers.length, 0);
110
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers.length, 0);
111
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers.length, 1);
112
+ assert.deepStrictEqual(filteredParticipants[2], testData[2]);
113
+ });
114
+ });
115
+ describe('filterForRequiredCertifications', () => {
116
+ it('should return any auth servers that have the TDIF provider certification', () => {
117
+ const certificationFilters = [{ profileVariant: 'Identity Provider', profileType: 'TDIF Accreditation' }];
118
+ const filteredParticipants = participantsFilter.filterForRequiredCertifications(getParticipantsTestData(), certificationFilters);
119
+ const testData = getParticipantsTestData();
120
+ assert.deepStrictEqual(filteredParticipants[0].AuthorisationServers[0], testData[0].AuthorisationServers[1]);
121
+ assert.deepStrictEqual(filteredParticipants[1].AuthorisationServers[0], testData[1].AuthorisationServers[0]);
122
+ assert.strictEqual(filteredParticipants.length, 3);
123
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers.length, 1);
124
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers.length, 1);
125
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers.length, 0);
126
+ });
127
+ it('should return no auth servers when no auth servers have the requested certification', () => {
128
+ const certificationFilters = [{ profileType: 'Bad Profile', profileVariant: 'Bad Variant' }];
129
+ const filteredParticipants = participantsFilter.filterForRequiredCertifications(getParticipantsTestData(), certificationFilters);
130
+ assert.strictEqual(filteredParticipants.length, 3);
131
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers.length, 0);
132
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers.length, 0);
133
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers.length, 0);
134
+ });
135
+ it('should return only auth servers that have all matching certifications', () => {
136
+ const certificationFilters = [
137
+ { profileType: 'TDIF Accreditation', profileVariant: 'Identity Provider' },
138
+ { profileType: 'Channel', profileVariant: 'web' },
139
+ ];
140
+ const filteredParticipants = participantsFilter.filterForRequiredCertifications(getParticipantsTestData(), certificationFilters);
141
+ const testData = getParticipantsTestData();
142
+ assert.deepStrictEqual(filteredParticipants[0].AuthorisationServers[0], testData[0].AuthorisationServers[1]);
143
+ assert.strictEqual(filteredParticipants.length, 3);
144
+ assert.strictEqual(filteredParticipants[0].AuthorisationServers.length, 1);
145
+ assert.strictEqual(filteredParticipants[1].AuthorisationServers.length, 0);
146
+ assert.strictEqual(filteredParticipants[2].AuthorisationServers.length, 0);
147
+ });
148
+ });
149
+ function getParticipantsTestData() {
150
+ return JSON.parse(JSON.stringify(participantsTestData));
151
+ }
@@ -0,0 +1,159 @@
1
+ import { PushedAuthorisationRequestEndpoint } from '../endpoints/pushed-authorisation-request-endpoint.js';
2
+ import { config } from '../config.js';
3
+ import { Agent } from 'undici';
4
+ import { describe, it } from 'node:test';
5
+ import assert from 'node:assert';
6
+ describe('generateClaimsRequest', () => {
7
+ function createEndpoint(sdkConfig = config) {
8
+ const httpClient = new Agent();
9
+ const jwtHelper = {}; // Mock
10
+ const logger = {
11
+ info: () => { },
12
+ debug: () => { },
13
+ warn: () => { },
14
+ error: () => { },
15
+ };
16
+ const participantsEndpoint = {}; // Mock
17
+ return new PushedAuthorisationRequestEndpoint(sdkConfig, httpClient, jwtHelper, logger, participantsEndpoint);
18
+ }
19
+ it('should return name, birthdate essential claims', () => {
20
+ const endpoint = createEndpoint();
21
+ const claimsRequest = endpoint.generateClaimsRequest(['name', 'birthdate'], []);
22
+ const expected = {
23
+ id_token: {
24
+ name: { essential: true },
25
+ birthdate: { essential: true },
26
+ },
27
+ };
28
+ assert.deepEqual(claimsRequest, expected);
29
+ });
30
+ it('should return name essential, given_name essential, birthdate voluntary, email voluntary claims', () => {
31
+ const endpoint = createEndpoint();
32
+ const claimsRequest = endpoint.generateClaimsRequest(['name', 'given_name'], ['birthdate', 'email']);
33
+ const expected = {
34
+ id_token: {
35
+ name: { essential: true },
36
+ given_name: { essential: true },
37
+ email: { essential: false },
38
+ birthdate: { essential: false },
39
+ },
40
+ };
41
+ assert.deepEqual(claimsRequest, expected);
42
+ });
43
+ it('should return essential when claims are in both lists', () => {
44
+ const endpoint = createEndpoint();
45
+ const claimsRequest = endpoint.generateClaimsRequest(['name', 'given_name'], ['name', 'birthdate']);
46
+ const expected = {
47
+ id_token: {
48
+ name: { essential: true },
49
+ given_name: { essential: true },
50
+ birthdate: { essential: false },
51
+ },
52
+ };
53
+ assert.deepEqual(claimsRequest, expected);
54
+ });
55
+ it('should return only voluntary claims', () => {
56
+ const endpoint = createEndpoint();
57
+ const claimsRequest = endpoint.generateClaimsRequest([], ['name', 'birthdate']);
58
+ const expected = {
59
+ id_token: {
60
+ name: { essential: false },
61
+ birthdate: { essential: false },
62
+ },
63
+ };
64
+ assert.deepEqual(claimsRequest, expected);
65
+ });
66
+ it('should create essential extended claims', () => {
67
+ const endpoint = createEndpoint();
68
+ const claimsRequest = endpoint.generateClaimsRequest(['over18', 'over65'], []);
69
+ const expected = {
70
+ id_token: {
71
+ verified_claims: {
72
+ verification: {
73
+ trust_framework: { value: 'au_connectid' },
74
+ },
75
+ claims: {
76
+ over18: { essential: true },
77
+ over65: { essential: true },
78
+ },
79
+ },
80
+ },
81
+ };
82
+ assert.deepEqual(claimsRequest, expected);
83
+ });
84
+ it('should create essential and voluntary extended claims', () => {
85
+ const endpoint = createEndpoint();
86
+ const claimsRequest = endpoint.generateClaimsRequest(['over18'], ['over65']);
87
+ const expected = {
88
+ id_token: {
89
+ verified_claims: {
90
+ verification: {
91
+ trust_framework: { value: 'au_connectid' },
92
+ },
93
+ claims: {
94
+ over18: { essential: true },
95
+ over65: { essential: false },
96
+ },
97
+ },
98
+ },
99
+ };
100
+ assert.deepEqual(claimsRequest, expected);
101
+ });
102
+ it('should create extended claims and normal essential claims', () => {
103
+ const endpoint = createEndpoint();
104
+ const claimsRequest = endpoint.generateClaimsRequest(['given_name', 'over18'], []);
105
+ const expected = {
106
+ id_token: {
107
+ given_name: { essential: true },
108
+ verified_claims: {
109
+ verification: {
110
+ trust_framework: { value: 'au_connectid' },
111
+ },
112
+ claims: {
113
+ over18: { essential: true },
114
+ },
115
+ },
116
+ },
117
+ };
118
+ assert.deepEqual(claimsRequest, expected);
119
+ });
120
+ it('should create extended claims and normal essential and voluntary claims', () => {
121
+ const endpoint = createEndpoint();
122
+ const claimsRequest = endpoint.generateClaimsRequest(['given_name', 'over18'], ['last_name', 'over65']);
123
+ const expected = {
124
+ id_token: {
125
+ given_name: { essential: true },
126
+ last_name: { essential: false },
127
+ verified_claims: {
128
+ verification: {
129
+ trust_framework: { value: 'au_connectid' },
130
+ },
131
+ claims: {
132
+ over18: { essential: true },
133
+ over65: { essential: false },
134
+ },
135
+ },
136
+ },
137
+ };
138
+ assert.deepEqual(claimsRequest, expected);
139
+ });
140
+ it('should create extended claims with beneficiary account', () => {
141
+ const endpoint = createEndpoint();
142
+ const claimsRequest = endpoint.generateClaimsRequest(['beneficiary_account_au', 'beneficiary_account_au_payid'], ['beneficiary_account_international']);
143
+ const expected = {
144
+ id_token: {
145
+ verified_claims: {
146
+ verification: {
147
+ trust_framework: { value: 'au_connectid' },
148
+ },
149
+ claims: {
150
+ beneficiary_account_au: { essential: true },
151
+ beneficiary_account_au_payid: { essential: true },
152
+ beneficiary_account_international: { essential: false },
153
+ },
154
+ },
155
+ },
156
+ };
157
+ assert.deepEqual(claimsRequest, expected);
158
+ });
159
+ });
@@ -0,0 +1 @@
1
+ export {};