@haste-health/jwt 0.126.19 → 0.126.21

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/types.d.ts CHANGED
@@ -76,9 +76,31 @@ export interface AccessTokenPayload<role> extends HasteHealthCustomClaims<role>,
76
76
  scope: string;
77
77
  }
78
78
  /**
79
- * ID Token Payload. Extends Access token with additional claims from https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims.
79
+ * ID Token Payload (https://openid.net/specs/openid-connect-core-1_0.html#IDToken).
80
+ * Issued with the access token when `openid` is granted. It tells the client that
81
+ * requested the sign-in who signed in, so its `aud` is that client's id where the
82
+ * access token's is the FHIR server. Carries the standard claims the server has
83
+ * (https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims), the SMART
84
+ * `fhirUser` claim, and the Haste Health claims that place the user in a tenant and
85
+ * project. Scopes and access policies are on the access token only.
80
86
  */
81
- export interface IDTokenPayload<role> extends AccessTokenPayload<role> {
87
+ export interface IDTokenPayload<role> extends jose.JWTPayload {
88
+ iss: Issuer;
89
+ sub: Subject;
90
+ /**
91
+ * The client_id of the application the token was issued to.
92
+ */
93
+ aud: string;
94
+ fhirUser?: canonical;
95
+ /**
96
+ * The users role for the tenant.
97
+ */
98
+ [CUSTOM_CLAIMS.ROLE]: role;
99
+ /**
100
+ * The tenant and project the user signed in to.
101
+ */
102
+ [CUSTOM_CLAIMS.TENANT]: TenantId;
103
+ [CUSTOM_CLAIMS.PROJECT]: ProjectId;
82
104
  /**
83
105
  * End-User's full name in displayable form including all name parts, possibly including titles and suffixes, ordered according to the End-User's locale and preferences.
84
106
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haste-health/jwt",
3
- "version": "0.126.19",
3
+ "version": "0.126.21",
4
4
  "dependencies": {
5
5
  "jose": "^6.2.3"
6
6
  },
@@ -15,7 +15,7 @@
15
15
  "jest": "^29.7.0",
16
16
  "ts-jest": "^29.4.11",
17
17
  "typescript": "6.0.3",
18
- "@haste-health/fhir-types": "^0.126.19"
18
+ "@haste-health/fhir-types": "^0.126.21"
19
19
  },
20
20
  "exports": {
21
21
  ".": "./lib/index.js",
package/src/types.ts CHANGED
@@ -65,7 +65,9 @@ export interface SMARTPayload {
65
65
  }
66
66
 
67
67
  export interface AccessTokenPayload<role>
68
- extends HasteHealthCustomClaims<role>, SMARTPayload, jose.JWTPayload {
68
+ extends HasteHealthCustomClaims<role>,
69
+ SMARTPayload,
70
+ jose.JWTPayload {
69
71
  /**
70
72
  * REQUIRED. Issuer Identifier for the Issuer of the response.
71
73
  * The iss value is a case-sensitive URL using the https scheme that contains scheme, host, and optionally,
@@ -93,9 +95,31 @@ export interface AccessTokenPayload<role>
93
95
  }
94
96
 
95
97
  /**
96
- * ID Token Payload. Extends Access token with additional claims from https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims.
98
+ * ID Token Payload (https://openid.net/specs/openid-connect-core-1_0.html#IDToken).
99
+ * Issued with the access token when `openid` is granted. It tells the client that
100
+ * requested the sign-in who signed in, so its `aud` is that client's id where the
101
+ * access token's is the FHIR server. Carries the standard claims the server has
102
+ * (https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims), the SMART
103
+ * `fhirUser` claim, and the Haste Health claims that place the user in a tenant and
104
+ * project. Scopes and access policies are on the access token only.
97
105
  */
98
- export interface IDTokenPayload<role> extends AccessTokenPayload<role> {
106
+ export interface IDTokenPayload<role> extends jose.JWTPayload {
107
+ iss: Issuer;
108
+ sub: Subject;
109
+ /**
110
+ * The client_id of the application the token was issued to.
111
+ */
112
+ aud: string;
113
+ fhirUser?: canonical;
114
+ /**
115
+ * The users role for the tenant.
116
+ */
117
+ [CUSTOM_CLAIMS.ROLE]: role;
118
+ /**
119
+ * The tenant and project the user signed in to.
120
+ */
121
+ [CUSTOM_CLAIMS.TENANT]: TenantId;
122
+ [CUSTOM_CLAIMS.PROJECT]: ProjectId;
99
123
  /**
100
124
  * End-User's full name in displayable form including all name parts, possibly including titles and suffixes, ordered according to the End-User's locale and preferences.
101
125
  */