working rss feed to nostr publish
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromTokenFile = void 0;
|
||||
const property_provider_1 = require("@smithy/property-provider");
|
||||
const fs_1 = require("fs");
|
||||
const fromWebToken_1 = require("./fromWebToken");
|
||||
const ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE";
|
||||
const ENV_ROLE_ARN = "AWS_ROLE_ARN";
|
||||
const ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME";
|
||||
const fromTokenFile = (init = {}) => async () => {
|
||||
var _a, _b, _c;
|
||||
const webIdentityTokenFile = (_a = init === null || init === void 0 ? void 0 : init.webIdentityTokenFile) !== null && _a !== void 0 ? _a : process.env[ENV_TOKEN_FILE];
|
||||
const roleArn = (_b = init === null || init === void 0 ? void 0 : init.roleArn) !== null && _b !== void 0 ? _b : process.env[ENV_ROLE_ARN];
|
||||
const roleSessionName = (_c = init === null || init === void 0 ? void 0 : init.roleSessionName) !== null && _c !== void 0 ? _c : process.env[ENV_ROLE_SESSION_NAME];
|
||||
if (!webIdentityTokenFile || !roleArn) {
|
||||
throw new property_provider_1.CredentialsProviderError("Web identity configuration not specified");
|
||||
}
|
||||
return (0, fromWebToken_1.fromWebToken)({
|
||||
...init,
|
||||
webIdentityToken: (0, fs_1.readFileSync)(webIdentityTokenFile, { encoding: "ascii" }),
|
||||
roleArn,
|
||||
roleSessionName,
|
||||
})();
|
||||
};
|
||||
exports.fromTokenFile = fromTokenFile;
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromWebToken = void 0;
|
||||
const property_provider_1 = require("@smithy/property-provider");
|
||||
const fromWebToken = (init) => () => {
|
||||
const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds, roleAssumerWithWebIdentity, } = init;
|
||||
if (!roleAssumerWithWebIdentity) {
|
||||
throw new property_provider_1.CredentialsProviderError(`Role Arn '${roleArn}' needs to be assumed with web identity,` +
|
||||
` but no role assumption callback was provided.`, false);
|
||||
}
|
||||
return roleAssumerWithWebIdentity({
|
||||
RoleArn: roleArn,
|
||||
RoleSessionName: roleSessionName !== null && roleSessionName !== void 0 ? roleSessionName : `aws-sdk-js-session-${Date.now()}`,
|
||||
WebIdentityToken: webIdentityToken,
|
||||
ProviderId: providerId,
|
||||
PolicyArns: policyArns,
|
||||
Policy: policy,
|
||||
DurationSeconds: durationSeconds,
|
||||
});
|
||||
};
|
||||
exports.fromWebToken = fromWebToken;
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./fromTokenFile"), exports);
|
||||
tslib_1.__exportStar(require("./fromWebToken"), exports);
|
||||
Reference in New Issue
Block a user