MCPcopy Index your code
hub / github.com/codeaashu/claude-code / isValidAwsStsOutput

Function isValidAwsStsOutput

src/utils/aws.ts:25–47  ·  view source on GitHub ↗
(obj: unknown)

Source from the content-addressed store, hash-verified

23
24/** Typeguard to validate AWS STS assume-role output */
25export function isValidAwsStsOutput(obj: unknown): obj is AwsStsOutput {
26 if (!obj || typeof obj !== 'object') {
27 return false
28 }
29
30 const output = obj as Record<string, unknown>
31
32 // Check if Credentials exists and has required fields
33 if (!output.Credentials || typeof output.Credentials !== 'object') {
34 return false
35 }
36
37 const credentials = output.Credentials as Record<string, unknown>
38
39 return (
40 typeof credentials.AccessKeyId === 'string' &&
41 typeof credentials.SecretAccessKey === 'string' &&
42 typeof credentials.SessionToken === 'string' &&
43 credentials.AccessKeyId.length > 0 &&
44 credentials.SecretAccessKey.length > 0 &&
45 credentials.SessionToken.length > 0
46 )
47}
48
49/** Throws if STS caller identity cannot be retrieved. */
50export async function checkStsCallerIdentity(): Promise<void> {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected