@aws/bedrock-token-generator
Version:
A lightweight library for generating short-term bearer tokens for AWS Bedrock API authentication
26 lines • 819 B
JavaScript
;
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getToken = void 0;
const token_1 = require("./token");
/**
* Generates an AWS Bedrock API token.
*
* @param config - Configuration options for token generation @see {@link GetTokenConfig}
* @returns A promise that resolves to a token string
*
* @example
* const token = await getToken({
* credentials: { accessKeyId: 'KEY', secretAccessKey: 'SECRET' },
* region: 'us-west-2'
* });
*/
const getToken = async (config) => {
(0, token_1.validateTokenExpiryInput)(config.expiresInSeconds);
return (0, token_1.createToken)(config);
};
exports.getToken = getToken;
//# sourceMappingURL=getToken.js.map