@archon-inc/sdk
Version:
Integrate easily to our government platform using this SDK. More info on https://archon.inc/sdk
20 lines (19 loc) • 777 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = getSecret;
const Archon_js_1 = require("../Archon.js");
/**
* Get a secret from the Archon configurator secret store. This includes database passwords, API keys, and other sensitive information.
*
* Make sure the application calling this API has the appropriate permissions to access the secret.
* @param key The key of the secret to retrieve.
* @returns The secret value.
*/
async function getSecret(key) {
const response = await Archon_js_1.Archon.request(`/config/secret/${key}`, "GET");
if (response.status !== 200) {
throw new Error(`Failed to retrieve configuration value for key ${key}.`);
}
const data = response.data;
return data.value;
}