bot / node_modules /@aws-sdk /credential-provider-process /dist-cjs /getValidatedProcessCredentials.js
Download node_modules/@aws-sdk/credential-provider-process/dist-cjs/getValidatedProcessCredentials.js from sweet2004/bot: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/spaces/sweet2004/bot/resolve/main/node_modules/%40aws-sdk/credential-provider-process/dist-cjs/getValidatedProcessCredentials.js
- Command line
-
hf download hf://spaces/sweet2004/bot/node_modules/@aws-sdk/credential-provider-process/dist-cjs/getValidatedProcessCredentials.js
-
curl -L -o getValidatedProcessCredentials.js https://huggingface.co/spaces/sweet2004/bot/resolve/main/node_modules/%40aws-sdk/credential-provider-process/dist-cjs/getValidatedProcessCredentials.js
1.11 kB
| ; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.getValidatedProcessCredentials = void 0; | |
| const getValidatedProcessCredentials = (profileName, data) => { | |
| if (data.Version !== 1) { | |
| throw Error(`Profile ${profileName} credential_process did not return Version 1.`); | |
| } | |
| if (data.AccessKeyId === undefined || data.SecretAccessKey === undefined) { | |
| throw Error(`Profile ${profileName} credential_process returned invalid credentials.`); | |
| } | |
| if (data.Expiration) { | |
| const currentTime = new Date(); | |
| const expireTime = new Date(data.Expiration); | |
| if (expireTime < currentTime) { | |
| throw Error(`Profile ${profileName} credential_process returned expired credentials.`); | |
| } | |
| } | |
| return { | |
| accessKeyId: data.AccessKeyId, | |
| secretAccessKey: data.SecretAccessKey, | |
| ...(data.SessionToken && { sessionToken: data.SessionToken }), | |
| ...(data.Expiration && { expiration: new Date(data.Expiration) }), | |
| }; | |
| }; | |
| exports.getValidatedProcessCredentials = getValidatedProcessCredentials; | |