Skip to content

@venturekit/auth API

FunctionDescription
createCognitoConfig(security)Create Cognito config from SecurityConfig
buildUserPoolConfig(config)Build User Pool infrastructure config
FunctionSignatureDescription
hasScope(roles: string[], scope: string, config: RolesConfig) => booleanCheck if roles grant a scope
hasAnyScope(roles: string[], scopes: string[], config: RolesConfig) => booleanCheck if roles grant any of the scopes
hasAllScopes(roles: string[], scopes: string[], config: RolesConfig) => booleanCheck if roles grant all scopes
getScopesForRoles(roles: string[], config: RolesConfig) => string[]Get all scopes granted by roles
validateRolesConfig(config: RolesConfig) => ValidationResultValidate a roles configuration
FunctionSignatureDescription
decodeToken(jwt: string) => Record<string, unknown>Decode JWT without verification
extractUserFromToken(jwt: string) => UserExtract user from ID token
isTokenExpired(jwt: string) => booleanCheck if token is expired
getTokenExpiry(jwt: string) => DateGet token expiry as Date

Exported from ./types/index.js — includes User, Session, Role, Permission, RolesConfig, and related types.

TypeDescription
UserPoolOutputsCognito User Pool deployment outputs
UserPoolInfraConfigCognito infrastructure configuration
ConstantDescription
DEFAULT_COGNITO_CONFIGDefault Cognito configuration