@fiftyten/db-connect
Version:
CLI tool for database connections and DynamoDB operations via AWS Session Manager
59 lines • 1.66 kB
TypeScript
export interface MfaCredentials {
accessKeyId: string;
secretAccessKey: string;
sessionToken: string;
expiration?: Date;
}
export interface MfaConfig {
roleArn?: string;
mfaSerial?: string;
sessionName?: string;
region?: string;
}
export declare class MfaAuthenticator {
private stsClient;
private iamClient;
private region;
constructor(region?: string);
/**
* Check if current credentials are MFA-authenticated
*/
checkMfaStatus(): Promise<boolean>;
/**
* Detect if an error is due to MFA requirement
*/
isMfaRequired(error: any): boolean;
/**
* Auto-discover MFA devices for current user
*/
discoverMfaDevices(): Promise<string[]>;
/**
* Automatically detect MFA configuration from AWS config
*/
detectMfaConfig(): Promise<MfaConfig | null>;
/**
* Prompt user for MFA configuration
*/
promptMfaConfig(detectedConfig?: MfaConfig | null): Promise<MfaConfig>;
/**
* Prompt for MFA token
*/
promptMfaToken(): Promise<string>;
/**
* Get session token with MFA (for users with MFA enforcement policies)
*/
getSessionTokenWithMfa(config: MfaConfig, tokenCode: string): Promise<MfaCredentials>;
/**
* Assume role with MFA
*/
assumeRoleWithMfa(config: MfaConfig, tokenCode: string): Promise<MfaCredentials>;
/**
* Full MFA authentication flow
*/
authenticateWithMfa(): Promise<MfaCredentials>;
/**
* Apply MFA credentials to AWS SDK clients
*/
applyCredentials(credentials: MfaCredentials): void;
}
//# sourceMappingURL=mfa-auth.d.ts.map