@nibssplc/cams-sdk
Version:
Central Authentication Management Service (CAMS) SDK for popup-based authentication with Azure AD + custom 2FA
80 lines (79 loc) • 1.88 kB
TypeScript
export interface CAMSConfig {
camsUrl: string;
messageOrigin: string;
allowedRedirectDomains?: string[];
windowWidth: number;
windowHeight: number;
authTimeout?: number;
idleTimeout?: number;
storageKey?: string;
retryAttempts?: number;
debug?: boolean;
}
export declare enum CAMSErrorType {
POPUP_BLOCKED = "POPUP_BLOCKED",
TIMEOUT = "TIMEOUT",
INVALID_ORIGIN = "INVALID_ORIGIN",
API_UNAUTHORIZED_ERROR = "UNAUTHORIZED_USER",
USER_CANCELLED = "USER_CANCELLED",
INVALID_URL = "INVALID_URL",
MAX_RETRIES_EXCEEDED = "MAX_RETRIES_EXCEEDED",
API_VALIDATION_ERROR = "VALIDATION_ERROR",
NETWORK_ERROR = "NETWORK_ERROR"
}
export declare class CAMSError extends Error {
type: CAMSErrorType;
constructor(type: CAMSErrorType, message: string);
}
export interface MFASDKRequest {
accessToken: string;
idToken: string;
provider: string;
APIAuthEndpoint: string;
}
export interface UserValidatedResponse {
isValid: boolean;
message: string;
userInfo: {
id: number;
email: string;
name: string;
isMFAEnabled: boolean;
};
}
export interface StandaloneMFARequest {
email: string;
instCode?: string;
MFACode: string;
appCode: string;
}
export interface MFAAuthenticatedResponse {
isValid: boolean;
message: string;
userInfo: {
id: number;
email: string;
name: string;
role: string;
isMFAEnabled: boolean;
};
tokens: {
Nonce: string;
Bearer: string;
};
}
export interface Credentials {
username: string;
password: string;
MFACode: string;
appCode: string;
}
export interface AttestationResult {
id: string;
rawId: string;
type: string;
response: {
clientDataJSON: string;
attestationObject: string;
};
}