working rss feed to nostr publish

This commit is contained in:
2023-11-24 00:43:28 -05:00
parent 06edcb57ae
commit 88d2f9cfec
8396 changed files with 783105 additions and 0 deletions
@@ -0,0 +1,20 @@
import { CredentialsProviderError } from "@smithy/property-provider";
import { readFileSync } from "fs";
import { fromWebToken } from "./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";
export const fromTokenFile = (init = {}) => async () => {
const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];
const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];
const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME];
if (!webIdentityTokenFile || !roleArn) {
throw new CredentialsProviderError("Web identity configuration not specified");
}
return fromWebToken({
...init,
webIdentityToken: readFileSync(webIdentityTokenFile, { encoding: "ascii" }),
roleArn,
roleSessionName,
})();
};
@@ -0,0 +1,17 @@
import { CredentialsProviderError } from "@smithy/property-provider";
export const fromWebToken = (init) => () => {
const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds, roleAssumerWithWebIdentity, } = init;
if (!roleAssumerWithWebIdentity) {
throw new 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 ?? `aws-sdk-js-session-${Date.now()}`,
WebIdentityToken: webIdentityToken,
ProviderId: providerId,
PolicyArns: policyArns,
Policy: policy,
DurationSeconds: durationSeconds,
});
};
@@ -0,0 +1,2 @@
export * from "./fromTokenFile";
export * from "./fromWebToken";