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

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 (56) hide show
  1. package/README.md +64 -71
  2. package/config.js +2 -31
  3. package/conformance/api/conformance-api.d.ts +38 -0
  4. package/conformance/api/conformance-api.js +53 -0
  5. package/conformance/conformance-config.d.ts +2 -0
  6. package/conformance/conformance-config.js +34 -0
  7. package/crypto/crypto-loader.d.ts +32 -0
  8. package/crypto/crypto-loader.js +49 -0
  9. package/crypto/jwt-helper.d.ts +61 -0
  10. package/crypto/jwt-helper.js +92 -0
  11. package/crypto/pkce-helper.d.ts +43 -0
  12. package/crypto/pkce-helper.js +75 -0
  13. package/endpoints/participants-endpoint.d.ts +55 -0
  14. package/endpoints/participants-endpoint.js +137 -0
  15. package/endpoints/pushed-authorisation-request-endpoint.d.ts +87 -0
  16. package/endpoints/pushed-authorisation-request-endpoint.js +192 -0
  17. package/endpoints/retrieve-token-endpoint.d.ts +66 -0
  18. package/endpoints/retrieve-token-endpoint.js +159 -0
  19. package/endpoints/userinfo-endpoint.d.ts +24 -0
  20. package/endpoints/userinfo-endpoint.js +50 -0
  21. package/fapi/fapi-utils.d.ts +6 -0
  22. package/fapi/fapi-utils.js +9 -0
  23. package/http/http-client-extensions.d.ts +60 -0
  24. package/http/http-client-extensions.js +106 -0
  25. package/http/http-client-factory.d.ts +27 -0
  26. package/http/http-client-factory.js +45 -0
  27. package/model/callback-params.d.ts +31 -0
  28. package/model/callback-params.js +1 -0
  29. package/model/claims.d.ts +100 -0
  30. package/model/claims.js +1 -0
  31. package/model/consolidated-token-set.d.ts +74 -0
  32. package/model/consolidated-token-set.js +100 -0
  33. package/model/discovery-service.d.ts +46 -0
  34. package/model/discovery-service.js +112 -0
  35. package/model/issuer-metadata.d.ts +165 -0
  36. package/model/issuer-metadata.js +1 -0
  37. package/model/jwks.d.ts +12 -0
  38. package/model/jwks.js +1 -0
  39. package/model/token-response.d.ts +31 -0
  40. package/model/token-response.js +1 -0
  41. package/model/token-set.d.ts +73 -0
  42. package/model/token-set.js +179 -0
  43. package/package.json +4 -5
  44. package/relying-party-client-sdk.d.ts +55 -24
  45. package/relying-party-client-sdk.js +90 -304
  46. package/test-data/large-participants-test-data.d.ts +865 -0
  47. package/test-data/large-participants-test-data.js +18907 -0
  48. package/test-data/participants-test-data.d.ts +149 -0
  49. package/test-data/participants-test-data.js +458 -0
  50. package/test-data/sandbox-participants-test-data.d.ts +865 -0
  51. package/test-data/sandbox-participants-test-data.js +3794 -0
  52. package/types.d.ts +61 -32
  53. package/utils/request-utils.d.ts +1 -1
  54. package/utils/request-utils.js +5 -5
  55. package/utils/user-agent.d.ts +1 -1
  56. package/utils/user-agent.js +1 -1
package/types.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- import { IdTokenClaims, TokenSet } from 'openid-client';
1
+ import { IdTokenClaims } from './model/claims.js';
2
+ export type { IdTokenClaims, AddressClaim, VerifiedClaims } from './model/claims.js';
3
+ export type { CallbackParams } from './model/callback-params.js';
4
+ export type { TokenResponse } from './model/token-response.js';
2
5
  export type RelyingPartyClientSdkConfig = {
3
6
  data: {
4
7
  ca_pem?: string;
@@ -20,35 +23,7 @@ export type RelyingPartyClientSdkConfig = {
20
23
  log_level: 'debug' | 'info';
21
24
  enable_auto_compliance_verification: boolean;
22
25
  purpose?: string;
23
- cache_ttl?: number;
24
- client: {
25
- client_id: string;
26
- organisation_id: string;
27
- jwks_uri: string;
28
- redirect_uris: string[];
29
- organisation_name: string;
30
- organisation_number: string;
31
- software_description: string;
32
- software_roles: string[];
33
- application_type: 'web';
34
- grant_types: ['client_credentials', 'authorization_code', 'implicit'];
35
- id_token_signed_response_alg: 'PS256';
36
- post_logout_redirect_uris: [];
37
- require_auth_time: false;
38
- response_types: ['code id_token', 'code'];
39
- subject_type: 'public';
40
- token_endpoint_auth_method: 'private_key_jwt';
41
- token_endpoint_auth_signing_alg: 'PS256';
42
- introspection_endpoint_auth_method: 'private_key_jwt';
43
- revocation_endpoint_auth_method: 'private_key_jwt';
44
- request_object_signing_alg: 'PS256';
45
- require_signed_request_object: true;
46
- require_pushed_authorization_requests: true;
47
- authorization_signed_response_alg: 'PS256';
48
- tls_client_certificate_bound_access_tokens: true;
49
- backchannel_user_code_parameter: false;
50
- scope: 'openid';
51
- };
26
+ client_id: string;
52
27
  };
53
28
  };
54
29
  export type Participant = {
@@ -152,9 +127,63 @@ export type ClaimsRequest = {
152
127
  };
153
128
  };
154
129
  };
155
- export type ConsolidatedTokenSet = TokenSet & {
130
+ /**
131
+ * Consolidated Token Set
132
+ *
133
+ * Represents a complete token response with additional helper methods.
134
+ * Combines token response data with parsed ID token claims.
135
+ */
136
+ export interface ConsolidatedTokenSet {
137
+ /**
138
+ * The access token issued by the authorization server.
139
+ */
140
+ readonly access_token?: string;
141
+ /**
142
+ * The type of token issued (typically "Bearer").
143
+ */
144
+ readonly token_type?: string;
145
+ /**
146
+ * The lifetime in seconds of the access token.
147
+ */
148
+ readonly expires_in?: number;
149
+ /**
150
+ * The refresh token for obtaining new access tokens.
151
+ */
152
+ readonly refresh_token?: string;
153
+ /**
154
+ * The scope of the access token.
155
+ */
156
+ readonly scope?: string;
157
+ /**
158
+ * The ID token as a JWT string.
159
+ */
160
+ readonly id_token?: string;
161
+ /**
162
+ * The x-fapi-interaction-id from the token response.
163
+ */
164
+ readonly xFapiInteractionId: string;
165
+ /**
166
+ * Checks if the access token has expired.
167
+ *
168
+ * @returns true if the token is expired, false otherwise
169
+ */
170
+ expired(): boolean;
171
+ /**
172
+ * Returns the parsed ID token claims.
173
+ *
174
+ * @returns Parsed ID token claims
175
+ */
176
+ claims(): IdTokenClaims;
177
+ /**
178
+ * Returns consolidated claims with verified_claims merged into top level.
179
+ *
180
+ * This is useful for accessing extended claims directly without
181
+ * navigating the verified_claims structure.
182
+ *
183
+ * @returns Consolidated claims object
184
+ */
156
185
  consolidatedClaims(): IdTokenClaims;
157
- };
186
+ }
158
187
  export type CertificationFilter = {
159
188
  profileVariant: string;
160
189
  profileType: string;
@@ -1,2 +1,2 @@
1
- import { PushAuthorisationRequestParams } from '../types';
1
+ import { PushAuthorisationRequestParams } from '../types.js';
2
2
  export declare const generatePushAuthorisationRequestParams: () => PushAuthorisationRequestParams;
@@ -1,8 +1,8 @@
1
- import { generators } from 'openid-client';
1
+ import { PkceHelper } from '../crypto/pkce-helper.js';
2
2
  export const generatePushAuthorisationRequestParams = () => {
3
- const state = generators.state();
4
- const nonce = generators.nonce();
5
- const codeVerifier = generators.codeVerifier();
6
- const codeChallenge = generators.codeChallenge(codeVerifier);
3
+ const state = PkceHelper.generateState();
4
+ const nonce = PkceHelper.generateNonce();
5
+ const codeVerifier = PkceHelper.generateCodeVerifier();
6
+ const codeChallenge = PkceHelper.generateCodeChallenge(codeVerifier);
7
7
  return { state, nonce, codeVerifier, codeChallenge };
8
8
  };
@@ -1,2 +1,2 @@
1
- export declare const packageJsonVersion = "4.2.1";
1
+ export declare const packageJsonVersion = "5.0.1";
2
2
  export declare const buildUserAgent: (clientId: string) => string;
@@ -1,4 +1,4 @@
1
1
  import { getSystemInformation } from './system-information.js';
2
2
  // important: Update this every time the package version changes
3
- export const packageJsonVersion = '4.2.1';
3
+ export const packageJsonVersion = '5.0.1';
4
4
  export const buildUserAgent = (clientId) => `cid-rp-nodejs-sdk/${packageJsonVersion} ${getSystemInformation()} +${clientId}`;