AWS SDK for JavaScript STS Client for Node.js, Browser and React Native, providing temporary security credentials and role assumption capabilities
92
Evaluation — 92%
↑ 1.05xAgent success when using this tile
A utility for managing AWS temporary credentials with support for multiple authentication mechanisms.
Build a credential management utility that can assume IAM roles and generate temporary credentials using AWS Security Token Service (STS). The utility should support both standard role assumption and role assumption with session tags for enhanced authorization tracking.
@generates
/**
* Configuration for credential operations
*/
interface CredentialConfig {
region: string;
credentials: {
accessKeyId: string;
secretAccessKey: string;
sessionToken?: string;
};
}
/**
* Session tag for role assumption
*/
interface SessionTag {
Key: string;
Value: string;
}
/**
* Temporary credentials returned from role assumption
*/
interface TemporaryCredentials {
accessKeyId: string;
secretAccessKey: string;
sessionToken: string;
expiration: Date;
}
/**
* Assumes an IAM role and returns temporary credentials
* @param config - Configuration including region and base credentials
* @param roleArn - The ARN of the role to assume
* @param sessionName - A unique identifier for the session
* @param durationSeconds - Duration in seconds (900-43200, default 3600)
* @returns Temporary credentials for the assumed role
*/
export async function assumeRole(
config: CredentialConfig,
roleArn: string,
sessionName: string,
durationSeconds?: number
): Promise<TemporaryCredentials>;
/**
* Assumes an IAM role with session tags for enhanced tracking
* @param config - Configuration including region and base credentials
* @param roleArn - The ARN of the role to assume
* @param sessionName - A unique identifier for the session
* @param tags - Session tags for authorization and cost tracking
* @param durationSeconds - Duration in seconds (900-43200, default 3600)
* @returns Temporary credentials for the assumed role
*/
export async function assumeRoleWithTags(
config: CredentialConfig,
roleArn: string,
sessionName: string,
tags: SessionTag[],
durationSeconds?: number
): Promise<TemporaryCredentials>;Provides AWS Security Token Service client for managing temporary credentials and role assumption.
Install with Tessl CLI
npx tessl i tessl/npm-aws-sdk--client-stsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10