fhirstarterjs 1.0.8 → 1.0.9
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/LICENSE.md +44 -44
- package/README.md +142 -142
- package/dist/fhirstarter.d.ts +81 -0
- package/dist/fhirstarter.js +1 -0
- package/dist/fhirstarter.js.map +1 -0
- package/package.json +76 -62
- package/ts/fhirstarter.ts +372 -372
- package/types/api.d.ts +51 -55
- package/types/index.d.ts +2 -3
- package/types/internal.d.ts +20 -24
package/LICENSE.md
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
# Kopimi License
|
|
2
|
-
|
|
3
|
-
This software is released under the Kopimi License.
|
|
4
|
-
|
|
5
|
-
## Permission
|
|
6
|
-
|
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
8
|
-
this software and associated documentation files (the "Software"), to copy,
|
|
9
|
-
modify, merge, publish, distribute, sublicense, sell, use, study,
|
|
10
|
-
reverse-engineer, decompile, and otherwise deal in the Software without
|
|
11
|
-
restriction, including without limitation for commercial or non-commercial
|
|
12
|
-
purposes.
|
|
13
|
-
|
|
14
|
-
Commercial use, sale, resale, or distribution for profit must include clear
|
|
15
|
-
attribution to the original author(s) in the distributed copy and in any
|
|
16
|
-
customary public-facing product notices, documentation, credits, or legal
|
|
17
|
-
notices associated with that use.
|
|
18
|
-
|
|
19
|
-
## Kopimi Propagation
|
|
20
|
-
|
|
21
|
-
The Software is Kopimi. Copies, substantial portions, and derivative works must
|
|
22
|
-
preserve the freedom to copy, share, modify, remix, and redistribute the
|
|
23
|
-
Software. No copy, substantial portion, or derivative work may be distributed
|
|
24
|
-
under terms that prohibit those freedoms.
|
|
25
|
-
|
|
26
|
-
License notices, author notices, and Kopimi notices included with the Software
|
|
27
|
-
may not be removed from redistributed copies, substantial portions, or
|
|
28
|
-
derivative works.
|
|
29
|
-
|
|
30
|
-
Attribution to the original author(s) is appreciated for non-commercial use and
|
|
31
|
-
required for commercial use as described above.
|
|
32
|
-
|
|
33
|
-
## Disclaimer
|
|
34
|
-
|
|
35
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
36
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
37
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE
|
|
38
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
39
|
-
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
40
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
41
|
-
|
|
42
|
-
This license is itself Kopimi. Copy it, use it, and remix it.
|
|
43
|
-
|
|
44
|
-
For more information, please refer to <https://kopimi.com>
|
|
1
|
+
# Kopimi License
|
|
2
|
+
|
|
3
|
+
This software is released under the Kopimi License.
|
|
4
|
+
|
|
5
|
+
## Permission
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
8
|
+
this software and associated documentation files (the "Software"), to copy,
|
|
9
|
+
modify, merge, publish, distribute, sublicense, sell, use, study,
|
|
10
|
+
reverse-engineer, decompile, and otherwise deal in the Software without
|
|
11
|
+
restriction, including without limitation for commercial or non-commercial
|
|
12
|
+
purposes.
|
|
13
|
+
|
|
14
|
+
Commercial use, sale, resale, or distribution for profit must include clear
|
|
15
|
+
attribution to the original author(s) in the distributed copy and in any
|
|
16
|
+
customary public-facing product notices, documentation, credits, or legal
|
|
17
|
+
notices associated with that use.
|
|
18
|
+
|
|
19
|
+
## Kopimi Propagation
|
|
20
|
+
|
|
21
|
+
The Software is Kopimi. Copies, substantial portions, and derivative works must
|
|
22
|
+
preserve the freedom to copy, share, modify, remix, and redistribute the
|
|
23
|
+
Software. No copy, substantial portion, or derivative work may be distributed
|
|
24
|
+
under terms that prohibit those freedoms.
|
|
25
|
+
|
|
26
|
+
License notices, author notices, and Kopimi notices included with the Software
|
|
27
|
+
may not be removed from redistributed copies, substantial portions, or
|
|
28
|
+
derivative works.
|
|
29
|
+
|
|
30
|
+
Attribution to the original author(s) is appreciated for non-commercial use and
|
|
31
|
+
required for commercial use as described above.
|
|
32
|
+
|
|
33
|
+
## Disclaimer
|
|
34
|
+
|
|
35
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
36
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
37
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE
|
|
38
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
39
|
+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
40
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
41
|
+
|
|
42
|
+
This license is itself Kopimi. Copy it, use it, and remix it.
|
|
43
|
+
|
|
44
|
+
For more information, please refer to <https://kopimi.com>
|
package/README.md
CHANGED
|
@@ -1,142 +1,142 @@
|
|
|
1
|
-
# 🔥 fhirStarter
|
|
2
|
-
|
|
3
|
-
SMART on FHIR Backend Services auth lifecycle for any FHIR client.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
npm install fhirstarterjs
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
This example uses the official `fhirclient` package as the FHIR client; `fhirStarter` only manages auth.
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import FHIR from "fhirclient"
|
|
17
|
-
import fhirStarter from "fhirstarterjs"
|
|
18
|
-
|
|
19
|
-
const auth = new fhirStarter({
|
|
20
|
-
clientId: "your-client-id",
|
|
21
|
-
privateKey: "./privatekey.pem",
|
|
22
|
-
tokenEndpointUrl: "https://fhir.epic.com/interconnect-fhir-oauth/oauth2/token",
|
|
23
|
-
scopes: ["system/Patient.rs", "system/Observation.rs"],
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
await auth.start()
|
|
27
|
-
|
|
28
|
-
const client = FHIR.client({
|
|
29
|
-
serverUrl: "https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4",
|
|
30
|
-
tokenResponse: auth.tokenResponse(),
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const bundle = await client.request("Patient?family=Smith")
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
`auth.start()` fetches the first token and starts the proactive refresh loop. `auth.tokenResponse()` returns a live getter-backed object — `fhirclient` reads `access_token` dynamically per request, so it always picks up the latest token.
|
|
37
|
-
|
|
38
|
-
`fhirStarter` does not fetch FHIR resources and does not bundle a FHIR client. It manages the auth lifecycle; the FHIR client does the rest.
|
|
39
|
-
|
|
40
|
-
`privateKey` can be PEM text, a `Buffer` from `readFileSync`, or a path to a PKCS#8 PEM file.
|
|
41
|
-
|
|
42
|
-
## TypeScript types
|
|
43
|
-
|
|
44
|
-
If needed, you can import the public types directly:
|
|
45
|
-
|
|
46
|
-
```ts
|
|
47
|
-
import type { AuthConfig, JwkSet, LiveTokenResponse, Provider } from "fhirstarterjs"
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Other FHIR clients
|
|
51
|
-
|
|
52
|
-
For clients with a bearer token setter (e.g. `fhir-kit-client`):
|
|
53
|
-
|
|
54
|
-
```ts
|
|
55
|
-
const unsubscribe = auth.onRefresh((token) => {
|
|
56
|
-
client.bearerToken = token
|
|
57
|
-
})
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
For raw `fetch` or any other HTTP client:
|
|
61
|
-
|
|
62
|
-
```ts
|
|
63
|
-
const token = await auth.getAccessToken()
|
|
64
|
-
const res = await fetch(url, {
|
|
65
|
-
headers: { Authorization: `Bearer ${token}` },
|
|
66
|
-
})
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## API
|
|
70
|
-
|
|
71
|
-
`new fhirStarter(config)`
|
|
72
|
-
|
|
73
|
-
| Member | Returns | Description |
|
|
74
|
-
|---|---|---|
|
|
75
|
-
| `start()` | `Promise<void>` | Fetch first token and begin proactive refresh loop |
|
|
76
|
-
| `stop()` | `void` | Clear the refresh timer |
|
|
77
|
-
| `token` | `string \| null` | Current valid token, or null if expired |
|
|
78
|
-
| `expiresIn` | `number \| null` | Seconds until actual expiry, or null |
|
|
79
|
-
| `authorizationHeader` | `string \| null` | `Bearer <token>` or null |
|
|
80
|
-
| `getAccessToken()` | `Promise<string>` | Async valid token with lazy refresh |
|
|
81
|
-
| `tokenResponse()` | `LiveTokenResponse` | Getter-backed token response for `fhirclient` |
|
|
82
|
-
| `onRefresh(callback)` | `() => void` | Subscribe to token updates — returns unsubscribe |
|
|
83
|
-
| `getJwks()` | `Promise<JwkSet>` | Public JWKS derived from the private key |
|
|
84
|
-
| `fhirStarter.thumbprint(privateKey)` | `string` | RFC 7638 JWK Thumbprint (base64url SHA-256) |
|
|
85
|
-
|
|
86
|
-
`getJwks()` strips private key material — host the output JSON at your registered JWKS URL and pass that URL as `jwksUrl` so the JWT `jku` header is set automatically.
|
|
87
|
-
|
|
88
|
-
## Thumbprint
|
|
89
|
-
|
|
90
|
-
Derive a deterministic `kid` from a private key without instantiating the class:
|
|
91
|
-
|
|
92
|
-
```ts
|
|
93
|
-
import fhirStarter from "fhirstarterjs"
|
|
94
|
-
|
|
95
|
-
const kid = fhirStarter.thumbprint("./privatekey.pem")
|
|
96
|
-
console.log(kid) // base64url SHA-256 of the canonical RSA public JWK
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
This implements RFC 7638 — the SHA-256 of the sorted canonical JWK members `{e, kty, n}`, base64url-encoded. Use it as the `keyId` when registering your JWKS.
|
|
100
|
-
|
|
101
|
-
## JWKS
|
|
102
|
-
|
|
103
|
-
Some SMART Backend Services registrations require a public JWKS URL when using `jku`. Generate it from the same private key you use for auth:
|
|
104
|
-
|
|
105
|
-
```ts
|
|
106
|
-
import { writeFileSync } from "node:fs"
|
|
107
|
-
import fhirStarter from "fhirstarterjs"
|
|
108
|
-
|
|
109
|
-
const auth = new fhirStarter({
|
|
110
|
-
clientId: "your-client-id",
|
|
111
|
-
privateKey: "./privatekey.pem",
|
|
112
|
-
tokenEndpointUrl: "https://fhir.epic.com/interconnect-fhir-oauth/oauth2/token",
|
|
113
|
-
scopes: ["system/Patient.rs"],
|
|
114
|
-
keyId: "my-key-id",
|
|
115
|
-
jwksUrl: "https://example.com/.well-known/jwks.json",
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
// No need to call auth.start() — getJwks() only needs the private key.
|
|
119
|
-
const jwks = await auth.getJwks()
|
|
120
|
-
writeFileSync("./jwks.json", JSON.stringify(jwks, null, 3))
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Host `jwks.json` at the exact URL you register with your authorization server, then pass that URL as `jwksUrl`. If you set `keyId`, the generated key includes `kid`, and signed JWTs use the same `kid` header.
|
|
124
|
-
|
|
125
|
-
## Compatibility
|
|
126
|
-
|
|
127
|
-
`tokenResponse()` is designed for `fhirclient.request()`. If a client copies the token at construction time rather than reading it per-request, use `onRefresh()` to update or recreate that client instead. If `fhirclient` clears its internal state after a 401, recreate the client instance with `auth.tokenResponse()`.
|
|
128
|
-
|
|
129
|
-
## Scripts
|
|
130
|
-
|
|
131
|
-
| Command | What |
|
|
132
|
-
|---|---|
|
|
133
|
-
| `npm run check` | `tsc --noEmit` |
|
|
134
|
-
| `npm run build` | Compile to `dist/` |
|
|
135
|
-
|
|
136
|
-
## Notes
|
|
137
|
-
|
|
138
|
-
- Call `auth.start()` to fetch the first token and begin the proactive refresh loop — call `auth.stop()` during shutdown in long-running processes
|
|
139
|
-
- Tokens are cached with separate refresh and expiry timestamps — if a refresh fails but the token is not yet expired, the old token remains usable
|
|
140
|
-
- Concurrent callers share a single in-flight token refresh
|
|
141
|
-
- JWT assertions are signed RS384, expire after 5 minutes
|
|
142
|
-
- Requires Node 20+, a PKCS#8 RSA key, and SMART Backend Services scopes
|
|
1
|
+
# 🔥 fhirStarter
|
|
2
|
+
|
|
3
|
+
SMART on FHIR Backend Services auth lifecycle for any FHIR client.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install fhirstarterjs
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
This example uses the official `fhirclient` package as the FHIR client; `fhirStarter` only manages auth.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import FHIR from "fhirclient"
|
|
17
|
+
import fhirStarter from "fhirstarterjs"
|
|
18
|
+
|
|
19
|
+
const auth = new fhirStarter({
|
|
20
|
+
clientId: "your-client-id",
|
|
21
|
+
privateKey: "./privatekey.pem",
|
|
22
|
+
tokenEndpointUrl: "https://fhir.epic.com/interconnect-fhir-oauth/oauth2/token",
|
|
23
|
+
scopes: ["system/Patient.rs", "system/Observation.rs"],
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
await auth.start()
|
|
27
|
+
|
|
28
|
+
const client = FHIR.client({
|
|
29
|
+
serverUrl: "https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4",
|
|
30
|
+
tokenResponse: auth.tokenResponse(),
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const bundle = await client.request("Patient?family=Smith")
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`auth.start()` fetches the first token and starts the proactive refresh loop. `auth.tokenResponse()` returns a live getter-backed object — `fhirclient` reads `access_token` dynamically per request, so it always picks up the latest token.
|
|
37
|
+
|
|
38
|
+
`fhirStarter` does not fetch FHIR resources and does not bundle a FHIR client. It manages the auth lifecycle; the FHIR client does the rest.
|
|
39
|
+
|
|
40
|
+
`privateKey` can be PEM text, a `Buffer` from `readFileSync`, or a path to a PKCS#8 PEM file.
|
|
41
|
+
|
|
42
|
+
## TypeScript types
|
|
43
|
+
|
|
44
|
+
If needed, you can import the public types directly:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import type { AuthConfig, JwkSet, LiveTokenResponse, Provider } from "fhirstarterjs"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Other FHIR clients
|
|
51
|
+
|
|
52
|
+
For clients with a bearer token setter (e.g. `fhir-kit-client`):
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
const unsubscribe = auth.onRefresh((token) => {
|
|
56
|
+
client.bearerToken = token
|
|
57
|
+
})
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
For raw `fetch` or any other HTTP client:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
const token = await auth.getAccessToken()
|
|
64
|
+
const res = await fetch(url, {
|
|
65
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## API
|
|
70
|
+
|
|
71
|
+
`new fhirStarter(config)`
|
|
72
|
+
|
|
73
|
+
| Member | Returns | Description |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| `start()` | `Promise<void>` | Fetch first token and begin proactive refresh loop |
|
|
76
|
+
| `stop()` | `void` | Clear the refresh timer |
|
|
77
|
+
| `token` | `string \| null` | Current valid token, or null if expired |
|
|
78
|
+
| `expiresIn` | `number \| null` | Seconds until actual expiry, or null |
|
|
79
|
+
| `authorizationHeader` | `string \| null` | `Bearer <token>` or null |
|
|
80
|
+
| `getAccessToken()` | `Promise<string>` | Async valid token with lazy refresh |
|
|
81
|
+
| `tokenResponse()` | `LiveTokenResponse` | Getter-backed token response for `fhirclient` |
|
|
82
|
+
| `onRefresh(callback)` | `() => void` | Subscribe to token updates — returns unsubscribe |
|
|
83
|
+
| `getJwks()` | `Promise<JwkSet>` | Public JWKS derived from the private key |
|
|
84
|
+
| `fhirStarter.thumbprint(privateKey)` | `string` | RFC 7638 JWK Thumbprint (base64url SHA-256) |
|
|
85
|
+
|
|
86
|
+
`getJwks()` strips private key material — host the output JSON at your registered JWKS URL and pass that URL as `jwksUrl` so the JWT `jku` header is set automatically.
|
|
87
|
+
|
|
88
|
+
## Thumbprint
|
|
89
|
+
|
|
90
|
+
Derive a deterministic `kid` from a private key without instantiating the class:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import fhirStarter from "fhirstarterjs"
|
|
94
|
+
|
|
95
|
+
const kid = fhirStarter.thumbprint("./privatekey.pem")
|
|
96
|
+
console.log(kid) // base64url SHA-256 of the canonical RSA public JWK
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
This implements RFC 7638 — the SHA-256 of the sorted canonical JWK members `{e, kty, n}`, base64url-encoded. Use it as the `keyId` when registering your JWKS.
|
|
100
|
+
|
|
101
|
+
## JWKS
|
|
102
|
+
|
|
103
|
+
Some SMART Backend Services registrations require a public JWKS URL when using `jku`. Generate it from the same private key you use for auth:
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
import { writeFileSync } from "node:fs"
|
|
107
|
+
import fhirStarter from "fhirstarterjs"
|
|
108
|
+
|
|
109
|
+
const auth = new fhirStarter({
|
|
110
|
+
clientId: "your-client-id",
|
|
111
|
+
privateKey: "./privatekey.pem",
|
|
112
|
+
tokenEndpointUrl: "https://fhir.epic.com/interconnect-fhir-oauth/oauth2/token",
|
|
113
|
+
scopes: ["system/Patient.rs"],
|
|
114
|
+
keyId: "my-key-id",
|
|
115
|
+
jwksUrl: "https://example.com/.well-known/jwks.json",
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
// No need to call auth.start() — getJwks() only needs the private key.
|
|
119
|
+
const jwks = await auth.getJwks()
|
|
120
|
+
writeFileSync("./jwks.json", JSON.stringify(jwks, null, 3))
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Host `jwks.json` at the exact URL you register with your authorization server, then pass that URL as `jwksUrl`. If you set `keyId`, the generated key includes `kid`, and signed JWTs use the same `kid` header.
|
|
124
|
+
|
|
125
|
+
## Compatibility
|
|
126
|
+
|
|
127
|
+
`tokenResponse()` is designed for `fhirclient.request()`. If a client copies the token at construction time rather than reading it per-request, use `onRefresh()` to update or recreate that client instead. If `fhirclient` clears its internal state after a 401, recreate the client instance with `auth.tokenResponse()`.
|
|
128
|
+
|
|
129
|
+
## Scripts
|
|
130
|
+
|
|
131
|
+
| Command | What |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `npm run check` | `tsc --noEmit` |
|
|
134
|
+
| `npm run build` | Compile to `dist/` |
|
|
135
|
+
|
|
136
|
+
## Notes
|
|
137
|
+
|
|
138
|
+
- Call `auth.start()` to fetch the first token and begin the proactive refresh loop — call `auth.stop()` during shutdown in long-running processes
|
|
139
|
+
- Tokens are cached with separate refresh and expiry timestamps — if a refresh fails but the token is not yet expired, the old token remains usable
|
|
140
|
+
- Concurrent callers share a single in-flight token refresh
|
|
141
|
+
- JWT assertions are signed RS384, expire after 5 minutes
|
|
142
|
+
- Requires Node 20+, a PKCS#8 RSA key, and SMART Backend Services scopes
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMART Backend Services auth provider.
|
|
3
|
+
*
|
|
4
|
+
* Manages client-credentials token acquisition and proactive refresh
|
|
5
|
+
* using a private RSA key and the JWT Bearer client-assertion flow (RFC 7523).
|
|
6
|
+
*/
|
|
7
|
+
export default class fhirStarter implements Provider {
|
|
8
|
+
private readonly config;
|
|
9
|
+
private readonly privateKeyText;
|
|
10
|
+
private readonly refreshCallbacks;
|
|
11
|
+
private cache;
|
|
12
|
+
private refreshPromise;
|
|
13
|
+
private refreshTimer;
|
|
14
|
+
private privateKeyObj;
|
|
15
|
+
private started;
|
|
16
|
+
private refreshFailed;
|
|
17
|
+
private refreshRetryMs;
|
|
18
|
+
/**
|
|
19
|
+
* @param config - Auth configuration including client ID, private key, token endpoint, and scopes.
|
|
20
|
+
* @throws If any required field is missing, blank, or invalid.
|
|
21
|
+
*/
|
|
22
|
+
constructor(config: AuthConfig);
|
|
23
|
+
/** The current access token, or `null` if no valid token is cached. */
|
|
24
|
+
get token(): string | null;
|
|
25
|
+
/** Seconds until the cached token expires, or `null` if no valid token is cached. */
|
|
26
|
+
get expiresIn(): number | null;
|
|
27
|
+
/** Ready-to-use `Authorization` header value (e.g. `"Bearer <token>"`), or `null` if no valid token is cached. */
|
|
28
|
+
get authorizationHeader(): string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Acquires an initial token and starts the proactive background refresh timer.
|
|
31
|
+
* Safe to call multiple times — subsequent calls are no-ops.
|
|
32
|
+
* @throws If the initial token acquisition fails.
|
|
33
|
+
*/
|
|
34
|
+
start: () => Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Stops the background refresh timer.
|
|
37
|
+
* Any in-flight refresh will still complete, but no new timers will be scheduled.
|
|
38
|
+
*/
|
|
39
|
+
stop: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Returns a live `LiveTokenResponse` object whose `access_token` and `expires_in`
|
|
42
|
+
* properties are always read from the current cache.
|
|
43
|
+
* Useful for libraries that hold a reference to a token response object.
|
|
44
|
+
*/
|
|
45
|
+
tokenResponse: () => LiveTokenResponse;
|
|
46
|
+
/**
|
|
47
|
+
* Registers a callback that is invoked whenever a new access token is obtained.
|
|
48
|
+
* The callback is called immediately with the current token if one is already cached.
|
|
49
|
+
* @param callback - Receives the new access token string.
|
|
50
|
+
* @returns An unsubscribe function call it to stop receiving updates.
|
|
51
|
+
*/
|
|
52
|
+
onRefresh: (callback: RefreshCallback) => (() => void);
|
|
53
|
+
/**
|
|
54
|
+
* Returns the public JWKS derived from the configured private key.
|
|
55
|
+
* Private key material (`d`, `p`, `q`, etc.) is stripped before returning.
|
|
56
|
+
*/
|
|
57
|
+
getJwks: () => Promise<JwkSet>;
|
|
58
|
+
/**
|
|
59
|
+
* Returns a valid access token, refreshing if the cached token is at or past its refresh threshold.
|
|
60
|
+
* Falls back to a not-yet-expired stale token if the refresh request fails.
|
|
61
|
+
* @throws If no cached token is available and the refresh request fails.
|
|
62
|
+
*/
|
|
63
|
+
getAccessToken: () => Promise<string>;
|
|
64
|
+
private doRefresh;
|
|
65
|
+
private scheduleRefresh;
|
|
66
|
+
private notifyRefresh;
|
|
67
|
+
private refreshAccessToken;
|
|
68
|
+
private getPrivateKey;
|
|
69
|
+
private buildJwt;
|
|
70
|
+
private static normalizeScopes;
|
|
71
|
+
private static resolvePrivateKey;
|
|
72
|
+
/**
|
|
73
|
+
* Derives a deterministic key identifier from a private key using an
|
|
74
|
+
* RFC 7638 JWK Thumbprint (SHA-256 of canonical RSA public JWK members, base64url).
|
|
75
|
+
*
|
|
76
|
+
* @param privateKey - RSA PKCS#8 PEM text, a Buffer, or a readable file path.
|
|
77
|
+
* @returns A base64url-encoded SHA-256 thumbprint string.
|
|
78
|
+
* @throws If the key is not RSA or cannot be parsed.
|
|
79
|
+
*/
|
|
80
|
+
static thumbprint(privateKey: string | Buffer): string;
|
|
81
|
+
}
|
package/dist/fhirstarter.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fhirstarter.js","sourceRoot":"","sources":["../ts/fhirstarter.ts"],"names":[],"mappings":"AAAA,OAAO,EACJ,WAAW,EACX,SAAS,EACT,OAAO,GAET,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGtC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IACZ,MAAM,CAAY;IAClB,cAAc,CAAQ;IACtB,gBAAgB,GAAyB,IAAI,GAAG,EAAE,CAAA;IAC3D,KAAK,GAAsB,IAAI,CAAA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;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,UAA2B;QAC1C,MACG,GAAG,GAAG,WAAW,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAC/C,GAAG,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;QAC9B,IAAI,GAAG,CAAC,iBAAiB,KAAK,KAAK;YAChC,MAAM,IAAI,KAAK,CAAC,qCAAqC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAA;QAChF,MACG,GAAG,GAAG,eAAe,CAAC,GAAgC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAA6C,EAC7H,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAA;QACjE,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IACpE,CAAC;CACH"}
|
package/package.json
CHANGED
|
@@ -1,62 +1,76 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "fhirstarterjs",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "SMART Backend Services auth lifecycle for any FHIR client",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"healthcare",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "fhirstarterjs",
|
|
3
|
+
"version": "1.0.9",
|
|
4
|
+
"description": "SMART on FHIR Backend Services (client credentials) auth lifecycle for any FHIR client — JWT assertion, JWKS, and automatic token refresh.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"fhir",
|
|
7
|
+
"smart-on-fhir",
|
|
8
|
+
"smart",
|
|
9
|
+
"backend-services",
|
|
10
|
+
"smart-backend-services",
|
|
11
|
+
"fhir-auth",
|
|
12
|
+
"fhir-client",
|
|
13
|
+
"fhirclient",
|
|
14
|
+
"oauth",
|
|
15
|
+
"oauth2",
|
|
16
|
+
"client-credentials",
|
|
17
|
+
"jwt",
|
|
18
|
+
"jwt-assertion",
|
|
19
|
+
"jwks",
|
|
20
|
+
"token",
|
|
21
|
+
"token-refresh",
|
|
22
|
+
"access-token",
|
|
23
|
+
"healthcare",
|
|
24
|
+
"hl7",
|
|
25
|
+
"ehr",
|
|
26
|
+
"r4",
|
|
27
|
+
"interoperability"
|
|
28
|
+
],
|
|
29
|
+
"author": "Joshua Faulkenberry <j@joshuafaulkenberry.com> (https://joshuafaulkenberry.com/)",
|
|
30
|
+
"license": "Kopimi",
|
|
31
|
+
"homepage": "https://github.com/faulkj/fhirStarter#readme",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/faulkj/fhirStarter.git"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/faulkj/fhirStarter/issues"
|
|
38
|
+
},
|
|
39
|
+
"type": "module",
|
|
40
|
+
"main": "./dist/fhirstarter.js",
|
|
41
|
+
"types": "./types/index.d.ts",
|
|
42
|
+
"exports": {
|
|
43
|
+
".": {
|
|
44
|
+
"types": "./types/index.d.ts",
|
|
45
|
+
"import": "./dist/fhirstarter.js"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"sideEffects": false,
|
|
49
|
+
"files": [
|
|
50
|
+
"dist",
|
|
51
|
+
"ts",
|
|
52
|
+
"types",
|
|
53
|
+
"README.md",
|
|
54
|
+
"LICENSE.md"
|
|
55
|
+
],
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"provenance": true,
|
|
58
|
+
"access": "public"
|
|
59
|
+
},
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=20"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"check": "tsc --noEmit",
|
|
65
|
+
"clean": "node -e \"fs.rmSync('dist',{recursive:true,force:true})\"",
|
|
66
|
+
"build": "npm run clean && tsc -p tsconfig.build.json",
|
|
67
|
+
"prepack": "npm run build"
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"jose": "^6.2.3"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@types/node": "^26.1.1",
|
|
74
|
+
"typescript": "^7.0.2"
|
|
75
|
+
}
|
|
76
|
+
}
|