working rss feed to nostr publish
This commit is contained in:
+2
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromProcess = void 0;
|
||||
const shared_ini_file_loader_1 = require("@smithy/shared-ini-file-loader");
|
||||
const resolveProcessCredentials_1 = require("./resolveProcessCredentials");
|
||||
const fromProcess = (init = {}) => async () => {
|
||||
const profiles = await (0, shared_ini_file_loader_1.parseKnownFiles)(init);
|
||||
return (0, resolveProcessCredentials_1.resolveProcessCredentials)((0, shared_ini_file_loader_1.getProfileName)(init), profiles);
|
||||
};
|
||||
exports.fromProcess = fromProcess;
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
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;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./fromProcess"), exports);
|
||||
Generated
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveProcessCredentials = void 0;
|
||||
const property_provider_1 = require("@smithy/property-provider");
|
||||
const child_process_1 = require("child_process");
|
||||
const util_1 = require("util");
|
||||
const getValidatedProcessCredentials_1 = require("./getValidatedProcessCredentials");
|
||||
const resolveProcessCredentials = async (profileName, profiles) => {
|
||||
const profile = profiles[profileName];
|
||||
if (profiles[profileName]) {
|
||||
const credentialProcess = profile["credential_process"];
|
||||
if (credentialProcess !== undefined) {
|
||||
const execPromise = (0, util_1.promisify)(child_process_1.exec);
|
||||
try {
|
||||
const { stdout } = await execPromise(credentialProcess);
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(stdout.trim());
|
||||
}
|
||||
catch (_a) {
|
||||
throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);
|
||||
}
|
||||
return (0, getValidatedProcessCredentials_1.getValidatedProcessCredentials)(profileName, data);
|
||||
}
|
||||
catch (error) {
|
||||
throw new property_provider_1.CredentialsProviderError(error.message);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`);
|
||||
}
|
||||
};
|
||||
exports.resolveProcessCredentials = resolveProcessCredentials;
|
||||
Reference in New Issue
Block a user