@monorise/react 8.0.0-dev.0 → 8.0.0-dev.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 (62) hide show
  1. package/dist/actions/core.action.d.ts.map +1 -1
  2. package/dist/helpers/transactional.d.ts +40 -0
  3. package/dist/helpers/transactional.d.ts.map +1 -0
  4. package/dist/index.d.ts +4 -17
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +390 -25645
  7. package/dist/index.js.map +1 -1
  8. package/dist/lib/utils.d.ts +7 -0
  9. package/dist/lib/utils.d.ts.map +1 -1
  10. package/dist/services/core.service.d.ts +2 -8
  11. package/dist/services/core.service.d.ts.map +1 -1
  12. package/package.json +1 -1
  13. package/dist/bowser-RUCNDTEX.js +0 -2822
  14. package/dist/bowser-RUCNDTEX.js.map +0 -1
  15. package/dist/chunk-2U2REJF4.js +0 -138
  16. package/dist/chunk-2U2REJF4.js.map +0 -1
  17. package/dist/chunk-5CPIG7AN.js +0 -449
  18. package/dist/chunk-5CPIG7AN.js.map +0 -1
  19. package/dist/chunk-7BSJSLIL.js +0 -528
  20. package/dist/chunk-7BSJSLIL.js.map +0 -1
  21. package/dist/chunk-7MNBSDJI.js +0 -3362
  22. package/dist/chunk-7MNBSDJI.js.map +0 -1
  23. package/dist/chunk-JXBFOCBM.js +0 -2929
  24. package/dist/chunk-JXBFOCBM.js.map +0 -1
  25. package/dist/chunk-MIXAYX55.js +0 -147
  26. package/dist/chunk-MIXAYX55.js.map +0 -1
  27. package/dist/chunk-Q26JGAFF.js +0 -47
  28. package/dist/chunk-Q26JGAFF.js.map +0 -1
  29. package/dist/chunk-QZSEUOCY.js +0 -2298
  30. package/dist/chunk-QZSEUOCY.js.map +0 -1
  31. package/dist/chunk-W6S3JWZV.js +0 -1045
  32. package/dist/chunk-W6S3JWZV.js.map +0 -1
  33. package/dist/chunk-WUOPYF3V.js +0 -127
  34. package/dist/chunk-WUOPYF3V.js.map +0 -1
  35. package/dist/chunk-Z45ECZFO.js +0 -995
  36. package/dist/chunk-Z45ECZFO.js.map +0 -1
  37. package/dist/dist-es-2P6AKQM3.js +0 -325
  38. package/dist/dist-es-2P6AKQM3.js.map +0 -1
  39. package/dist/dist-es-CEMZ6HT6.js +0 -294
  40. package/dist/dist-es-CEMZ6HT6.js.map +0 -1
  41. package/dist/dist-es-NZWWHEBR.js +0 -89
  42. package/dist/dist-es-NZWWHEBR.js.map +0 -1
  43. package/dist/dist-es-QVQ2CPIM.js +0 -376
  44. package/dist/dist-es-QVQ2CPIM.js.map +0 -1
  45. package/dist/dist-es-VBWII54H.js +0 -70
  46. package/dist/dist-es-VBWII54H.js.map +0 -1
  47. package/dist/dist-es-VXN7IC3J.js +0 -23
  48. package/dist/dist-es-VXN7IC3J.js.map +0 -1
  49. package/dist/dist-es-YKVDPOOB.js +0 -221
  50. package/dist/dist-es-YKVDPOOB.js.map +0 -1
  51. package/dist/dist-es-ZPOY2Z6R.js +0 -178
  52. package/dist/dist-es-ZPOY2Z6R.js.map +0 -1
  53. package/dist/event-streams-NBH35WQC.js +0 -44
  54. package/dist/event-streams-NBH35WQC.js.map +0 -1
  55. package/dist/loadSso-2GPAQE3H.js +0 -583
  56. package/dist/loadSso-2GPAQE3H.js.map +0 -1
  57. package/dist/signin-HT4EDHQE.js +0 -821
  58. package/dist/signin-HT4EDHQE.js.map +0 -1
  59. package/dist/sso-oidc-WA3BK6FI.js +0 -830
  60. package/dist/sso-oidc-WA3BK6FI.js.map +0 -1
  61. package/dist/sts-V7PNNQ2L.js +0 -1114
  62. package/dist/sts-V7PNNQ2L.js.map +0 -1
@@ -1,294 +0,0 @@
1
- import {
2
- setCredentialFeature
3
- } from "./chunk-7MNBSDJI.js";
4
- import {
5
- CredentialsProviderError,
6
- HttpRequest,
7
- getProfileName,
8
- parseKnownFiles,
9
- readFile
10
- } from "./chunk-QZSEUOCY.js";
11
- import "./chunk-W6S3JWZV.js";
12
- import {
13
- __publicField,
14
- __spreadProps,
15
- __spreadValues
16
- } from "./chunk-MIXAYX55.js";
17
-
18
- // ../../node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js
19
- import { createHash, createPrivateKey, createPublicKey, sign } from "crypto";
20
- import { promises as fs } from "fs";
21
- import { homedir } from "os";
22
- import { dirname, join } from "path";
23
- var _LoginCredentialsFetcher = class _LoginCredentialsFetcher {
24
- constructor(profileData, init, callerClientConfig) {
25
- __publicField(this, "profileData");
26
- __publicField(this, "init");
27
- __publicField(this, "callerClientConfig");
28
- this.profileData = profileData;
29
- this.init = init;
30
- this.callerClientConfig = callerClientConfig;
31
- }
32
- async loadCredentials() {
33
- const token = await this.loadToken();
34
- if (!token) {
35
- throw new CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`, { tryNextLink: false, logger: this.logger });
36
- }
37
- const accessToken = token.accessToken;
38
- const now = Date.now();
39
- const expiryTime = new Date(accessToken.expiresAt).getTime();
40
- const timeUntilExpiry = expiryTime - now;
41
- if (timeUntilExpiry <= _LoginCredentialsFetcher.REFRESH_THRESHOLD) {
42
- return this.refresh(token);
43
- }
44
- return {
45
- accessKeyId: accessToken.accessKeyId,
46
- secretAccessKey: accessToken.secretAccessKey,
47
- sessionToken: accessToken.sessionToken,
48
- accountId: accessToken.accountId,
49
- expiration: new Date(accessToken.expiresAt)
50
- };
51
- }
52
- get logger() {
53
- var _a;
54
- return (_a = this.init) == null ? void 0 : _a.logger;
55
- }
56
- get loginSession() {
57
- return this.profileData.login_session;
58
- }
59
- async refresh(token) {
60
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
61
- const { SigninClient, CreateOAuth2TokenCommand } = await import("./signin-HT4EDHQE.js");
62
- const { logger, userAgentAppId } = (_a = this.callerClientConfig) != null ? _a : {};
63
- const isH2 = (requestHandler2) => {
64
- var _a2;
65
- return ((_a2 = requestHandler2 == null ? void 0 : requestHandler2.metadata) == null ? void 0 : _a2.handlerProtocol) === "h2";
66
- };
67
- const requestHandler = isH2((_b = this.callerClientConfig) == null ? void 0 : _b.requestHandler) ? void 0 : (_c = this.callerClientConfig) == null ? void 0 : _c.requestHandler;
68
- const region = (_g = (_f = this.profileData.region) != null ? _f : await ((_e = (_d = this.callerClientConfig) == null ? void 0 : _d.region) == null ? void 0 : _e.call(_d))) != null ? _g : process.env.AWS_REGION;
69
- const client = new SigninClient(__spreadValues({
70
- credentials: {
71
- accessKeyId: "",
72
- secretAccessKey: ""
73
- },
74
- region,
75
- requestHandler,
76
- logger,
77
- userAgentAppId
78
- }, (_h = this.init) == null ? void 0 : _h.clientConfig));
79
- this.createDPoPInterceptor(client.middlewareStack);
80
- const commandInput = {
81
- tokenInput: {
82
- clientId: token.clientId,
83
- refreshToken: token.refreshToken,
84
- grantType: "refresh_token"
85
- }
86
- };
87
- try {
88
- const response = await client.send(new CreateOAuth2TokenCommand(commandInput));
89
- const { accessKeyId, secretAccessKey, sessionToken } = (_j = (_i = response.tokenOutput) == null ? void 0 : _i.accessToken) != null ? _j : {};
90
- const { refreshToken, expiresIn } = (_k = response.tokenOutput) != null ? _k : {};
91
- if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {
92
- throw new CredentialsProviderError("Token refresh response missing required fields", {
93
- logger: this.logger,
94
- tryNextLink: false
95
- });
96
- }
97
- const expiresInMs = (expiresIn != null ? expiresIn : 900) * 1e3;
98
- const expiration = new Date(Date.now() + expiresInMs);
99
- const updatedToken = __spreadProps(__spreadValues({}, token), {
100
- accessToken: __spreadProps(__spreadValues({}, token.accessToken), {
101
- accessKeyId,
102
- secretAccessKey,
103
- sessionToken,
104
- expiresAt: expiration.toISOString()
105
- }),
106
- refreshToken
107
- });
108
- await this.saveToken(updatedToken);
109
- const newAccessToken = updatedToken.accessToken;
110
- return {
111
- accessKeyId: newAccessToken.accessKeyId,
112
- secretAccessKey: newAccessToken.secretAccessKey,
113
- sessionToken: newAccessToken.sessionToken,
114
- accountId: newAccessToken.accountId,
115
- expiration
116
- };
117
- } catch (error) {
118
- if (error.name === "AccessDeniedException") {
119
- const errorType = error.error;
120
- let message;
121
- switch (errorType) {
122
- case "TOKEN_EXPIRED":
123
- message = "Your session has expired. Please reauthenticate.";
124
- break;
125
- case "USER_CREDENTIALS_CHANGED":
126
- message = "Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";
127
- break;
128
- case "INSUFFICIENT_PERMISSIONS":
129
- message = "Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";
130
- break;
131
- default:
132
- message = `Failed to refresh token: ${String(error)}. Please re-authenticate using \`aws login\``;
133
- }
134
- throw new CredentialsProviderError(message, { logger: this.logger, tryNextLink: false });
135
- }
136
- throw new CredentialsProviderError(`Failed to refresh token: ${String(error)}. Please re-authenticate using aws login`, { logger: this.logger });
137
- }
138
- }
139
- async loadToken() {
140
- var _a, _b;
141
- const tokenFilePath = this.getTokenFilePath();
142
- try {
143
- let tokenData;
144
- try {
145
- tokenData = await readFile(tokenFilePath, { ignoreCache: (_a = this.init) == null ? void 0 : _a.ignoreCache });
146
- } catch (e) {
147
- tokenData = await fs.readFile(tokenFilePath, "utf8");
148
- }
149
- const token = JSON.parse(tokenData);
150
- const missingFields = ["accessToken", "clientId", "refreshToken", "dpopKey"].filter((k) => !token[k]);
151
- if (!((_b = token.accessToken) == null ? void 0 : _b.accountId)) {
152
- missingFields.push("accountId");
153
- }
154
- if (missingFields.length > 0) {
155
- throw new CredentialsProviderError(`Token validation failed, missing fields: ${missingFields.join(", ")}`, {
156
- logger: this.logger,
157
- tryNextLink: false
158
- });
159
- }
160
- return token;
161
- } catch (error) {
162
- throw new CredentialsProviderError(`Failed to load token from ${tokenFilePath}: ${String(error)}`, {
163
- logger: this.logger,
164
- tryNextLink: false
165
- });
166
- }
167
- }
168
- async saveToken(token) {
169
- const tokenFilePath = this.getTokenFilePath();
170
- const directory = dirname(tokenFilePath);
171
- try {
172
- await fs.mkdir(directory, { recursive: true });
173
- } catch (error) {
174
- }
175
- await fs.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
176
- }
177
- getTokenFilePath() {
178
- var _a;
179
- const directory = (_a = process.env.AWS_LOGIN_CACHE_DIRECTORY) != null ? _a : join(homedir(), ".aws", "login", "cache");
180
- const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
181
- const loginSessionSha256 = createHash("sha256").update(loginSessionBytes).digest("hex");
182
- return join(directory, `${loginSessionSha256}.json`);
183
- }
184
- derToRawSignature(derSignature) {
185
- let offset = 2;
186
- if (derSignature[offset] !== 2) {
187
- throw new Error("Invalid DER signature");
188
- }
189
- offset++;
190
- const rLength = derSignature[offset++];
191
- let r = derSignature.subarray(offset, offset + rLength);
192
- offset += rLength;
193
- if (derSignature[offset] !== 2) {
194
- throw new Error("Invalid DER signature");
195
- }
196
- offset++;
197
- const sLength = derSignature[offset++];
198
- let s = derSignature.subarray(offset, offset + sLength);
199
- r = r[0] === 0 ? r.subarray(1) : r;
200
- s = s[0] === 0 ? s.subarray(1) : s;
201
- const rPadded = Buffer.concat([Buffer.alloc(32 - r.length), r]);
202
- const sPadded = Buffer.concat([Buffer.alloc(32 - s.length), s]);
203
- return Buffer.concat([rPadded, sPadded]);
204
- }
205
- createDPoPInterceptor(middlewareStack) {
206
- middlewareStack.add((next) => async (args) => {
207
- if (HttpRequest.isInstance(args.request)) {
208
- const request = args.request;
209
- const actualEndpoint = `${request.protocol}//${request.hostname}${request.port ? `:${request.port}` : ""}${request.path}`;
210
- const dpop = await this.generateDpop(request.method, actualEndpoint);
211
- request.headers = __spreadProps(__spreadValues({}, request.headers), {
212
- DPoP: dpop
213
- });
214
- }
215
- return next(args);
216
- }, {
217
- step: "finalizeRequest",
218
- name: "dpopInterceptor",
219
- override: true
220
- });
221
- }
222
- async generateDpop(method = "POST", endpoint) {
223
- const token = await this.loadToken();
224
- try {
225
- const privateKey = createPrivateKey({
226
- key: token.dpopKey,
227
- format: "pem",
228
- type: "sec1"
229
- });
230
- const publicKey = createPublicKey(privateKey);
231
- const publicDer = publicKey.export({ format: "der", type: "spki" });
232
- let pointStart = -1;
233
- for (let i = 0; i < publicDer.length; i++) {
234
- if (publicDer[i] === 4) {
235
- pointStart = i;
236
- break;
237
- }
238
- }
239
- const x = publicDer.slice(pointStart + 1, pointStart + 33);
240
- const y = publicDer.slice(pointStart + 33, pointStart + 65);
241
- const header = {
242
- alg: "ES256",
243
- typ: "dpop+jwt",
244
- jwk: {
245
- kty: "EC",
246
- crv: "P-256",
247
- x: x.toString("base64url"),
248
- y: y.toString("base64url")
249
- }
250
- };
251
- const payload = {
252
- jti: crypto.randomUUID(),
253
- htm: method,
254
- htu: endpoint,
255
- iat: Math.floor(Date.now() / 1e3)
256
- };
257
- const headerB64 = Buffer.from(JSON.stringify(header)).toString("base64url");
258
- const payloadB64 = Buffer.from(JSON.stringify(payload)).toString("base64url");
259
- const message = `${headerB64}.${payloadB64}`;
260
- const asn1Signature = sign("sha256", Buffer.from(message), privateKey);
261
- const rawSignature = this.derToRawSignature(asn1Signature);
262
- const signatureB64 = rawSignature.toString("base64url");
263
- return `${message}.${signatureB64}`;
264
- } catch (error) {
265
- throw new CredentialsProviderError(`Failed to generate Dpop proof: ${error instanceof Error ? error.message : String(error)}`, { logger: this.logger, tryNextLink: false });
266
- }
267
- }
268
- };
269
- __publicField(_LoginCredentialsFetcher, "REFRESH_THRESHOLD", 5 * 60 * 1e3);
270
- var LoginCredentialsFetcher = _LoginCredentialsFetcher;
271
-
272
- // ../../node_modules/@aws-sdk/credential-provider-login/dist-es/fromLoginCredentials.js
273
- var fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {
274
- var _a, _b, _c;
275
- (_b = (_a = init == null ? void 0 : init.logger) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, "@aws-sdk/credential-providers - fromLoginCredentials");
276
- const profiles = await parseKnownFiles(init || {});
277
- const profileName = getProfileName({
278
- profile: (_c = init == null ? void 0 : init.profile) != null ? _c : callerClientConfig == null ? void 0 : callerClientConfig.profile
279
- });
280
- const profile = profiles[profileName];
281
- if (!(profile == null ? void 0 : profile.login_session)) {
282
- throw new CredentialsProviderError(`Profile ${profileName} does not contain login_session.`, {
283
- tryNextLink: true,
284
- logger: init == null ? void 0 : init.logger
285
- });
286
- }
287
- const fetcher = new LoginCredentialsFetcher(profile, init, callerClientConfig);
288
- const credentials = await fetcher.loadCredentials();
289
- return setCredentialFeature(credentials, "CREDENTIALS_LOGIN", "AD");
290
- };
291
- export {
292
- fromLoginCredentials
293
- };
294
- //# sourceMappingURL=dist-es-CEMZ6HT6.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js","../../../node_modules/@aws-sdk/credential-provider-login/dist-es/fromLoginCredentials.js"],"sourcesContent":["import { CredentialsProviderError, readFile } from \"@smithy/core/config\";\nimport { HttpRequest } from \"@smithy/core/protocols\";\nimport { createHash, createPrivateKey, createPublicKey, sign } from \"node:crypto\";\nimport { promises as fs } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nexport class LoginCredentialsFetcher {\n profileData;\n init;\n callerClientConfig;\n static REFRESH_THRESHOLD = 5 * 60 * 1000;\n constructor(profileData, init, callerClientConfig) {\n this.profileData = profileData;\n this.init = init;\n this.callerClientConfig = callerClientConfig;\n }\n async loadCredentials() {\n const token = await this.loadToken();\n if (!token) {\n throw new CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`, { tryNextLink: false, logger: this.logger });\n }\n const accessToken = token.accessToken;\n const now = Date.now();\n const expiryTime = new Date(accessToken.expiresAt).getTime();\n const timeUntilExpiry = expiryTime - now;\n if (timeUntilExpiry <= LoginCredentialsFetcher.REFRESH_THRESHOLD) {\n return this.refresh(token);\n }\n return {\n accessKeyId: accessToken.accessKeyId,\n secretAccessKey: accessToken.secretAccessKey,\n sessionToken: accessToken.sessionToken,\n accountId: accessToken.accountId,\n expiration: new Date(accessToken.expiresAt),\n };\n }\n get logger() {\n return this.init?.logger;\n }\n get loginSession() {\n return this.profileData.login_session;\n }\n async refresh(token) {\n const { SigninClient, CreateOAuth2TokenCommand } = await import(\"@aws-sdk/nested-clients/signin\");\n const { logger, userAgentAppId } = this.callerClientConfig ?? {};\n const isH2 = (requestHandler) => {\n return requestHandler?.metadata?.handlerProtocol === \"h2\";\n };\n const requestHandler = isH2(this.callerClientConfig?.requestHandler)\n ? undefined\n : this.callerClientConfig?.requestHandler;\n const region = this.profileData.region ?? (await this.callerClientConfig?.region?.()) ?? process.env.AWS_REGION;\n const client = new SigninClient({\n credentials: {\n accessKeyId: \"\",\n secretAccessKey: \"\",\n },\n region,\n requestHandler,\n logger,\n userAgentAppId,\n ...this.init?.clientConfig,\n });\n this.createDPoPInterceptor(client.middlewareStack);\n const commandInput = {\n tokenInput: {\n clientId: token.clientId,\n refreshToken: token.refreshToken,\n grantType: \"refresh_token\",\n },\n };\n try {\n const response = await client.send(new CreateOAuth2TokenCommand(commandInput));\n const { accessKeyId, secretAccessKey, sessionToken } = response.tokenOutput?.accessToken ?? {};\n const { refreshToken, expiresIn } = response.tokenOutput ?? {};\n if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {\n throw new CredentialsProviderError(\"Token refresh response missing required fields\", {\n logger: this.logger,\n tryNextLink: false,\n });\n }\n const expiresInMs = (expiresIn ?? 900) * 1000;\n const expiration = new Date(Date.now() + expiresInMs);\n const updatedToken = {\n ...token,\n accessToken: {\n ...token.accessToken,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n expiresAt: expiration.toISOString(),\n },\n refreshToken,\n };\n await this.saveToken(updatedToken);\n const newAccessToken = updatedToken.accessToken;\n return {\n accessKeyId: newAccessToken.accessKeyId,\n secretAccessKey: newAccessToken.secretAccessKey,\n sessionToken: newAccessToken.sessionToken,\n accountId: newAccessToken.accountId,\n expiration,\n };\n }\n catch (error) {\n if (error.name === \"AccessDeniedException\") {\n const errorType = error.error;\n let message;\n switch (errorType) {\n case \"TOKEN_EXPIRED\":\n message = \"Your session has expired. Please reauthenticate.\";\n break;\n case \"USER_CREDENTIALS_CHANGED\":\n message =\n \"Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.\";\n break;\n case \"INSUFFICIENT_PERMISSIONS\":\n message =\n \"Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.\";\n break;\n default:\n message = `Failed to refresh token: ${String(error)}. Please re-authenticate using \\`aws login\\``;\n }\n throw new CredentialsProviderError(message, { logger: this.logger, tryNextLink: false });\n }\n throw new CredentialsProviderError(`Failed to refresh token: ${String(error)}. Please re-authenticate using aws login`, { logger: this.logger });\n }\n }\n async loadToken() {\n const tokenFilePath = this.getTokenFilePath();\n try {\n let tokenData;\n try {\n tokenData = await readFile(tokenFilePath, { ignoreCache: this.init?.ignoreCache });\n }\n catch {\n tokenData = await fs.readFile(tokenFilePath, \"utf8\");\n }\n const token = JSON.parse(tokenData);\n const missingFields = [\"accessToken\", \"clientId\", \"refreshToken\", \"dpopKey\"].filter((k) => !token[k]);\n if (!token.accessToken?.accountId) {\n missingFields.push(\"accountId\");\n }\n if (missingFields.length > 0) {\n throw new CredentialsProviderError(`Token validation failed, missing fields: ${missingFields.join(\", \")}`, {\n logger: this.logger,\n tryNextLink: false,\n });\n }\n return token;\n }\n catch (error) {\n throw new CredentialsProviderError(`Failed to load token from ${tokenFilePath}: ${String(error)}`, {\n logger: this.logger,\n tryNextLink: false,\n });\n }\n }\n async saveToken(token) {\n const tokenFilePath = this.getTokenFilePath();\n const directory = dirname(tokenFilePath);\n try {\n await fs.mkdir(directory, { recursive: true });\n }\n catch (error) {\n }\n await fs.writeFile(tokenFilePath, JSON.stringify(token, null, 2), \"utf8\");\n }\n getTokenFilePath() {\n const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join(homedir(), \".aws\", \"login\", \"cache\");\n const loginSessionBytes = Buffer.from(this.loginSession, \"utf8\");\n const loginSessionSha256 = createHash(\"sha256\").update(loginSessionBytes).digest(\"hex\");\n return join(directory, `${loginSessionSha256}.json`);\n }\n derToRawSignature(derSignature) {\n let offset = 2;\n if (derSignature[offset] !== 0x02) {\n throw new Error(\"Invalid DER signature\");\n }\n offset++;\n const rLength = derSignature[offset++];\n let r = derSignature.subarray(offset, offset + rLength);\n offset += rLength;\n if (derSignature[offset] !== 0x02) {\n throw new Error(\"Invalid DER signature\");\n }\n offset++;\n const sLength = derSignature[offset++];\n let s = derSignature.subarray(offset, offset + sLength);\n r = r[0] === 0x00 ? r.subarray(1) : r;\n s = s[0] === 0x00 ? s.subarray(1) : s;\n const rPadded = Buffer.concat([Buffer.alloc(32 - r.length), r]);\n const sPadded = Buffer.concat([Buffer.alloc(32 - s.length), s]);\n return Buffer.concat([rPadded, sPadded]);\n }\n createDPoPInterceptor(middlewareStack) {\n middlewareStack.add((next) => async (args) => {\n if (HttpRequest.isInstance(args.request)) {\n const request = args.request;\n const actualEndpoint = `${request.protocol}//${request.hostname}${request.port ? `:${request.port}` : \"\"}${request.path}`;\n const dpop = await this.generateDpop(request.method, actualEndpoint);\n request.headers = {\n ...request.headers,\n DPoP: dpop,\n };\n }\n return next(args);\n }, {\n step: \"finalizeRequest\",\n name: \"dpopInterceptor\",\n override: true,\n });\n }\n async generateDpop(method = \"POST\", endpoint) {\n const token = await this.loadToken();\n try {\n const privateKey = createPrivateKey({\n key: token.dpopKey,\n format: \"pem\",\n type: \"sec1\",\n });\n const publicKey = createPublicKey(privateKey);\n const publicDer = publicKey.export({ format: \"der\", type: \"spki\" });\n let pointStart = -1;\n for (let i = 0; i < publicDer.length; i++) {\n if (publicDer[i] === 0x04) {\n pointStart = i;\n break;\n }\n }\n const x = publicDer.slice(pointStart + 1, pointStart + 33);\n const y = publicDer.slice(pointStart + 33, pointStart + 65);\n const header = {\n alg: \"ES256\",\n typ: \"dpop+jwt\",\n jwk: {\n kty: \"EC\",\n crv: \"P-256\",\n x: x.toString(\"base64url\"),\n y: y.toString(\"base64url\"),\n },\n };\n const payload = {\n jti: crypto.randomUUID(),\n htm: method,\n htu: endpoint,\n iat: Math.floor(Date.now() / 1000),\n };\n const headerB64 = Buffer.from(JSON.stringify(header)).toString(\"base64url\");\n const payloadB64 = Buffer.from(JSON.stringify(payload)).toString(\"base64url\");\n const message = `${headerB64}.${payloadB64}`;\n const asn1Signature = sign(\"sha256\", Buffer.from(message), privateKey);\n const rawSignature = this.derToRawSignature(asn1Signature);\n const signatureB64 = rawSignature.toString(\"base64url\");\n return `${message}.${signatureB64}`;\n }\n catch (error) {\n throw new CredentialsProviderError(`Failed to generate Dpop proof: ${error instanceof Error ? error.message : String(error)}`, { logger: this.logger, tryNextLink: false });\n }\n }\n}\n","import { setCredentialFeature } from \"@aws-sdk/core/client\";\nimport { CredentialsProviderError, getProfileName, parseKnownFiles } from \"@smithy/core/config\";\nimport { LoginCredentialsFetcher } from \"./LoginCredentialsFetcher\";\nexport const fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {\n init?.logger?.debug?.(\"@aws-sdk/credential-providers - fromLoginCredentials\");\n const profiles = await parseKnownFiles(init || {});\n const profileName = getProfileName({\n profile: init?.profile ?? callerClientConfig?.profile,\n });\n const profile = profiles[profileName];\n if (!profile?.login_session) {\n throw new CredentialsProviderError(`Profile ${profileName} does not contain login_session.`, {\n tryNextLink: true,\n logger: init?.logger,\n });\n }\n const fetcher = new LoginCredentialsFetcher(profile, init, callerClientConfig);\n const credentials = await fetcher.loadCredentials();\n return setCredentialFeature(credentials, \"CREDENTIALS_LOGIN\", \"AD\");\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,SAAS,YAAY,kBAAkB,iBAAiB,YAAY;AACpE,SAAS,YAAY,UAAU;AAC/B,SAAS,eAAe;AACxB,SAAS,SAAS,YAAY;AACvB,IAAM,2BAAN,MAAM,yBAAwB;AAAA,EAKjC,YAAY,aAAa,MAAM,oBAAoB;AAJnD;AACA;AACA;AAGI,SAAK,cAAc;AACnB,SAAK,O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,mCAAS,gBAAe;AACzB,UAAM,IAAI,yBAAyB,WAAW,WAAW,oCAAoC;AAAA,MACzF,aAAa;AAAA,MACb,QAAQ,6BAAM;AAAA,IAClB,CAAC;AAAA,EACL;AACA,QAAM,UAAU,IAAI,wBAAwB,SAAS,MAAM,kBAAkB;AAC7E,QAAM,cAAc,MAAM,QAAQ,gBAAgB;AAClD,SAAO,qBAAqB,aAAa,qBAAqB,IAAI;AACtE;","names":["requestHandler","_a"]}
@@ -1,89 +0,0 @@
1
- import {
2
- setCredentialFeature
3
- } from "./chunk-7MNBSDJI.js";
4
- import {
5
- CredentialsProviderError,
6
- externalDataInterceptor,
7
- getProfileName,
8
- parseKnownFiles
9
- } from "./chunk-QZSEUOCY.js";
10
- import "./chunk-W6S3JWZV.js";
11
- import {
12
- __spreadValues
13
- } from "./chunk-MIXAYX55.js";
14
-
15
- // ../../node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js
16
- import { exec } from "child_process";
17
- import { promisify } from "util";
18
-
19
- // ../../node_modules/@aws-sdk/credential-provider-process/dist-es/getValidatedProcessCredentials.js
20
- var getValidatedProcessCredentials = (profileName, data, profiles) => {
21
- var _a;
22
- if (data.Version !== 1) {
23
- throw Error(`Profile ${profileName} credential_process did not return Version 1.`);
24
- }
25
- if (data.AccessKeyId === void 0 || data.SecretAccessKey === void 0) {
26
- throw Error(`Profile ${profileName} credential_process returned invalid credentials.`);
27
- }
28
- if (data.Expiration) {
29
- const currentTime = /* @__PURE__ */ new Date();
30
- const expireTime = new Date(data.Expiration);
31
- if (expireTime < currentTime) {
32
- throw Error(`Profile ${profileName} credential_process returned expired credentials.`);
33
- }
34
- }
35
- let accountId = data.AccountId;
36
- if (!accountId && ((_a = profiles == null ? void 0 : profiles[profileName]) == null ? void 0 : _a.aws_account_id)) {
37
- accountId = profiles[profileName].aws_account_id;
38
- }
39
- const credentials = __spreadValues(__spreadValues(__spreadValues(__spreadValues({
40
- accessKeyId: data.AccessKeyId,
41
- secretAccessKey: data.SecretAccessKey
42
- }, data.SessionToken && { sessionToken: data.SessionToken }), data.Expiration && { expiration: new Date(data.Expiration) }), data.CredentialScope && { credentialScope: data.CredentialScope }), accountId && { accountId });
43
- setCredentialFeature(credentials, "CREDENTIALS_PROCESS", "w");
44
- return credentials;
45
- };
46
-
47
- // ../../node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js
48
- var resolveProcessCredentials = async (profileName, profiles, logger) => {
49
- var _a, _b, _c;
50
- const profile = profiles[profileName];
51
- if (profiles[profileName]) {
52
- const credentialProcess = profile["credential_process"];
53
- if (credentialProcess !== void 0) {
54
- const execPromise = promisify((_c = (_b = (_a = externalDataInterceptor) == null ? void 0 : _a.getTokenRecord) == null ? void 0 : _b.call(_a).exec) != null ? _c : exec);
55
- try {
56
- const { stdout } = await execPromise(credentialProcess);
57
- let data;
58
- try {
59
- data = JSON.parse(stdout.trim());
60
- } catch (e) {
61
- throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);
62
- }
63
- return getValidatedProcessCredentials(profileName, data, profiles);
64
- } catch (error) {
65
- throw new CredentialsProviderError(error.message, { logger });
66
- }
67
- } else {
68
- throw new CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });
69
- }
70
- } else {
71
- throw new CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {
72
- logger
73
- });
74
- }
75
- };
76
-
77
- // ../../node_modules/@aws-sdk/credential-provider-process/dist-es/fromProcess.js
78
- var fromProcess = (init = {}) => async ({ callerClientConfig } = {}) => {
79
- var _a, _b;
80
- (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-process - fromProcess");
81
- const profiles = await parseKnownFiles(init);
82
- return resolveProcessCredentials(getProfileName({
83
- profile: (_b = init.profile) != null ? _b : callerClientConfig == null ? void 0 : callerClientConfig.profile
84
- }), profiles, init.logger);
85
- };
86
- export {
87
- fromProcess
88
- };
89
- //# sourceMappingURL=dist-es-NZWWHEBR.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js","../../../node_modules/@aws-sdk/credential-provider-process/dist-es/getValidatedProcessCredentials.js","../../../node_modules/@aws-sdk/credential-provider-process/dist-es/fromProcess.js"],"sourcesContent":["import { CredentialsProviderError, externalDataInterceptor } from \"@smithy/core/config\";\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\nimport { getValidatedProcessCredentials } from \"./getValidatedProcessCredentials\";\nexport const resolveProcessCredentials = async (profileName, profiles, logger) => {\n const profile = profiles[profileName];\n if (profiles[profileName]) {\n const credentialProcess = profile[\"credential_process\"];\n if (credentialProcess !== undefined) {\n const execPromise = promisify(externalDataInterceptor?.getTokenRecord?.().exec ?? exec);\n try {\n const { stdout } = await execPromise(credentialProcess);\n let data;\n try {\n data = JSON.parse(stdout.trim());\n }\n catch {\n throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);\n }\n return getValidatedProcessCredentials(profileName, data, profiles);\n }\n catch (error) {\n throw new CredentialsProviderError(error.message, { logger });\n }\n }\n else {\n throw new CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });\n }\n }\n else {\n throw new CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {\n logger,\n });\n }\n};\n","import { setCredentialFeature } from \"@aws-sdk/core/client\";\nexport const getValidatedProcessCredentials = (profileName, data, profiles) => {\n if (data.Version !== 1) {\n throw Error(`Profile ${profileName} credential_process did not return Version 1.`);\n }\n if (data.AccessKeyId === undefined || data.SecretAccessKey === undefined) {\n throw Error(`Profile ${profileName} credential_process returned invalid credentials.`);\n }\n if (data.Expiration) {\n const currentTime = new Date();\n const expireTime = new Date(data.Expiration);\n if (expireTime < currentTime) {\n throw Error(`Profile ${profileName} credential_process returned expired credentials.`);\n }\n }\n let accountId = data.AccountId;\n if (!accountId && profiles?.[profileName]?.aws_account_id) {\n accountId = profiles[profileName].aws_account_id;\n }\n const credentials = {\n accessKeyId: data.AccessKeyId,\n secretAccessKey: data.SecretAccessKey,\n ...(data.SessionToken && { sessionToken: data.SessionToken }),\n ...(data.Expiration && { expiration: new Date(data.Expiration) }),\n ...(data.CredentialScope && { credentialScope: data.CredentialScope }),\n ...(accountId && { accountId }),\n };\n setCredentialFeature(credentials, \"CREDENTIALS_PROCESS\", \"w\");\n return credentials;\n};\n","import { getProfileName, parseKnownFiles } from \"@smithy/core/config\";\nimport { resolveProcessCredentials } from \"./resolveProcessCredentials\";\nexport const fromProcess = (init = {}) => async ({ callerClientConfig } = {}) => {\n init.logger?.debug(\"@aws-sdk/credential-provider-process - fromProcess\");\n const profiles = await parseKnownFiles(init);\n return resolveProcessCredentials(getProfileName({\n profile: init.profile ?? callerClientConfig?.profile,\n }), profiles, init.logger);\n};\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAAS,YAAY;AACrB,SAAS,iBAAiB;;;ACDnB,IAAM,iCAAiC,CAAC,aAAa,MAAM,aAAa;AAD/E;AAEI,MAAI,KAAK,YAAY,GAAG;AACpB,UAAM,MAAM,WAAW,WAAW,+CAA+C;AAAA,EACrF;AACA,MAAI,KAAK,gBAAgB,UAAa,KAAK,oBAAoB,QAAW;AACtE,UAAM,MAAM,WAAW,WAAW,mDAAmD;AAAA,EACzF;AACA,MAAI,KAAK,YAAY;AACjB,UAAM,cAAc,oBAAI,KAAK;AAC7B,UAAM,aAAa,IAAI,KAAK,KAAK,UAAU;AAC3C,QAAI,aAAa,aAAa;AAC1B,YAAM,MAAM,WAAW,WAAW,mDAAmD;AAAA,IACzF;AAAA,EACJ;AACA,MAAI,YAAY,KAAK;AACrB,MAAI,CAAC,eAAa,0CAAW,iBAAX,mBAAyB,iBAAgB;AACvD,gBAAY,SAAS,WAAW,EAAE;AAAA,EACtC;AACA,QAAM,cAAc;AAAA,IAChB,aAAa,KAAK;AAAA,IAClB,iBAAiB,KAAK;AAAA,KAClB,KAAK,gBAAgB,EAAE,cAAc,KAAK,aAAa,IACvD,KA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