@onkernel/sdk 0.149.0 → 0.151.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 (191) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/client.d.mts +29 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +29 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +32 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +32 -3
  9. package/client.mjs.map +1 -1
  10. package/lib/credentials/client-auth.d.mts +88 -0
  11. package/lib/credentials/client-auth.d.mts.map +1 -0
  12. package/lib/credentials/client-auth.d.ts +88 -0
  13. package/lib/credentials/client-auth.d.ts.map +1 -0
  14. package/lib/credentials/client-auth.js +166 -0
  15. package/lib/credentials/client-auth.js.map +1 -0
  16. package/lib/credentials/client-auth.mjs +162 -0
  17. package/lib/credentials/client-auth.mjs.map +1 -0
  18. package/lib/credentials/credential-chain.d.mts +20 -0
  19. package/lib/credentials/credential-chain.d.mts.map +1 -0
  20. package/lib/credentials/credential-chain.d.ts +20 -0
  21. package/lib/credentials/credential-chain.d.ts.map +1 -0
  22. package/lib/credentials/credential-chain.js +81 -0
  23. package/lib/credentials/credential-chain.js.map +1 -0
  24. package/lib/credentials/credential-chain.mjs +77 -0
  25. package/lib/credentials/credential-chain.mjs.map +1 -0
  26. package/lib/credentials/identity-token.d.mts +59 -0
  27. package/lib/credentials/identity-token.d.mts.map +1 -0
  28. package/lib/credentials/identity-token.d.ts +59 -0
  29. package/lib/credentials/identity-token.d.ts.map +1 -0
  30. package/lib/credentials/identity-token.js +243 -0
  31. package/lib/credentials/identity-token.js.map +1 -0
  32. package/lib/credentials/identity-token.mjs +202 -0
  33. package/lib/credentials/identity-token.mjs.map +1 -0
  34. package/lib/credentials/oidc-federation.d.mts +65 -0
  35. package/lib/credentials/oidc-federation.d.mts.map +1 -0
  36. package/lib/credentials/oidc-federation.d.ts +65 -0
  37. package/lib/credentials/oidc-federation.d.ts.map +1 -0
  38. package/lib/credentials/oidc-federation.js +200 -0
  39. package/lib/credentials/oidc-federation.js.map +1 -0
  40. package/lib/credentials/oidc-federation.mjs +196 -0
  41. package/lib/credentials/oidc-federation.mjs.map +1 -0
  42. package/lib/credentials/token-cache.d.mts +64 -0
  43. package/lib/credentials/token-cache.d.mts.map +1 -0
  44. package/lib/credentials/token-cache.d.ts +64 -0
  45. package/lib/credentials/token-cache.d.ts.map +1 -0
  46. package/lib/credentials/token-cache.js +147 -0
  47. package/lib/credentials/token-cache.js.map +1 -0
  48. package/lib/credentials/token-cache.mjs +143 -0
  49. package/lib/credentials/token-cache.mjs.map +1 -0
  50. package/lib/credentials/types.d.mts +126 -0
  51. package/lib/credentials/types.d.mts.map +1 -0
  52. package/lib/credentials/types.d.ts +126 -0
  53. package/lib/credentials/types.d.ts.map +1 -0
  54. package/lib/credentials/types.js +182 -0
  55. package/lib/credentials/types.js.map +1 -0
  56. package/lib/credentials/types.mjs +169 -0
  57. package/lib/credentials/types.mjs.map +1 -0
  58. package/lib/credentials.d.mts +6 -0
  59. package/lib/credentials.d.mts.map +1 -0
  60. package/lib/credentials.d.ts +6 -0
  61. package/lib/credentials.d.ts.map +1 -0
  62. package/lib/credentials.js +19 -0
  63. package/lib/credentials.js.map +1 -0
  64. package/lib/credentials.mjs +6 -0
  65. package/lib/credentials.mjs.map +1 -0
  66. package/package.json +9 -1
  67. package/resources/api-keys.d.mts +192 -16
  68. package/resources/api-keys.d.mts.map +1 -1
  69. package/resources/api-keys.d.ts +192 -16
  70. package/resources/api-keys.d.ts.map +1 -1
  71. package/resources/api-keys.js +19 -7
  72. package/resources/api-keys.js.map +1 -1
  73. package/resources/api-keys.mjs +19 -7
  74. package/resources/api-keys.mjs.map +1 -1
  75. package/resources/auth/auth.d.mts +2 -2
  76. package/resources/auth/auth.d.mts.map +1 -1
  77. package/resources/auth/auth.d.ts +2 -2
  78. package/resources/auth/auth.d.ts.map +1 -1
  79. package/resources/auth/auth.js.map +1 -1
  80. package/resources/auth/auth.mjs.map +1 -1
  81. package/resources/auth/connections.d.mts +16 -2
  82. package/resources/auth/connections.d.mts.map +1 -1
  83. package/resources/auth/connections.d.ts +16 -2
  84. package/resources/auth/connections.d.ts.map +1 -1
  85. package/resources/auth/context.d.mts +69 -3
  86. package/resources/auth/context.d.mts.map +1 -1
  87. package/resources/auth/context.d.ts +69 -3
  88. package/resources/auth/context.d.ts.map +1 -1
  89. package/resources/auth/index.d.mts +1 -1
  90. package/resources/auth/index.d.mts.map +1 -1
  91. package/resources/auth/index.d.ts +1 -1
  92. package/resources/auth/index.d.ts.map +1 -1
  93. package/resources/auth/index.js.map +1 -1
  94. package/resources/auth/index.mjs.map +1 -1
  95. package/resources/browser-pools.d.mts +41 -6
  96. package/resources/browser-pools.d.mts.map +1 -1
  97. package/resources/browser-pools.d.ts +41 -6
  98. package/resources/browser-pools.d.ts.map +1 -1
  99. package/resources/browsers/browsers.d.mts +105 -45
  100. package/resources/browsers/browsers.d.mts.map +1 -1
  101. package/resources/browsers/browsers.d.ts +105 -45
  102. package/resources/browsers/browsers.d.ts.map +1 -1
  103. package/resources/browsers/browsers.js.map +1 -1
  104. package/resources/browsers/browsers.mjs.map +1 -1
  105. package/resources/browsers/index.d.mts +1 -1
  106. package/resources/browsers/index.d.mts.map +1 -1
  107. package/resources/browsers/index.d.ts +1 -1
  108. package/resources/browsers/index.d.ts.map +1 -1
  109. package/resources/browsers/index.js.map +1 -1
  110. package/resources/browsers/index.mjs.map +1 -1
  111. package/resources/browsers/telemetry.d.mts +4 -4
  112. package/resources/browsers/telemetry.d.mts.map +1 -1
  113. package/resources/browsers/telemetry.d.ts +4 -4
  114. package/resources/browsers/telemetry.d.ts.map +1 -1
  115. package/resources/index.d.mts +6 -2
  116. package/resources/index.d.mts.map +1 -1
  117. package/resources/index.d.ts +6 -2
  118. package/resources/index.d.ts.map +1 -1
  119. package/resources/index.js +9 -1
  120. package/resources/index.js.map +1 -1
  121. package/resources/index.mjs +4 -0
  122. package/resources/index.mjs.map +1 -1
  123. package/resources/invocations.d.mts +13 -1
  124. package/resources/invocations.d.mts.map +1 -1
  125. package/resources/invocations.d.ts +13 -1
  126. package/resources/invocations.d.ts.map +1 -1
  127. package/resources/service-accounts.d.mts +73 -0
  128. package/resources/service-accounts.d.mts.map +1 -0
  129. package/resources/service-accounts.d.ts +73 -0
  130. package/resources/service-accounts.d.ts.map +1 -0
  131. package/resources/service-accounts.js +50 -0
  132. package/resources/service-accounts.js.map +1 -0
  133. package/resources/service-accounts.mjs +46 -0
  134. package/resources/service-accounts.mjs.map +1 -0
  135. package/resources/vaults/items.d.mts +68 -2
  136. package/resources/vaults/items.d.mts.map +1 -1
  137. package/resources/vaults/items.d.ts +68 -2
  138. package/resources/vaults/items.d.ts.map +1 -1
  139. package/resources/workload-identity-authentication-events.d.mts +36 -0
  140. package/resources/workload-identity-authentication-events.d.mts.map +1 -0
  141. package/resources/workload-identity-authentication-events.d.ts +36 -0
  142. package/resources/workload-identity-authentication-events.d.ts.map +1 -0
  143. package/resources/workload-identity-authentication-events.js +16 -0
  144. package/resources/workload-identity-authentication-events.js.map +1 -0
  145. package/resources/workload-identity-authentication-events.mjs +12 -0
  146. package/resources/workload-identity-authentication-events.mjs.map +1 -0
  147. package/resources/workload-identity-federation-rules.d.mts +194 -0
  148. package/resources/workload-identity-federation-rules.d.mts.map +1 -0
  149. package/resources/workload-identity-federation-rules.d.ts +194 -0
  150. package/resources/workload-identity-federation-rules.d.ts.map +1 -0
  151. package/resources/workload-identity-federation-rules.js +47 -0
  152. package/resources/workload-identity-federation-rules.js.map +1 -0
  153. package/resources/workload-identity-federation-rules.mjs +43 -0
  154. package/resources/workload-identity-federation-rules.mjs.map +1 -0
  155. package/resources/workload-identity-issuers.d.mts +169 -0
  156. package/resources/workload-identity-issuers.d.mts.map +1 -0
  157. package/resources/workload-identity-issuers.d.ts +169 -0
  158. package/resources/workload-identity-issuers.d.ts.map +1 -0
  159. package/resources/workload-identity-issuers.js +54 -0
  160. package/resources/workload-identity-issuers.js.map +1 -0
  161. package/resources/workload-identity-issuers.mjs +50 -0
  162. package/resources/workload-identity-issuers.mjs.map +1 -0
  163. package/src/client.ts +134 -1
  164. package/src/lib/credentials/client-auth.ts +194 -0
  165. package/src/lib/credentials/credential-chain.ts +95 -0
  166. package/src/lib/credentials/identity-token.ts +284 -0
  167. package/src/lib/credentials/oidc-federation.ts +304 -0
  168. package/src/lib/credentials/token-cache.ts +172 -0
  169. package/src/lib/credentials/types.ts +267 -0
  170. package/src/lib/credentials.ts +30 -0
  171. package/src/resources/api-keys.ts +217 -15
  172. package/src/resources/auth/auth.ts +6 -2
  173. package/src/resources/auth/connections.ts +17 -2
  174. package/src/resources/auth/context.ts +81 -3
  175. package/src/resources/auth/index.ts +1 -1
  176. package/src/resources/browser-pools.ts +46 -6
  177. package/src/resources/browsers/browsers.ts +115 -44
  178. package/src/resources/browsers/index.ts +1 -0
  179. package/src/resources/browsers/telemetry.ts +4 -3
  180. package/src/resources/index.ts +42 -0
  181. package/src/resources/invocations.ts +15 -1
  182. package/src/resources/service-accounts.ts +128 -0
  183. package/src/resources/vaults/items.ts +80 -2
  184. package/src/resources/workload-identity-authentication-events.ts +72 -0
  185. package/src/resources/workload-identity-federation-rules.ts +314 -0
  186. package/src/resources/workload-identity-issuers.ts +273 -0
  187. package/src/version.ts +1 -1
  188. package/version.d.mts +1 -1
  189. package/version.d.ts +1 -1
  190. package/version.js +1 -1
  191. package/version.mjs +1 -1
@@ -0,0 +1,59 @@
1
+ import type { Fetch } from "../../internal/builtin-types.js";
2
+ import type { IdentityTokenProvider } from "./types.js";
3
+ export type IdentityTokenSourceOptions = {
4
+ /**
5
+ * The audience to request. Defaults to `KERNEL_IDENTITY_TOKEN_AUDIENCE`,
6
+ * else the auth base URL (for example `https://auth.onkernel.com`). The
7
+ * federation rule's `expected_audience` must be set to the same value.
8
+ */
9
+ audience?: string | undefined;
10
+ /** Defaults to the `fetch` of the client using the source, else the global `fetch`. */
11
+ fetch?: Fetch | undefined;
12
+ };
13
+ /**
14
+ * What to tell the caller when the token endpoint reports that the token
15
+ * this provider returned was already used. The advice depends on where the
16
+ * token comes from, which only the built-in file and static sources know.
17
+ */
18
+ export declare function replayHintFor(provider: IdentityTokenProvider): string;
19
+ /**
20
+ * Reads the token from a file on every call, so a token the platform rotates
21
+ * (such as a Kubernetes projected service account token) is picked up.
22
+ */
23
+ export declare function identityTokenFromFile(path: string): IdentityTokenProvider;
24
+ /**
25
+ * Wraps one token as an {@link IdentityTokenProvider} that can be used for
26
+ * exactly one exchange.
27
+ *
28
+ * Most providers' tokens are single-use, and a fixed value cannot be
29
+ * replaced with a fresh one, so the second call throws instead of sending
30
+ * the same token again. Use {@link identityTokenFromFile}, a built-in source
31
+ * or your own callback for anything that outlives one access token.
32
+ */
33
+ export declare function identityTokenFromValue(token: string): IdentityTokenProvider;
34
+ /**
35
+ * Requests an ID token from GitHub Actions. The workflow or job needs
36
+ * `permissions: id-token: write`.
37
+ */
38
+ export declare function identityTokenFromGitHubActions(options?: IdentityTokenSourceOptions): IdentityTokenProvider;
39
+ /**
40
+ * Requests an identity token for the attached service account from the
41
+ * Google Cloud metadata server.
42
+ */
43
+ export declare function identityTokenFromGCPMetadata(options?: IdentityTokenSourceOptions): IdentityTokenProvider;
44
+ export type AWSSTSIdentityTokenOptions = {
45
+ /** See {@link IdentityTokenSourceOptions.audience}. */
46
+ audience?: string | undefined;
47
+ /** Defaults to `AWS_REGION`, else `AWS_DEFAULT_REGION`, else `us-east-1`. */
48
+ region?: string | undefined;
49
+ };
50
+ /**
51
+ * Requests a token from AWS STS `GetWebIdentityToken` with the workload's
52
+ * ambient AWS credentials.
53
+ *
54
+ * Needs the optional `@aws-sdk/client-sts` package, which is loaded on first
55
+ * use. The call goes to a regional STS endpoint through the AWS SDK's own
56
+ * HTTP client, not the Kernel client's `fetch`.
57
+ */
58
+ export declare function identityTokenFromAWSSTS(options?: AWSSTSIdentityTokenOptions): IdentityTokenProvider;
59
+ //# sourceMappingURL=identity-token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-token.d.ts","sourceRoot":"","sources":["../../src/lib/credentials/identity-token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,wCAAqC;AAG1D,OAAO,KAAK,EAAE,qBAAqB,EAAwB,mBAAgB;AAU3E,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,uFAAuF;IACvF,KAAK,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;CAC3B,CAAC;AAIF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,qBAAqB,GAAG,MAAM,CAKrE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CA+BzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,CAmB3E;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,GAAE,0BAA+B,GACvC,qBAAqB,CA0BvB;AAKD;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,GAAE,0BAA+B,GACvC,qBAAqB,CAavB;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAYF;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,0BAA+B,GAAG,qBAAqB,CA6BvG"}
@@ -0,0 +1,243 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.replayHintFor = replayHintFor;
37
+ exports.identityTokenFromFile = identityTokenFromFile;
38
+ exports.identityTokenFromValue = identityTokenFromValue;
39
+ exports.identityTokenFromGitHubActions = identityTokenFromGitHubActions;
40
+ exports.identityTokenFromGCPMetadata = identityTokenFromGCPMetadata;
41
+ exports.identityTokenFromAWSSTS = identityTokenFromAWSSTS;
42
+ const shims_1 = require("../../internal/shims.js");
43
+ const env_1 = require("../../internal/utils/env.js");
44
+ const types_1 = require("./types.js");
45
+ const replayHints = new WeakMap();
46
+ /**
47
+ * What to tell the caller when the token endpoint reports that the token
48
+ * this provider returned was already used. The advice depends on where the
49
+ * token comes from, which only the built-in file and static sources know.
50
+ */
51
+ function replayHintFor(provider) {
52
+ return (replayHints.get(provider) ??
53
+ 'Every exchange needs a fresh provider token, and the identity token provider returned one that was already exchanged.');
54
+ }
55
+ /**
56
+ * Reads the token from a file on every call, so a token the platform rotates
57
+ * (such as a Kubernetes projected service account token) is picked up.
58
+ */
59
+ function identityTokenFromFile(path) {
60
+ if (!path) {
61
+ throw new types_1.WorkloadIdentityError('Identity token file path is empty');
62
+ }
63
+ const provider = async () => {
64
+ let content;
65
+ try {
66
+ // Loaded on first use, and not as a literal specifier, so the SDK still
67
+ // loads and bundles on runtimes that have no file system.
68
+ const specifier = 'node:fs/promises';
69
+ const fs = await Promise.resolve(`${
70
+ /* webpackIgnore: true */ /* @vite-ignore */ specifier}`).then(s => __importStar(require(s)));
71
+ content = await fs.readFile(path, 'utf-8');
72
+ }
73
+ catch (err) {
74
+ throw new types_1.WorkloadIdentityError(`Failed to read identity token file at ${path}: ${err}`, {
75
+ cause: err,
76
+ });
77
+ }
78
+ const token = content.trim();
79
+ if (!token) {
80
+ throw new types_1.WorkloadIdentityError(`Identity token file at ${path} is empty`);
81
+ }
82
+ return token;
83
+ };
84
+ replayHints.set(provider, `Every exchange needs a fresh provider token, and the identity token file at ${path} held the same token as a previous exchange. Whatever writes that file must replace the token before each refresh. For a Kubernetes projected service account token, which the kubelet replaces only as it nears expiry, configure the issuer in Kernel to allow reuse instead.`);
85
+ return provider;
86
+ }
87
+ /**
88
+ * Wraps one token as an {@link IdentityTokenProvider} that can be used for
89
+ * exactly one exchange.
90
+ *
91
+ * Most providers' tokens are single-use, and a fixed value cannot be
92
+ * replaced with a fresh one, so the second call throws instead of sending
93
+ * the same token again. Use {@link identityTokenFromFile}, a built-in source
94
+ * or your own callback for anything that outlives one access token.
95
+ */
96
+ function identityTokenFromValue(token) {
97
+ if (!token) {
98
+ throw new types_1.WorkloadIdentityError('Identity token value is empty');
99
+ }
100
+ let used = false;
101
+ const provider = () => {
102
+ if (used) {
103
+ throw new types_1.WorkloadIdentityError('The static identity token has already been exchanged once and cannot be reused: every exchange needs a fresh provider token. A static token (such as KERNEL_IDENTITY_TOKEN) is good for one access token only. To keep a client authenticated, use a source that returns a fresh token on every call: KERNEL_IDENTITY_TOKEN_FILE, KERNEL_IDENTITY_TOKEN_SOURCE, or an identityTokenProvider callback.');
104
+ }
105
+ used = true;
106
+ return token;
107
+ };
108
+ replayHints.set(provider, 'Every exchange needs a fresh provider token; a static KERNEL_IDENTITY_TOKEN can be exchanged only once.');
109
+ return provider;
110
+ }
111
+ /**
112
+ * Requests an ID token from GitHub Actions. The workflow or job needs
113
+ * `permissions: id-token: write`.
114
+ */
115
+ function identityTokenFromGitHubActions(options = {}) {
116
+ return async (request) => {
117
+ const requestURL = (0, env_1.readEnv)('ACTIONS_ID_TOKEN_REQUEST_URL');
118
+ const requestToken = (0, env_1.readEnv)('ACTIONS_ID_TOKEN_REQUEST_TOKEN');
119
+ if (!requestURL || !requestToken) {
120
+ throw new types_1.WorkloadIdentityError('GitHub Actions did not provide an ID token endpoint: ACTIONS_ID_TOKEN_REQUEST_URL and ACTIONS_ID_TOKEN_REQUEST_TOKEN are not set. Add `permissions: id-token: write` to the workflow or job.');
121
+ }
122
+ const audience = encodeURIComponent(resolveAudience(options, request));
123
+ const url = `${requestURL}${requestURL.includes('?') ? '&' : '?'}audience=${audience}`;
124
+ const body = await fetchIdentityToken('GitHub Actions ID token endpoint', options, request, url, {
125
+ Accept: 'application/json',
126
+ Authorization: `Bearer ${requestToken}`,
127
+ });
128
+ let token;
129
+ try {
130
+ token = JSON.parse(body)?.value;
131
+ }
132
+ catch {
133
+ token = undefined;
134
+ }
135
+ if (typeof token !== 'string' || !token) {
136
+ throw new types_1.WorkloadIdentityError('GitHub Actions ID token endpoint returned a response with no token');
137
+ }
138
+ return token;
139
+ };
140
+ }
141
+ const GCP_IDENTITY_URL = 'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity';
142
+ /**
143
+ * Requests an identity token for the attached service account from the
144
+ * Google Cloud metadata server.
145
+ */
146
+ function identityTokenFromGCPMetadata(options = {}) {
147
+ return async (request) => {
148
+ const audience = encodeURIComponent(resolveAudience(options, request));
149
+ const url = `${GCP_IDENTITY_URL}?audience=${audience}&format=full`;
150
+ const body = await fetchIdentityToken('Google Cloud metadata server', options, request, url, {
151
+ 'Metadata-Flavor': 'Google',
152
+ });
153
+ const token = body.trim();
154
+ if (!token) {
155
+ throw new types_1.WorkloadIdentityError('Google Cloud metadata server returned an empty identity token');
156
+ }
157
+ return token;
158
+ };
159
+ }
160
+ /**
161
+ * Requests a token from AWS STS `GetWebIdentityToken` with the workload's
162
+ * ambient AWS credentials.
163
+ *
164
+ * Needs the optional `@aws-sdk/client-sts` package, which is loaded on first
165
+ * use. The call goes to a regional STS endpoint through the AWS SDK's own
166
+ * HTTP client, not the Kernel client's `fetch`.
167
+ */
168
+ function identityTokenFromAWSSTS(options = {}) {
169
+ // One client for the life of the source, so the AWS SDK caches and
170
+ // refreshes the ambient credentials itself.
171
+ let client;
172
+ let Command;
173
+ return async (request) => {
174
+ const audience = resolveAudience(options, request);
175
+ if (!client || !Command) {
176
+ const sts = await loadSTS();
177
+ Command = sts.GetWebIdentityTokenCommand;
178
+ client = new sts.STSClient({
179
+ region: options.region || (0, env_1.readEnv)('AWS_REGION') || (0, env_1.readEnv)('AWS_DEFAULT_REGION') || 'us-east-1',
180
+ });
181
+ }
182
+ let token;
183
+ try {
184
+ const response = await client.send(new Command({ Audience: [audience], SigningAlgorithm: 'RS256', DurationSeconds: 300 }));
185
+ token = response.WebIdentityToken;
186
+ }
187
+ catch (err) {
188
+ throw new types_1.WorkloadIdentityError(`AWS STS GetWebIdentityToken failed: ${err}`, { cause: err });
189
+ }
190
+ if (!token) {
191
+ throw new types_1.WorkloadIdentityError('AWS STS GetWebIdentityToken returned no token');
192
+ }
193
+ return token;
194
+ };
195
+ }
196
+ const STS_PACKAGE = '@aws-sdk/client-sts';
197
+ const STS_MIN_VERSION = '3.935.0';
198
+ async function loadSTS() {
199
+ let sts;
200
+ try {
201
+ // Not a literal specifier: the package is optional, and bundlers must not
202
+ // try to resolve it for users who never select this source.
203
+ const specifier = STS_PACKAGE;
204
+ sts = await Promise.resolve(`${specifier}`).then(s => __importStar(require(s)));
205
+ }
206
+ catch (err) {
207
+ throw new types_1.WorkloadIdentityError(`The aws_sts identity token source needs the optional ${STS_PACKAGE} package (version ${STS_MIN_VERSION} or later). Install it with \`npm install ${STS_PACKAGE}\`.`, { cause: err });
208
+ }
209
+ const Command = sts.GetWebIdentityTokenCommand;
210
+ if (typeof Command !== 'function') {
211
+ throw new types_1.WorkloadIdentityError(`The installed ${STS_PACKAGE} is too old to call GetWebIdentityToken; version ${STS_MIN_VERSION} or later is required. Upgrade it with \`npm install ${STS_PACKAGE}@latest\`.`);
212
+ }
213
+ return { STSClient: sts.STSClient, GetWebIdentityTokenCommand: Command };
214
+ }
215
+ function resolveAudience(options, request) {
216
+ return (options.audience || (0, env_1.readEnv)('KERNEL_IDENTITY_TOKEN_AUDIENCE') || request?.audience || (0, types_1.resolveAuthBaseURL)());
217
+ }
218
+ async function fetchIdentityToken(source, options, request, url, headers) {
219
+ const fetch = options.fetch ?? request?.fetch ?? (0, shims_1.getDefaultFetch)();
220
+ const secrets = [(headers['Authorization'] ?? '').replace(/^Bearer /, '')];
221
+ return (0, types_1.withTimeout)(types_1.DEFAULT_CREDENTIALS_TIMEOUT_IN_MS, async (signal) => {
222
+ let response;
223
+ try {
224
+ response = await fetch(url, { method: 'GET', redirect: 'manual', headers, signal });
225
+ }
226
+ catch (err) {
227
+ throw new types_1.WorkloadIdentityError(`Failed to reach the ${source}: ${(0, types_1.describeFailure)(err, secrets)}`);
228
+ }
229
+ if (response.status !== 200) {
230
+ await response.body?.cancel().catch(() => { });
231
+ throw new types_1.WorkloadIdentityError(`The ${source} responded with status ${response.status}`, {
232
+ statusCode: response.status,
233
+ });
234
+ }
235
+ try {
236
+ return await (0, types_1.readLimitedText)(response);
237
+ }
238
+ catch (err) {
239
+ throw new types_1.WorkloadIdentityError(`Failed to read the response from the ${source}: ${(0, types_1.describeFailure)(err, secrets)}`);
240
+ }
241
+ });
242
+ }
243
+ //# sourceMappingURL=identity-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-token.js","sourceRoot":"","sources":["../../src/lib/credentials/identity-token.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,sCAKC;AAMD,sDA+BC;AAWD,wDAmBC;AAMD,wEA4BC;AASD,oEAeC;AA2BD,0DA6BC;AAxND,mDAAuD;AACvD,qDAAmD;AAEnD,sCAOiB;AAajB,MAAM,WAAW,GAAG,IAAI,OAAO,EAAiC,CAAC;AAEjE;;;;GAIG;AACH,SAAgB,aAAa,CAAC,QAA+B;IAC3D,OAAO,CACL,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;QACzB,uHAAuH,CACxH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,IAAY;IAChD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,6BAAqB,CAAC,mCAAmC,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,QAAQ,GAA0B,KAAK,IAAI,EAAE;QACjD,IAAI,OAAe,CAAC;QACpB,IAAI,CAAC;YACH,wEAAwE;YACxE,0DAA0D;YAC1D,MAAM,SAAS,GAAG,kBAAkB,CAAC;YACrC,MAAM,EAAE,GAAsC;YAC5C,yBAAyB,CAAC,kBAAkB,CAAC,SAAS,uCACvD,CAAC;YACF,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,6BAAqB,CAAC,yCAAyC,IAAI,KAAK,GAAG,EAAE,EAAE;gBACvF,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;QACL,CAAC;QACD,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,KAAK,EAAE,C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C3E,OAAO,IAAA,mBAAW,EAAC,yCAAiC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACrE,IAAI,QAAkB,CAAC;QACvB,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACtF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,6BAAqB,CAAC,uBAAuB,MAAM,KAAK,IAAA,uBAAe,EAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QACrG,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAC9C,MAAM,IAAI,6BAAqB,CAAC,OAAO,MAAM,0BAA0B,QAAQ,CAAC,MAAM,EAAE,EAAE;gBACxF,UAAU,EAAE,QAAQ,CAAC,MAAM;aAC5B,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC;YACH,OAAO,MAAM,IAAA,uBAAe,EAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,6BAAqB,CAC7B,wCAAwC,MAAM,KAAK,IAAA,uBAAe,EAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CACnF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,202 @@
1
+ import { getDefaultFetch } from "../../internal/shims.mjs";
2
+ import { readEnv } from "../../internal/utils/env.mjs";
3
+ import { DEFAULT_CREDENTIALS_TIMEOUT_IN_MS, describeFailure, WorkloadIdentityError, readLimitedText, resolveAuthBaseURL, withTimeout, } from "./types.mjs";
4
+ const replayHints = new WeakMap();
5
+ /**
6
+ * What to tell the caller when the token endpoint reports that the token
7
+ * this provider returned was already used. The advice depends on where the
8
+ * token comes from, which only the built-in file and static sources know.
9
+ */
10
+ export function replayHintFor(provider) {
11
+ return (replayHints.get(provider) ??
12
+ 'Every exchange needs a fresh provider token, and the identity token provider returned one that was already exchanged.');
13
+ }
14
+ /**
15
+ * Reads the token from a file on every call, so a token the platform rotates
16
+ * (such as a Kubernetes projected service account token) is picked up.
17
+ */
18
+ export function identityTokenFromFile(path) {
19
+ if (!path) {
20
+ throw new WorkloadIdentityError('Identity token file path is empty');
21
+ }
22
+ const provider = async () => {
23
+ let content;
24
+ try {
25
+ // Loaded on first use, and not as a literal specifier, so the SDK still
26
+ // loads and bundles on runtimes that have no file system.
27
+ const specifier = 'node:fs/promises';
28
+ const fs = await import(
29
+ /* webpackIgnore: true */ /* @vite-ignore */ specifier);
30
+ content = await fs.readFile(path, 'utf-8');
31
+ }
32
+ catch (err) {
33
+ throw new WorkloadIdentityError(`Failed to read identity token file at ${path}: ${err}`, {
34
+ cause: err,
35
+ });
36
+ }
37
+ const token = content.trim();
38
+ if (!token) {
39
+ throw new WorkloadIdentityError(`Identity token file at ${path} is empty`);
40
+ }
41
+ return token;
42
+ };
43
+ replayHints.set(provider, `Every exchange needs a fresh provider token, and the identity token file at ${path} held the same token as a previous exchange. Whatever writes that file must replace the token before each refresh. For a Kubernetes projected service account token, which the kubelet replaces only as it nears expiry, configure the issuer in Kernel to allow reuse instead.`);
44
+ return provider;
45
+ }
46
+ /**
47
+ * Wraps one token as an {@link IdentityTokenProvider} that can be used for
48
+ * exactly one exchange.
49
+ *
50
+ * Most providers' tokens are single-use, and a fixed value cannot be
51
+ * replaced with a fresh one, so the second call throws instead of sending
52
+ * the same token again. Use {@link identityTokenFromFile}, a built-in source
53
+ * or your own callback for anything that outlives one access token.
54
+ */
55
+ export function identityTokenFromValue(token) {
56
+ if (!token) {
57
+ throw new WorkloadIdentityError('Identity token value is empty');
58
+ }
59
+ let used = false;
60
+ const provider = () => {
61
+ if (used) {
62
+ throw new WorkloadIdentityError('The static identity token has already been exchanged once and cannot be reused: every exchange needs a fresh provider token. A static token (such as KERNEL_IDENTITY_TOKEN) is good for one access token only. To keep a client authenticated, use a source that returns a fresh token on every call: KERNEL_IDENTITY_TOKEN_FILE, KERNEL_IDENTITY_TOKEN_SOURCE, or an identityTokenProvider callback.');
63
+ }
64
+ used = true;
65
+ return token;
66
+ };
67
+ replayHints.set(provider, 'Every exchange needs a fresh provider token; a static KERNEL_IDENTITY_TOKEN can be exchanged only once.');
68
+ return provider;
69
+ }
70
+ /**
71
+ * Requests an ID token from GitHub Actions. The workflow or job needs
72
+ * `permissions: id-token: write`.
73
+ */
74
+ export function identityTokenFromGitHubActions(options = {}) {
75
+ return async (request) => {
76
+ const requestURL = readEnv('ACTIONS_ID_TOKEN_REQUEST_URL');
77
+ const requestToken = readEnv('ACTIONS_ID_TOKEN_REQUEST_TOKEN');
78
+ if (!requestURL || !requestToken) {
79
+ throw new WorkloadIdentityError('GitHub Actions did not provide an ID token endpoint: ACTIONS_ID_TOKEN_REQUEST_URL and ACTIONS_ID_TOKEN_REQUEST_TOKEN are not set. Add `permissions: id-token: write` to the workflow or job.');
80
+ }
81
+ const audience = encodeURIComponent(resolveAudience(options, request));
82
+ const url = `${requestURL}${requestURL.includes('?') ? '&' : '?'}audience=${audience}`;
83
+ const body = await fetchIdentityToken('GitHub Actions ID token endpoint', options, request, url, {
84
+ Accept: 'application/json',
85
+ Authorization: `Bearer ${requestToken}`,
86
+ });
87
+ let token;
88
+ try {
89
+ token = JSON.parse(body)?.value;
90
+ }
91
+ catch {
92
+ token = undefined;
93
+ }
94
+ if (typeof token !== 'string' || !token) {
95
+ throw new WorkloadIdentityError('GitHub Actions ID token endpoint returned a response with no token');
96
+ }
97
+ return token;
98
+ };
99
+ }
100
+ const GCP_IDENTITY_URL = 'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity';
101
+ /**
102
+ * Requests an identity token for the attached service account from the
103
+ * Google Cloud metadata server.
104
+ */
105
+ export function identityTokenFromGCPMetadata(options = {}) {
106
+ return async (request) => {
107
+ const audience = encodeURIComponent(resolveAudience(options, request));
108
+ const url = `${GCP_IDENTITY_URL}?audience=${audience}&format=full`;
109
+ const body = await fetchIdentityToken('Google Cloud metadata server', options, request, url, {
110
+ 'Metadata-Flavor': 'Google',
111
+ });
112
+ const token = body.trim();
113
+ if (!token) {
114
+ throw new WorkloadIdentityError('Google Cloud metadata server returned an empty identity token');
115
+ }
116
+ return token;
117
+ };
118
+ }
119
+ /**
120
+ * Requests a token from AWS STS `GetWebIdentityToken` with the workload's
121
+ * ambient AWS credentials.
122
+ *
123
+ * Needs the optional `@aws-sdk/client-sts` package, which is loaded on first
124
+ * use. The call goes to a regional STS endpoint through the AWS SDK's own
125
+ * HTTP client, not the Kernel client's `fetch`.
126
+ */
127
+ export function identityTokenFromAWSSTS(options = {}) {
128
+ // One client for the life of the source, so the AWS SDK caches and
129
+ // refreshes the ambient credentials itself.
130
+ let client;
131
+ let Command;
132
+ return async (request) => {
133
+ const audience = resolveAudience(options, request);
134
+ if (!client || !Command) {
135
+ const sts = await loadSTS();
136
+ Command = sts.GetWebIdentityTokenCommand;
137
+ client = new sts.STSClient({
138
+ region: options.region || readEnv('AWS_REGION') || readEnv('AWS_DEFAULT_REGION') || 'us-east-1',
139
+ });
140
+ }
141
+ let token;
142
+ try {
143
+ const response = await client.send(new Command({ Audience: [audience], SigningAlgorithm: 'RS256', DurationSeconds: 300 }));
144
+ token = response.WebIdentityToken;
145
+ }
146
+ catch (err) {
147
+ throw new WorkloadIdentityError(`AWS STS GetWebIdentityToken failed: ${err}`, { cause: err });
148
+ }
149
+ if (!token) {
150
+ throw new WorkloadIdentityError('AWS STS GetWebIdentityToken returned no token');
151
+ }
152
+ return token;
153
+ };
154
+ }
155
+ const STS_PACKAGE = '@aws-sdk/client-sts';
156
+ const STS_MIN_VERSION = '3.935.0';
157
+ async function loadSTS() {
158
+ let sts;
159
+ try {
160
+ // Not a literal specifier: the package is optional, and bundlers must not
161
+ // try to resolve it for users who never select this source.
162
+ const specifier = STS_PACKAGE;
163
+ sts = await import(/* webpackIgnore: true */ /* @vite-ignore */ specifier);
164
+ }
165
+ catch (err) {
166
+ throw new WorkloadIdentityError(`The aws_sts identity token source needs the optional ${STS_PACKAGE} package (version ${STS_MIN_VERSION} or later). Install it with \`npm install ${STS_PACKAGE}\`.`, { cause: err });
167
+ }
168
+ const Command = sts.GetWebIdentityTokenCommand;
169
+ if (typeof Command !== 'function') {
170
+ throw new WorkloadIdentityError(`The installed ${STS_PACKAGE} is too old to call GetWebIdentityToken; version ${STS_MIN_VERSION} or later is required. Upgrade it with \`npm install ${STS_PACKAGE}@latest\`.`);
171
+ }
172
+ return { STSClient: sts.STSClient, GetWebIdentityTokenCommand: Command };
173
+ }
174
+ function resolveAudience(options, request) {
175
+ return (options.audience || readEnv('KERNEL_IDENTITY_TOKEN_AUDIENCE') || request?.audience || resolveAuthBaseURL());
176
+ }
177
+ async function fetchIdentityToken(source, options, request, url, headers) {
178
+ const fetch = options.fetch ?? request?.fetch ?? getDefaultFetch();
179
+ const secrets = [(headers['Authorization'] ?? '').replace(/^Bearer /, '')];
180
+ return withTimeout(DEFAULT_CREDENTIALS_TIMEOUT_IN_MS, async (signal) => {
181
+ let response;
182
+ try {
183
+ response = await fetch(url, { method: 'GET', redirect: 'manual', headers, signal });
184
+ }
185
+ catch (err) {
186
+ throw new WorkloadIdentityError(`Failed to reach the ${source}: ${describeFailure(err, secrets)}`);
187
+ }
188
+ if (response.status !== 200) {
189
+ await response.body?.cancel().catch(() => { });
190
+ throw new WorkloadIdentityError(`The ${source} responded with status ${response.status}`, {
191
+ statusCode: response.status,
192
+ });
193
+ }
194
+ try {
195
+ return await readLimitedText(response);
196
+ }
197
+ catch (err) {
198
+ throw new WorkloadIdentityError(`Failed to read the response from the ${source}: ${describeFailure(err, secrets)}`);
199
+ }
200
+ });
201
+ }
202
+ //# sourceMappingURL=identity-token.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-token.mjs","sourceRoot":"","sources":["../../src/lib/credentials/identity-token.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,iCAA6B;AACvD,OAAO,EAAE,OAAO,EAAE,qCAAiC;AAEnD,OAAO,EACL,iCAAiC,EACjC,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,WAAW,GACZ,oBAAgB;AAajB,MAAM,WAAW,GAAG,IAAI,OAAO,EAAiC,CAAC;AAEjE;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,QAA+B;IAC3D,OAAO,CACL,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;QACzB,uHAAuH,CACxH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,qBAAqB,CAAC,mCAAmC,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,QAAQ,GAA0B,KAAK,IAAI,EAAE;QACjD,IAAI,OAAe,CAAC;QACpB,IAAI,CAAC;YACH,wEAAwE;YACxE,0DAA0D;YAC1D,MAAM,SAAS,GAAG,kBAAkB,CAAC;YACrC,MAAM,EAAE,GAAsC,MAAM,MAAM;YACxD,yBAAyB,CAAC,kBAAkB,CAAC,SAAS,CACvD,CAAC;YACF,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,qBAAqB,CAAC,yCAAyC,IAAI,KAAK,GAAG,EAAE,EAAE;gBACvF,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;QACL,CAAC;QACD,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM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3E,OAAO,WAAW,CAAC,iCAAiC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACrE,IAAI,QAAkB,CAAC;QACvB,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACtF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,qBAAqB,CAAC,uBAAuB,MAAM,KAAK,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QACrG,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAC9C,MAAM,IAAI,qBAAqB,CAAC,OAAO,MAAM,0BAA0B,QAAQ,CAAC,MAAM,EAAE,EAAE;gBACxF,UAAU,EAAE,QAAQ,CAAC,MAAM;aAC5B,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC;YACH,OAAO,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,qBAAqB,CAC7B,wCAAwC,MAAM,KAAK,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CACnF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,65 @@
1
+ import type { Fetch } from "../../internal/builtin-types.mjs";
2
+ import type { AccessTokenProviderOptions, FederationAccessToken, FederationTokenDetails, IdentityTokenProvider } from "./types.mjs";
3
+ type ExchangeOptions = {
4
+ /**
5
+ * The host that exchanges identity tokens. Defaults to
6
+ * `KERNEL_AUTH_BASE_URL`, else `https://auth.onkernel.com` when the API
7
+ * base URL is the production default. A custom API base URL needs it set.
8
+ */
9
+ authBaseURL?: string | undefined;
10
+ /**
11
+ * The API the access token is for. Defaults to the origin of the API base
12
+ * URL, for example `https://api.onkernel.com`. The token endpoint compares
13
+ * it exactly, so it must not end in a slash.
14
+ */
15
+ resource?: string | undefined;
16
+ /** Defaults to the `fetch` of the client using the credentials, else the global `fetch`. */
17
+ fetch?: Fetch | undefined;
18
+ /**
19
+ * How long one token request may take, in milliseconds.
20
+ *
21
+ * @default 30000
22
+ */
23
+ timeout?: number | undefined;
24
+ };
25
+ export type OIDCFederationConfig = ExchangeOptions & {
26
+ /**
27
+ * Called once per exchange. It must return a fresh token every time: most
28
+ * providers' tokens can be exchanged only once.
29
+ */
30
+ identityTokenProvider: IdentityTokenProvider;
31
+ /** The `wifr_...` ID of the federation rule to authenticate against. */
32
+ federationRuleId: string;
33
+ };
34
+ export type FederationAssertionExchangeParams = ExchangeOptions & {
35
+ /** The identity provider's token. It is sent as given and never reused. */
36
+ assertion: string;
37
+ /** The `wifr_...` ID of the federation rule to authenticate against. */
38
+ federationRuleId: string;
39
+ };
40
+ export type FederationExchangeResult = {
41
+ accessToken: string;
42
+ } & FederationTokenDetails;
43
+ /**
44
+ * Exchanges a token from the workload's identity provider for a short-lived
45
+ * Kernel access token (the RFC 7523 jwt-bearer grant).
46
+ *
47
+ * Every call asks `identityTokenProvider` for a fresh token and exchanges
48
+ * it; nothing is cached and nothing is retried. Pass the result as the
49
+ * client's `credentials` option, which wraps it in a {@link TokenCache}.
50
+ *
51
+ * The token endpoint returns no refresh token: when the access token is
52
+ * about to expire, a new identity token is exchanged.
53
+ */
54
+ export declare function oidcFederationProvider(config: OIDCFederationConfig): (opts?: AccessTokenProviderOptions) => Promise<FederationAccessToken>;
55
+ /**
56
+ * Exchanges one identity provider token for a Kernel access token, for
57
+ * callers that want to manage the access token themselves. It needs no
58
+ * Kernel credential.
59
+ *
60
+ * The assertion is spent by the call: to get another access token, obtain a
61
+ * fresh assertion from the identity provider first.
62
+ */
63
+ export declare function exchangeFederationAssertion(params: FederationAssertionExchangeParams): Promise<FederationExchangeResult>;
64
+ export {};
65
+ //# sourceMappingURL=oidc-federation.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oidc-federation.d.mts","sourceRoot":"","sources":["../../src/lib/credentials/oidc-federation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,yCAAqC;AAI1D,OAAO,KAAK,EACV,0BAA0B,EAC1B,qBAAqB,EAErB,sBAAsB,EACtB,qBAAqB,EACtB,oBAAgB;AAiBjB,KAAK,eAAe,GAAG;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,4FAA4F;IAC5F,KAAK,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG;IACnD;;;OAGG;IACH,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,eAAe,GAAG;IAChE,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,sBAAsB,CAAC;AAExF;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,oBAAoB,GAC3B,CAAC,IAAI,CAAC,EAAE,0BAA0B,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAyBvE;AAED;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,wBAAwB,CAAC,CAgBnC"}