CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-aws-sdk--client-sts

AWS SDK for JavaScript STS Client for Node.js, Browser and React Native, providing temporary security credentials and role assumption capabilities

92

1.05x

Evaluation92%

1.05x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-6/

AWS Temporary Credentials Manager

A utility for managing AWS temporary credentials with support for multiple authentication mechanisms.

Overview

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.

Capabilities

Basic Role Assumption

  • Assumes an IAM role and returns temporary credentials @test
  • Sets a custom session name for the role session @test
  • Handles role assumption with a specific duration (e.g., 3600 seconds) @test

Role Assumption with Session Tags

  • Assumes a role with session tags for authorization and cost tracking @test
  • Validates that session tags are properly included in the credentials @test

Implementation

@generates

API

/**
 * 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>;

Dependencies { .dependencies }

@aws-sdk/client-sts { .dependency }

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-sts

tile.json