@metamask-previews/profile-sync-controller 32.3.1-preview-3c2e73813 → 32.3.1-preview-33429d645
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -1
- package/README.md +19 -11
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts +25 -22
- package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController-method-action-types.js.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.ts +33 -21
- package/dist/controllers/authentication/AuthenticationController.d.ts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.js +115 -69
- package/dist/controllers/authentication/AuthenticationController.js.map +1 -1
- package/dist/controllers/authentication/index.d.ts +1 -1
- package/dist/controllers/authentication/index.d.ts.map +1 -1
- package/dist/controllers/authentication/index.js.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts +13 -11
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.js +9 -7
- package/dist/sdk/authentication-jwt-bearer/flow-srp.js.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/schemas.d.ts +13 -14
- package/dist/sdk/authentication-jwt-bearer/mfa/schemas.d.ts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/schemas.js +19 -17
- package/dist/sdk/authentication-jwt-bearer/mfa/schemas.js.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/services.d.ts +6 -6
- package/dist/sdk/authentication-jwt-bearer/mfa/services.d.ts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/services.js +8 -6
- package/dist/sdk/authentication-jwt-bearer/mfa/services.js.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/types.d.ts +25 -11
- package/dist/sdk/authentication-jwt-bearer/mfa/types.d.ts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/mfa/types.js.map +1 -1
- package/dist/sdk/authentication.d.ts +4 -4
- package/dist/sdk/authentication.d.ts.map +1 -1
- package/dist/sdk/authentication.js.map +1 -1
- package/dist/sdk/errors.d.ts +4 -4
- package/dist/sdk/errors.d.ts.map +1 -1
- package/dist/sdk/errors.js +6 -6
- package/dist/sdk/errors.js.map +1 -1
- package/dist/sdk/index.d.ts +2 -2
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/mocks/auth.d.ts +2 -2
- package/dist/sdk/mocks/auth.d.ts.map +1 -1
- package/dist/sdk/mocks/auth.js +3 -3
- package/dist/sdk/mocks/auth.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/mfa/services.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,UAAU,CAAC;AAG3B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,QAAQ,EACR,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EACL,gCAAgC,EAChC,4BAA4B,EAC5B,+BAA+B,EAC/B,uBAAuB,EACvB,sBAAsB,EACtB,+BAA+B,EAC/B,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,8BAA8B,EAC9B,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,cAAc,C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DAAsD,IAAI,EAAE,CAAC,CAAC;IACvE,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,GAAQ,EACR,WAAmB;IAEnB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC;IACtE,sBAAsB,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;IAC3D,OAAO,IAAI,CAAC,WAAW;SACpB,GAAG,CAAC,oBAAoB,CAAC;SACzB,MAAM,CAAC,CAAC,UAAU,EAAoC,EAAE,CACvD,OAAO,CAAC,UAAU,CAAC,CACpB,CAAC;AACN,CAAC","sourcesContent":["import type { Json } from '@metamask/utils';\nimport log from 'loglevel';\n\nimport type { Env } from '../../../shared/env.js';\nimport { getEnvUrls } from '../../../shared/env.js';\nimport { HTTP_STATUS_CODES } from '../../constants.js';\nimport {\n CredentialAlreadyEnrolledError,\n CredentialNotEnrolledError,\n MaxIdentifiersReachedError,\n MaxPasskeysReachedError,\n MfaError,\n MfaFlowExpiredError,\n MfaIdentityMissingError,\n MfaRateLimitedError,\n MfaUnavailableError,\n MfaVerificationFailedError,\n OtpResendCooldownError,\n StepUpRequiredError,\n TooManyAttemptsError,\n} from '../../errors.js';\nimport { asRecord } from '../../utils/as-record.js';\nimport { toErrorMessage } from '../../utils/to-error-message.js';\nimport {\n AuthenticationResponseJSONStruct,\n MfaCredentialsResponseStruct,\n MfaEnrollCompleteResponseStruct,\n MfaEnrollResponseStruct,\n MfaErrorResponseStruct,\n MfaVerifyCompleteResponseStruct,\n MfaVerifyResponseStruct,\n PasskeyCreateDataStruct,\n PasskeyRequestDataStruct,\n RegistrationResponseJSONStruct,\n assertValidMfaRequest,\n assertValidMfaResponse,\n} from './schemas.js';\nimport type {\n AuthenticationResponseJSON,\n EnrolledCredential,\n MfaCredential,\n MfaCredentialStatus,\n MfaCredentialType,\n MfaEnrollCompleteRequest,\n MfaEnrollRequest,\n MfaVerifyCompleteRequest,\n MfaVerifyRequest,\n PublicKeyCredentialCreationOptionsJSON as PasskeyCreationOptions,\n PublicKeyCredentialRequestOptionsJSON as PasskeyRequestOptions,\n RegistrationResponseJSON,\n} from './types.js';\n\nexport const MFA_ENROLL_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/mfa/enroll`;\n\nexport const MFA_ENROLL_COMPLETE_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/mfa/enroll/complete`;\n\nexport const MFA_VERIFY_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/mfa/verify`;\n\nexport const MFA_VERIFY_COMPLETE_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/mfa/verify/complete`;\n\nexport const MFA_CREDENTIALS_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/mfa/credentials`;\n\ntype EnrollmentServiceResult = {\n flowId: string;\n expiresAt: number;\n publicKey?: PasskeyCreationOptions;\n};\n\ntype VerificationServiceResult = {\n flowId: string;\n expiresAt: number;\n publicKey?: PasskeyRequestOptions;\n};\n\nexport type MfaStepUpAssertion = {\n /** AAL2 assertion JWT to exchange at Hydra for an elevated access token. */\n token: string;\n /** Assertion lifetime in seconds. */\n expiresIn: number;\n};\n\ntype EnrollmentCompletionParams = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n credential_type: MfaCredentialType;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n flow_id: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n otp_code?: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n passkey_attestation?: RegistrationResponseJSON;\n};\n\ntype VerificationCompletionParams = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n credential_type: MfaCredentialType;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n flow_id: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n otp_code?: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n passkey_assertion?: AuthenticationResponseJSON;\n};\n\n/**\n * Reads a credential's enrollment date. Unlike flow deadlines, this is display\n * metadata, so an unparsable value is dropped instead of rejecting the whole\n * credential list.\n *\n * @param value - The raw `enrolled_at` value, if the server sent one.\n * @returns The epoch milliseconds, or undefined when absent or unparsable.\n */\nfunction parseEnrolledAt(value: string | undefined): number | undefined {\n if (!value) {\n return undefined;\n }\n const enrolledAt = Date.parse(value);\n if (Number.isNaN(enrolledAt)) {\n log.warn(`Ignoring unparsable MFA credential enrolled_at: ${value}`);\n return undefined;\n }\n return enrolledAt;\n}\n\nfunction parseExpiresAt(value: string): number {\n const expiresAt = Date.parse(value);\n if (Number.isNaN(expiresAt)) {\n throw new MfaError('invalid_response', `Invalid expires_at: ${value}`);\n }\n return expiresAt;\n}\n\n/**\n * Parses passkey creation data embedded in an enrollment response.\n *\n * @param value - JSON-encoded creation options.\n * @returns Validated public-key creation options.\n */\nexport function parsePasskeyCreateData(value: string): PasskeyCreationOptions {\n try {\n const parsed: unknown = JSON.parse(value);\n assertValidMfaResponse(parsed, PasskeyCreateDataStruct);\n return parsed.publicKey;\n } catch (error) {\n if (error instanceof MfaError) {\n throw error;\n }\n const message = toErrorMessage(error);\n throw new MfaError('invalid_response', message);\n }\n}\n\n/**\n * Parses passkey request data embedded in a verification response.\n *\n * @param value - JSON-encoded request options.\n * @returns Validated public-key request options.\n */\nexport function parsePasskeyRequestData(value: string): PasskeyRequestOptions {\n try {\n const parsed: unknown = JSON.parse(value);\n assertValidMfaResponse(parsed, PasskeyRequestDataStruct);\n return parsed.publicKey;\n } catch (error) {\n if (error instanceof MfaError) {\n throw error;\n }\n const message = toErrorMessage(error);\n throw new MfaError('invalid_response', message);\n }\n}\n\n/**\n * Reads a `Retry-After` header as a delay. The human-readable error message is\n * deliberately not parsed: the API documents it as unstable.\n *\n * @param response - The throttled response.\n * @returns The delay in milliseconds, or undefined without a usable header.\n */\nfunction parseRetryAfter(response: Response): number | undefined {\n const header = response.headers.get('Retry-After');\n if (!header) {\n return undefined;\n }\n const seconds = Number(header);\n if (Number.isInteger(seconds)) {\n return Math.max(0, seconds * 1000);\n }\n const date = Date.parse(header);\n return Number.isNaN(date) ? undefined : Math.max(0, date - Date.now());\n}\n\n/**\n * Reads and validates the JSON error body of a failed MFA request.\n *\n * When the body parses as JSON but does not match the documented error\n * shape, a `message` field is salvaged if present so callers still get a\n * useful diagnostic instead of a content-free fallback.\n *\n * @param response - The failed response.\n * @returns The validated error body, a best-effort salvage of it, or\n * undefined when the body could not be parsed as JSON at all.\n */\ntype MfaErrorBody = {\n code?: string;\n message: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n retry_after_seconds?: number;\n};\n\n/**\n * Prefers the documented `retry_after_seconds` error field over the\n * `Retry-After` header.\n *\n * @param body - The parsed error body, if any.\n * @param response - The throttled response.\n * @returns The delay in milliseconds, or undefined when neither is usable.\n */\nfunction resolveRetryAfterMs(\n body: MfaErrorBody | undefined,\n response: Response,\n): number | undefined {\n return body?.retry_after_seconds === undefined\n ? parseRetryAfter(response)\n : body.retry_after_seconds * 1000;\n}\n\nasync function readErrorBody(\n response: Response,\n): Promise<MfaErrorBody | undefined> {\n let body: unknown;\n try {\n body = await response.json();\n } catch {\n return undefined;\n }\n\n try {\n assertValidMfaResponse(body, MfaErrorResponseStruct);\n return body;\n } catch {\n const message = asRecord(body)?.message;\n return typeof message === 'string' ? { message } : undefined;\n }\n}\n\nasync function throwMfaError(\n response: Response,\n errorPrefix: string,\n): Promise<never> {\n const { status } = response;\n const body = await readErrorBody(response);\n const message = `${errorPrefix}: ${body?.message ?? `HTTP ${status}`}`;\n\n // Status-only classification first: gateways and load balancers answer\n // 401/429/502 without the service's JSON body, and the caller still needs\n // to invalidate its session, honour Retry-After, or back off.\n if (status === HTTP_STATUS_CODES.UNAUTHORIZED) {\n throw new MfaError('authentication_required', message, { status });\n }\n\n const code = body?.code;\n switch (code) {\n case 'credential_already_enrolled':\n case 'email_already_enrolled':\n case 'email_socially_verified':\n throw new CredentialAlreadyEnrolledError(code, message, status);\n case 'credential_not_enrolled':\n throw new CredentialNotEnrolledError(message, status);\n case 'aal2_required':\n throw new StepUpRequiredError(message, status);\n case 'flow_expired':\n case 'invalid_flow':\n throw new MfaFlowExpiredError(code, message, status);\n case 'mfa_identity_missing':\n throw new MfaIdentityMissingError(message, status);\n case 'invalid_code':\n case 'invalid_attestation':\n case 'invalid_assertion':\n throw new MfaVerificationFailedError(code, message, status);\n case 'too_many_attempts':\n throw new TooManyAttemptsError(message, status);\n case 'max_passkeys_reached':\n throw new MaxPasskeysReachedError(message, status);\n case 'max_identifiers_reached':\n throw new MaxIdentifiersReachedError(message, status);\n case 'otp_resend_cooldown':\n throw new OtpResendCooldownError(\n message,\n resolveRetryAfterMs(body, response),\n status,\n );\n case 'kratos_unavailable':\n throw new MfaUnavailableError(message, status);\n default:\n break;\n }\n\n if (status === HTTP_STATUS_CODES.TOO_MANY_REQUESTS) {\n throw new MfaRateLimitedError(\n message,\n resolveRetryAfterMs(body, response),\n status,\n );\n }\n if (status === HTTP_STATUS_CODES.BAD_GATEWAY) {\n throw new MfaUnavailableError(message, status);\n }\n if (!body) {\n throw new MfaError(\n 'invalid_response',\n `${errorPrefix}: Unexpected error response (HTTP ${status})`,\n { status },\n );\n }\n throw new MfaError(code ?? 'server_error', message, { status });\n}\n\nasync function requestJson(\n url: string,\n accessToken: string,\n init?: { method?: 'GET' | 'POST'; body?: Json },\n): Promise<Json> {\n let response: Response;\n try {\n response = await fetch(url, {\n method: init?.method ?? 'GET',\n headers: {\n Authorization: `Bearer ${accessToken}`,\n ...(init?.body === undefined\n ? {}\n : { 'Content-Type': 'application/json' }),\n },\n ...(init?.body === undefined ? {} : { body: JSON.stringify(init.body) }),\n });\n } catch (error) {\n const message = toErrorMessage(error);\n throw new MfaUnavailableError(`MFA request failed: ${message}`);\n }\n\n if (!response.ok) {\n return await throwMfaError(response, 'MFA request failed');\n }\n\n try {\n return await response.json();\n } catch (error) {\n const message = toErrorMessage(error);\n throw new MfaError('invalid_response', message, {\n status: response.status,\n });\n }\n}\n\n/**\n * Begins enrollment of an MFA credential.\n *\n * @param env - Authentication environment.\n * @param accessToken - Primary profile access token.\n * @param body - Enrollment request.\n * @returns Validated enrollment flow data.\n */\nexport async function mfaEnroll(\n env: Env,\n accessToken: string,\n body: MfaEnrollRequest,\n): Promise<EnrollmentServiceResult> {\n const json = await requestJson(MFA_ENROLL_URL(env), accessToken, {\n method: 'POST',\n body,\n });\n assertValidMfaResponse(json, MfaEnrollResponseStruct);\n\n return {\n flowId: json.flow_id,\n expiresAt: parseExpiresAt(json.expires_at),\n ...(json.passkey_create_data\n ? { publicKey: parsePasskeyCreateData(json.passkey_create_data) }\n : {}),\n };\n}\n\n/**\n * Completes enrollment of an MFA credential.\n *\n * @param env - Authentication environment.\n * @param accessToken - Primary profile access token.\n * @param params - Flow identifier and enrollment proof.\n */\nexport async function mfaEnrollComplete(\n env: Env,\n accessToken: string,\n params: EnrollmentCompletionParams,\n): Promise<void> {\n let body: MfaEnrollCompleteRequest = {\n credential_type: params.credential_type,\n flow_id: params.flow_id,\n ...(params.otp_code ? { otp_code: params.otp_code } : {}),\n };\n if (params.passkey_attestation) {\n assertValidMfaRequest(\n params.passkey_attestation,\n RegistrationResponseJSONStruct,\n );\n body = {\n ...body,\n passkey_attestation: JSON.stringify(params.passkey_attestation),\n };\n }\n\n const json = await requestJson(MFA_ENROLL_COMPLETE_URL(env), accessToken, {\n method: 'POST',\n body,\n });\n assertValidMfaResponse(json, MfaEnrollCompleteResponseStruct);\n}\n\n/**\n * Begins step-up verification with an enrolled credential.\n *\n * @param env - Authentication environment.\n * @param accessToken - Primary profile access token.\n * @param body - Verification request.\n * @returns Validated verification flow data.\n */\nexport async function mfaVerify(\n env: Env,\n accessToken: string,\n body: MfaVerifyRequest,\n): Promise<VerificationServiceResult> {\n const json = await requestJson(MFA_VERIFY_URL(env), accessToken, {\n method: 'POST',\n body,\n });\n assertValidMfaResponse(json, MfaVerifyResponseStruct);\n\n return {\n flowId: json.flow_id,\n expiresAt: parseExpiresAt(json.expires_at),\n ...(json.passkey_request_data\n ? { publicKey: parsePasskeyRequestData(json.passkey_request_data) }\n : {}),\n };\n}\n\n/**\n * Completes step-up verification with an enrolled credential.\n *\n * @param env - Authentication environment.\n * @param accessToken - Primary profile access token.\n * @param params - Flow identifier and verification proof.\n * @returns The AAL2 assertion JWT and its lifetime in seconds.\n */\nexport async function mfaVerifyComplete(\n env: Env,\n accessToken: string,\n params: VerificationCompletionParams,\n): Promise<MfaStepUpAssertion> {\n let body: MfaVerifyCompleteRequest = {\n credential_type: params.credential_type,\n flow_id: params.flow_id,\n ...(params.otp_code ? { otp_code: params.otp_code } : {}),\n };\n if (params.passkey_assertion) {\n assertValidMfaRequest(\n params.passkey_assertion,\n AuthenticationResponseJSONStruct,\n );\n body = {\n ...body,\n passkey_assertion: JSON.stringify(params.passkey_assertion),\n };\n }\n\n const json = await requestJson(MFA_VERIFY_COMPLETE_URL(env), accessToken, {\n method: 'POST',\n body,\n });\n assertValidMfaResponse(json, MfaVerifyCompleteResponseStruct);\n return { token: json.token, expiresIn: json.expires_in };\n}\n\nfunction isSupportedStatus(status: string): status is MfaCredentialStatus {\n return status === 'active' || status === 'pending';\n}\n\n/**\n * Maps a server credential to its public controller representation.\n *\n * Unknown credential types or statuses are dropped so the server can extend\n * either without invalidating the whole list.\n *\n * @param credential - Validated server credential.\n * @returns A supported credential, or null when it cannot be represented.\n */\nexport function toEnrolledCredential(\n credential: MfaCredential,\n): EnrolledCredential | null {\n const { credential_type: type, status } = credential;\n if (!isSupportedStatus(status)) {\n log.warn(`Ignoring MFA credential with unsupported status: ${status}`);\n return null;\n }\n\n const enrolledAt = parseEnrolledAt(credential.enrolled_at);\n const base = {\n status,\n ...(enrolledAt === undefined ? {} : { enrolledAt }),\n };\n\n if (type === 'passkey') {\n return {\n type,\n ...base,\n ...(credential.passkey?.display_name\n ? { displayName: credential.passkey.display_name }\n : {}),\n };\n }\n\n if (type === 'email_otp' && credential.email?.address !== undefined) {\n return {\n type,\n ...base,\n email: credential.email.address,\n // The spec marks `verified` optional; an active row is verified.\n verified: credential.email.verified ?? status === 'active',\n };\n }\n\n log.warn(`Ignoring unsupported or incomplete MFA credential: ${type}`);\n return null;\n}\n\n/**\n * Gets the credentials enrolled on the canonical profile.\n *\n * @param env - Authentication environment.\n * @param accessToken - Primary profile access token.\n * @returns Supported enrolled credentials.\n */\nexport async function getMfaCredentials(\n env: Env,\n accessToken: string,\n): Promise<EnrolledCredential[]> {\n const json = await requestJson(MFA_CREDENTIALS_URL(env), accessToken);\n assertValidMfaResponse(json, MfaCredentialsResponseStruct);\n return json.credentials\n .map(toEnrolledCredential)\n .filter((credential): credential is EnrolledCredential =>\n Boolean(credential),\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/mfa/services.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,UAAU,CAAC;AAG3B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,QAAQ,EACR,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EACL,gCAAgC,EAChC,4BAA4B,EAC5B,+BAA+B,EAC/B,uBAAuB,EACvB,sBAAsB,EACtB,+BAA+B,EAC/B,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB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EAAE,CAAC;YACpD,iEAAiE;YACjE,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE,QAAQ,IAAI,MAAM,KAAK,QAAQ;SAC5D,CAAC;IACJ,CAAC;IAED,GAAG,CAAC,IAAI,CAAC,sDAAsD,IAAI,EAAE,CAAC,CAAC;IACvE,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,GAAQ,EACR,WAAmB;IAEnB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC;IACtE,sBAAsB,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;IAC3D,OAAO,IAAI,CAAC,WAAW;SACpB,GAAG,CAAC,oBAAoB,CAAC;SACzB,MAAM,CAAC,CAAC,UAAU,EAAoC,EAAE,CACvD,OAAO,CAAC,UAAU,CAAC,CACpB,CAAC;AACN,CAAC","sourcesContent":["import type { Json } from '@metamask/utils';\nimport log from 'loglevel';\n\nimport type { Env } from '../../../shared/env.js';\nimport { getEnvUrls } from '../../../shared/env.js';\nimport { HTTP_STATUS_CODES } from '../../constants.js';\nimport {\n CredentialAlreadyEnrolledError,\n CredentialNotEnrolledError,\n MaxIdentifiersReachedError,\n MaxPasskeysReachedError,\n MfaError,\n MfaFlowExpiredError,\n MfaIdentityMissingError,\n MfaRateLimitedError,\n MfaUnavailableError,\n MfaVerificationFailedError,\n OtpResendCooldownError,\n StepUpRequiredError,\n TooManyAttemptsError,\n} from '../../errors.js';\nimport { asRecord } from '../../utils/as-record.js';\nimport { toErrorMessage } from '../../utils/to-error-message.js';\nimport {\n AuthenticationResponseJSONStruct,\n MfaCredentialsResponseStruct,\n MfaEnrollCompleteResponseStruct,\n MfaEnrollResponseStruct,\n MfaErrorResponseStruct,\n MfaVerifyCompleteResponseStruct,\n MfaVerifyResponseStruct,\n PasskeyCreateDataStruct,\n PasskeyRequestDataStruct,\n RegistrationResponseJSONStruct,\n assertValidMfaRequest,\n assertValidMfaResponse,\n} from './schemas.js';\nimport type {\n AuthenticationResponseJSON,\n EnrolledCredential,\n MfaCredential,\n MfaCredentialStatus,\n MfaCredentialType,\n MfaEnrollCompleteRequest,\n MfaEnrollRequest,\n MfaVerifyCompleteRequest,\n MfaVerifyRequest,\n PublicKeyCredentialCreationOptionsJSON as PasskeyCreationOptions,\n PublicKeyCredentialRequestOptionsJSON as PasskeyRequestOptions,\n RegistrationResponseJSON,\n} from './types.js';\n\nexport const MFA_ENROLL_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/mfa/enroll`;\n\nexport const MFA_ENROLL_COMPLETE_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/mfa/enroll/complete`;\n\nexport const MFA_VERIFY_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/mfa/verify`;\n\nexport const MFA_VERIFY_COMPLETE_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/mfa/verify/complete`;\n\nexport const MFA_CREDENTIALS_URL = (env: Env): string =>\n `${getEnvUrls(env).authApiUrl}/api/v2/mfa/credentials`;\n\ntype EnrollmentServiceResult = {\n flowId: string;\n expiresAt: number;\n publicKey?: PasskeyCreationOptions;\n};\n\ntype VerificationServiceResult = {\n flowId: string;\n expiresAt: number;\n publicKey?: PasskeyRequestOptions;\n};\n\nexport type MfaVerificationAssertion = {\n /** Assertion JWT to exchange at Hydra for an access token. */\n token: string;\n /** Assertion lifetime in seconds. */\n expiresIn: number;\n};\n\ntype EnrollmentCompletionParams = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n credential_type: MfaCredentialType;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n flow_id: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n otp_code?: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n passkey_attestation?: RegistrationResponseJSON;\n};\n\ntype VerificationCompletionParams = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n credential_type: MfaCredentialType;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n flow_id: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n otp_code?: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n passkey_assertion?: AuthenticationResponseJSON;\n};\n\n/**\n * Reads a credential's enrollment date. Unlike flow deadlines, this is display\n * metadata, so an unparsable value is dropped instead of rejecting the whole\n * credential list.\n *\n * @param value - The raw `enrolled_at` value, if the server sent one.\n * @returns The epoch milliseconds, or undefined when absent or unparsable.\n */\nfunction parseEnrolledAt(value: string | undefined): number | undefined {\n if (!value) {\n return undefined;\n }\n const enrolledAt = Date.parse(value);\n if (Number.isNaN(enrolledAt)) {\n log.warn(`Ignoring unparsable MFA credential enrolled_at: ${value}`);\n return undefined;\n }\n return enrolledAt;\n}\n\nfunction parseExpiresAt(value: string): number {\n const expiresAt = Date.parse(value);\n if (Number.isNaN(expiresAt)) {\n throw new MfaError('invalid_response', `Invalid expires_at: ${value}`);\n }\n return expiresAt;\n}\n\n/**\n * Parses passkey creation data embedded in an enrollment response.\n *\n * @param value - JSON-encoded creation options.\n * @returns Validated public-key creation options.\n */\nexport function parsePasskeyCreateData(value: string): PasskeyCreationOptions {\n try {\n const parsed: unknown = JSON.parse(value);\n assertValidMfaResponse(parsed, PasskeyCreateDataStruct);\n return parsed.publicKey;\n } catch (error) {\n if (error instanceof MfaError) {\n throw error;\n }\n const message = toErrorMessage(error);\n throw new MfaError('invalid_response', message);\n }\n}\n\n/**\n * Parses passkey request data embedded in a verification response.\n *\n * @param value - JSON-encoded request options.\n * @returns Validated public-key request options.\n */\nexport function parsePasskeyRequestData(value: string): PasskeyRequestOptions {\n try {\n const parsed: unknown = JSON.parse(value);\n assertValidMfaResponse(parsed, PasskeyRequestDataStruct);\n return parsed.publicKey;\n } catch (error) {\n if (error instanceof MfaError) {\n throw error;\n }\n const message = toErrorMessage(error);\n throw new MfaError('invalid_response', message);\n }\n}\n\n/**\n * Reads a `Retry-After` header as a delay. The human-readable error message is\n * deliberately not parsed: the API documents it as unstable.\n *\n * @param response - The throttled response.\n * @returns The delay in milliseconds, or undefined without a usable header.\n */\nfunction parseRetryAfter(response: Response): number | undefined {\n const header = response.headers.get('Retry-After');\n if (!header) {\n return undefined;\n }\n const seconds = Number(header);\n if (Number.isInteger(seconds)) {\n return Math.max(0, seconds * 1000);\n }\n const date = Date.parse(header);\n return Number.isNaN(date) ? undefined : Math.max(0, date - Date.now());\n}\n\n/**\n * Reads and validates the JSON error body of a failed MFA request.\n *\n * When the body parses as JSON but does not match the documented error\n * shape, a `message` field is salvaged if present so callers still get a\n * useful diagnostic instead of a content-free fallback.\n *\n * @param response - The failed response.\n * @returns The validated error body, a best-effort salvage of it, or\n * undefined when the body could not be parsed as JSON at all.\n */\ntype MfaErrorBody = {\n code?: string;\n message: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n retry_after_seconds?: number;\n};\n\n/**\n * Prefers the documented `retry_after_seconds` error field over the\n * `Retry-After` header.\n *\n * @param body - The parsed error body, if any.\n * @param response - The throttled response.\n * @returns The delay in milliseconds, or undefined when neither is usable.\n */\nfunction resolveRetryAfterMs(\n body: MfaErrorBody | undefined,\n response: Response,\n): number | undefined {\n return body?.retry_after_seconds === undefined\n ? parseRetryAfter(response)\n : body.retry_after_seconds * 1000;\n}\n\nasync function readErrorBody(\n response: Response,\n): Promise<MfaErrorBody | undefined> {\n let body: unknown;\n try {\n body = await response.json();\n } catch {\n return undefined;\n }\n\n try {\n assertValidMfaResponse(body, MfaErrorResponseStruct);\n return body;\n } catch {\n const message = asRecord(body)?.message;\n return typeof message === 'string' ? { message } : undefined;\n }\n}\n\nasync function throwMfaError(\n response: Response,\n errorPrefix: string,\n): Promise<never> {\n const { status } = response;\n const body = await readErrorBody(response);\n const message = `${errorPrefix}: ${body?.message ?? `HTTP ${status}`}`;\n\n // Status-only classification first: gateways and load balancers answer\n // 401/429/502 without the service's JSON body, and the caller still needs\n // to invalidate its session, honour Retry-After, or back off.\n if (status === HTTP_STATUS_CODES.UNAUTHORIZED) {\n throw new MfaError('authentication_required', message, { status });\n }\n\n const code = body?.code;\n switch (code) {\n case 'credential_already_enrolled':\n case 'email_already_enrolled':\n case 'email_socially_verified':\n throw new CredentialAlreadyEnrolledError(code, message, status);\n case 'credential_not_enrolled':\n throw new CredentialNotEnrolledError(message, status);\n case 'aal2_required':\n throw new StepUpRequiredError(message, status);\n case 'flow_expired':\n case 'invalid_flow':\n throw new MfaFlowExpiredError(code, message, status);\n case 'mfa_identity_missing':\n throw new MfaIdentityMissingError(message, status);\n case 'invalid_code':\n case 'invalid_attestation':\n case 'invalid_assertion':\n throw new MfaVerificationFailedError(code, message, status);\n case 'too_many_attempts':\n throw new TooManyAttemptsError(message, status);\n case 'max_passkeys_reached':\n throw new MaxPasskeysReachedError(message, status);\n case 'max_identifiers_reached':\n throw new MaxIdentifiersReachedError(message, status);\n case 'otp_resend_cooldown':\n throw new OtpResendCooldownError(\n message,\n resolveRetryAfterMs(body, response),\n status,\n );\n case 'kratos_unavailable':\n throw new MfaUnavailableError(message, status);\n default:\n break;\n }\n\n if (status === HTTP_STATUS_CODES.TOO_MANY_REQUESTS) {\n throw new MfaRateLimitedError(\n message,\n resolveRetryAfterMs(body, response),\n status,\n );\n }\n if (status === HTTP_STATUS_CODES.BAD_GATEWAY) {\n throw new MfaUnavailableError(message, status);\n }\n if (!body) {\n throw new MfaError(\n 'invalid_response',\n `${errorPrefix}: Unexpected error response (HTTP ${status})`,\n { status },\n );\n }\n throw new MfaError(code ?? 'server_error', message, { status });\n}\n\nasync function requestJson(\n url: string,\n accessToken: string,\n init?: { method?: 'GET' | 'POST'; body?: Json },\n): Promise<Json> {\n let response: Response;\n try {\n response = await fetch(url, {\n method: init?.method ?? 'GET',\n headers: {\n Authorization: `Bearer ${accessToken}`,\n ...(init?.body === undefined\n ? {}\n : { 'Content-Type': 'application/json' }),\n },\n ...(init?.body === undefined ? {} : { body: JSON.stringify(init.body) }),\n });\n } catch (error) {\n const message = toErrorMessage(error);\n throw new MfaUnavailableError(`MFA request failed: ${message}`);\n }\n\n if (!response.ok) {\n return await throwMfaError(response, 'MFA request failed');\n }\n\n try {\n return await response.json();\n } catch (error) {\n const message = toErrorMessage(error);\n throw new MfaError('invalid_response', message, {\n status: response.status,\n });\n }\n}\n\n/**\n * Begins enrollment of an MFA credential.\n *\n * @param env - Authentication environment.\n * @param accessToken - Primary profile access token.\n * @param body - Enrollment request.\n * @returns Validated enrollment flow data.\n */\nexport async function mfaEnroll(\n env: Env,\n accessToken: string,\n body: MfaEnrollRequest,\n): Promise<EnrollmentServiceResult> {\n const json = await requestJson(MFA_ENROLL_URL(env), accessToken, {\n method: 'POST',\n body,\n });\n assertValidMfaResponse(json, MfaEnrollResponseStruct);\n\n return {\n flowId: json.flow_id,\n expiresAt: parseExpiresAt(json.expires_at),\n ...(json.passkey_create_data\n ? { publicKey: parsePasskeyCreateData(json.passkey_create_data) }\n : {}),\n };\n}\n\n/**\n * Completes enrollment of an MFA credential.\n *\n * @param env - Authentication environment.\n * @param accessToken - Primary profile access token.\n * @param params - Flow identifier and enrollment proof.\n */\nexport async function mfaEnrollComplete(\n env: Env,\n accessToken: string,\n params: EnrollmentCompletionParams,\n): Promise<void> {\n let body: MfaEnrollCompleteRequest = {\n credential_type: params.credential_type,\n flow_id: params.flow_id,\n ...(params.otp_code ? { otp_code: params.otp_code } : {}),\n };\n if (params.passkey_attestation) {\n assertValidMfaRequest(\n params.passkey_attestation,\n RegistrationResponseJSONStruct,\n );\n body = {\n ...body,\n passkey_attestation: JSON.stringify(params.passkey_attestation),\n };\n }\n\n const json = await requestJson(MFA_ENROLL_COMPLETE_URL(env), accessToken, {\n method: 'POST',\n body,\n });\n assertValidMfaResponse(json, MfaEnrollCompleteResponseStruct);\n}\n\n/**\n * Begins verification with an enrolled credential.\n *\n * @param env - Authentication environment.\n * @param accessToken - Primary profile access token.\n * @param body - Verification request.\n * @returns Validated verification flow data.\n */\nexport async function mfaVerify(\n env: Env,\n accessToken: string,\n body: MfaVerifyRequest,\n): Promise<VerificationServiceResult> {\n const json = await requestJson(MFA_VERIFY_URL(env), accessToken, {\n method: 'POST',\n body,\n });\n assertValidMfaResponse(json, MfaVerifyResponseStruct);\n\n return {\n flowId: json.flow_id,\n expiresAt: parseExpiresAt(json.expires_at),\n ...(json.passkey_request_data\n ? { publicKey: parsePasskeyRequestData(json.passkey_request_data) }\n : {}),\n };\n}\n\n/**\n * Completes verification with an enrolled credential.\n *\n * @param env - Authentication environment.\n * @param accessToken - Primary profile access token.\n * @param params - Flow identifier and verification proof.\n * @returns The assertion JWT and its lifetime in seconds.\n */\nexport async function mfaVerifyComplete(\n env: Env,\n accessToken: string,\n params: VerificationCompletionParams,\n): Promise<MfaVerificationAssertion> {\n let body: MfaVerifyCompleteRequest = {\n credential_type: params.credential_type,\n flow_id: params.flow_id,\n ...(params.otp_code ? { otp_code: params.otp_code } : {}),\n };\n if (params.passkey_assertion) {\n assertValidMfaRequest(\n params.passkey_assertion,\n AuthenticationResponseJSONStruct,\n );\n body = {\n ...body,\n passkey_assertion: JSON.stringify(params.passkey_assertion),\n };\n }\n\n const json = await requestJson(MFA_VERIFY_COMPLETE_URL(env), accessToken, {\n method: 'POST',\n body,\n });\n assertValidMfaResponse(json, MfaVerifyCompleteResponseStruct);\n return { token: json.token, expiresIn: json.expires_in };\n}\n\nfunction isSupportedStatus(status: string): status is MfaCredentialStatus {\n return status === 'active' || status === 'pending';\n}\n\n/**\n * Maps a server credential to its public controller representation.\n *\n * Unknown credential types or statuses are dropped so the server can extend\n * either without invalidating the whole list.\n *\n * @param credential - Validated server credential.\n * @returns A supported credential, or null when it cannot be represented.\n */\nexport function toEnrolledCredential(\n credential: MfaCredential,\n): EnrolledCredential | null {\n const { credential_type: type, status } = credential;\n if (!isSupportedStatus(status)) {\n log.warn(`Ignoring MFA credential with unsupported status: ${status}`);\n return null;\n }\n\n const enrolledAt = parseEnrolledAt(credential.enrolled_at);\n const base = {\n status,\n ...(enrolledAt === undefined ? {} : { enrolledAt }),\n };\n\n if (type === 'passkey') {\n return {\n type,\n ...base,\n ...(credential.passkey?.display_name\n ? { displayName: credential.passkey.display_name }\n : {}),\n };\n }\n\n if (type === 'email_otp') {\n // The API marks the address optional, so a row without one is kept.\n const address = credential.email?.address;\n return {\n type,\n ...base,\n ...(address === undefined ? {} : { email: address }),\n // The spec marks `verified` optional; an active row is verified.\n verified: credential.email?.verified ?? status === 'active',\n };\n }\n\n log.warn(`Ignoring unsupported or incomplete MFA credential: ${type}`);\n return null;\n}\n\n/**\n * Gets the credentials enrolled on the canonical profile.\n *\n * @param env - Authentication environment.\n * @param accessToken - Primary profile access token.\n * @returns Supported enrolled credentials.\n */\nexport async function getMfaCredentials(\n env: Env,\n accessToken: string,\n): Promise<EnrolledCredential[]> {\n const json = await requestJson(MFA_CREDENTIALS_URL(env), accessToken);\n assertValidMfaResponse(json, MfaCredentialsResponseStruct);\n return json.credentials\n .map(toEnrolledCredential)\n .filter((credential): credential is EnrolledCredential =>\n Boolean(credential),\n );\n}\n"]}
|
|
@@ -44,7 +44,11 @@ export type EnrolledCredential = {
|
|
|
44
44
|
type: 'email_otp';
|
|
45
45
|
status: MfaCredentialStatus;
|
|
46
46
|
enrolledAt?: number;
|
|
47
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Absent when the server lists an email method without its address; the
|
|
49
|
+
* API marks the address optional.
|
|
50
|
+
*/
|
|
51
|
+
email?: string;
|
|
48
52
|
verified: boolean;
|
|
49
53
|
};
|
|
50
54
|
/**
|
|
@@ -71,7 +75,7 @@ export type EnrollmentProof = {
|
|
|
71
75
|
type: 'email_otp';
|
|
72
76
|
code: string;
|
|
73
77
|
};
|
|
74
|
-
export type
|
|
78
|
+
export type VerificationChallenge = {
|
|
75
79
|
type: 'passkey';
|
|
76
80
|
flowId: string;
|
|
77
81
|
expiresAt: number;
|
|
@@ -81,21 +85,24 @@ export type StepUpChallenge = {
|
|
|
81
85
|
flowId: string;
|
|
82
86
|
expiresAt: number;
|
|
83
87
|
};
|
|
84
|
-
export type
|
|
88
|
+
export type VerificationProof = {
|
|
85
89
|
type: 'passkey';
|
|
86
90
|
assertion: AuthenticationResponseJSON;
|
|
87
91
|
} | {
|
|
88
92
|
type: 'email_otp';
|
|
89
93
|
code: string;
|
|
90
94
|
};
|
|
91
|
-
export type
|
|
95
|
+
export type VerificationToken = {
|
|
92
96
|
accessToken: string;
|
|
93
97
|
expiresIn: number;
|
|
94
98
|
obtainedAt: number;
|
|
95
99
|
claims: {
|
|
96
100
|
sub: string;
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Methods the verification used. Usually an `MfaCredentialType`, but the
|
|
103
|
+
* server may report other method names.
|
|
104
|
+
*/
|
|
105
|
+
amr: (MfaCredentialType | (string & Record<never, never>))[];
|
|
99
106
|
exp: number;
|
|
100
107
|
};
|
|
101
108
|
};
|
|
@@ -103,23 +110,30 @@ export type BeginEnrollmentRequest = {
|
|
|
103
110
|
type: MfaCredentialType;
|
|
104
111
|
email?: string;
|
|
105
112
|
reason: TokenReason;
|
|
113
|
+
/**
|
|
114
|
+
* Maximum age, in milliseconds, of a verification session that may authorize
|
|
115
|
+
* this enrollment. Defaults to `ENROLLMENT_MAX_SESSION_AGE_MS`. A setup flow
|
|
116
|
+
* that proved a factor itself may pass the time elapsed since it started.
|
|
117
|
+
* Zero never uses the session.
|
|
118
|
+
*/
|
|
119
|
+
maxSessionAgeMs?: number;
|
|
106
120
|
};
|
|
107
121
|
export type CompleteEnrollmentRequest = {
|
|
108
122
|
flowId: string;
|
|
109
123
|
proof: EnrollmentProof;
|
|
110
124
|
reason: TokenReason;
|
|
111
125
|
};
|
|
112
|
-
export type
|
|
126
|
+
export type BeginVerificationRequest = {
|
|
113
127
|
type: MfaCredentialType;
|
|
114
128
|
reason: TokenReason;
|
|
115
129
|
};
|
|
116
|
-
export type
|
|
130
|
+
export type CompleteVerificationRequest = {
|
|
117
131
|
flowId: string;
|
|
118
|
-
proof:
|
|
132
|
+
proof: VerificationProof;
|
|
119
133
|
reason: TokenReason;
|
|
120
134
|
};
|
|
121
|
-
export type
|
|
135
|
+
export type GetVerificationTokenRequest = {
|
|
122
136
|
maxSessionAgeMs?: number;
|
|
123
137
|
};
|
|
124
|
-
export type MfaErrorCode = 'max_passkeys_reached' | 'max_identifiers_reached' | 'email_already_enrolled' | 'credential_already_enrolled' | 'credential_not_enrolled' | 'email_socially_verified' | 'mfa_identity_missing' | 'multi_primary_srp' | 'aal2_required' | 'otp_resend_cooldown' | 'rate_limited' | 'kratos_unavailable' | 'flow_expired' | 'invalid_flow' | 'invalid_attestation' | 'invalid_code' | 'invalid_assertion' | 'too_many_attempts' | '
|
|
138
|
+
export type MfaErrorCode = 'max_passkeys_reached' | 'max_identifiers_reached' | 'email_already_enrolled' | 'credential_already_enrolled' | 'credential_not_enrolled' | 'email_socially_verified' | 'mfa_identity_missing' | 'multi_primary_srp' | 'aal2_required' | 'otp_resend_cooldown' | 'rate_limited' | 'kratos_unavailable' | 'flow_expired' | 'invalid_flow' | 'invalid_attestation' | 'invalid_code' | 'invalid_assertion' | 'too_many_attempts' | 'verification_token_invalid' | 'authentication_required' | 'server_error' | 'invalid_response' | 'invalid_request';
|
|
125
139
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/mfa/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EACV,gCAAgC,EAChC,mBAAmB,EACnB,4BAA4B,EAC5B,oBAAoB,EACpB,+BAA+B,EAC/B,uBAAuB,EACvB,sBAAsB,EACtB,+BAA+B,EAC/B,uBAAuB,EACvB,4CAA4C,EAC5C,2CAA2C,EAC3C,8BAA8B,EAC/B,MAAM,cA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B,GAAG;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB,sBAAsB,GACtB,yBAAyB,GACzB,wBAAwB,GACxB,6BAA6B,GAC7B,yBAAyB,GACzB,yBAAyB,GACzB,sBAAsB,GACtB,mBAAmB,GACnB,eAAe,GACf,qBAAqB,GACrB,cAAc,GACd,oBAAoB,GACpB,cAAc,GACd,cAAc,GACd,qBAAqB,GACrB,cAAc,GACd,mBAAmB,GACnB,mBAAmB,GACnB,4BAA4B,GAC5B,yBAAyB,GACzB,cAAc,GACd,kBAAkB,GAClB,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/mfa/types.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\n\nimport type {\n AuthenticationResponseJSONStruct,\n MfaCredentialStruct,\n MfaCredentialsResponseStruct,\n MfaEmailDetailStruct,\n MfaEnrollCompleteResponseStruct,\n MfaEnrollResponseStruct,\n MfaPasskeyDetailStruct,\n MfaVerifyCompleteResponseStruct,\n MfaVerifyResponseStruct,\n PublicKeyCredentialCreationOptionsJSONStruct,\n PublicKeyCredentialRequestOptionsJSONStruct,\n RegistrationResponseJSONStruct,\n} from './schemas.js';\nimport { MFA_CREDENTIAL_TYPES } from './schemas.js';\n\nexport { MFA_CREDENTIAL_TYPES };\n\nexport type MfaCredentialType = (typeof MFA_CREDENTIAL_TYPES)[number];\n\nexport type MfaCredentialStatus = 'active' | 'pending';\n\nexport type PublicKeyCredentialCreationOptionsJSON = Infer<\n typeof PublicKeyCredentialCreationOptionsJSONStruct\n>;\n\nexport type PublicKeyCredentialRequestOptionsJSON = Infer<\n typeof PublicKeyCredentialRequestOptionsJSONStruct\n>;\n\nexport type RegistrationResponseJSON = Infer<\n typeof RegistrationResponseJSONStruct\n>;\n\nexport type AuthenticationResponseJSON = Infer<\n typeof AuthenticationResponseJSONStruct\n>;\n\nexport type MfaEnrollResponse = Infer<typeof MfaEnrollResponseStruct>;\n\nexport type MfaEnrollCompleteResponse = Infer<\n typeof MfaEnrollCompleteResponseStruct\n>;\n\nexport type MfaVerifyResponse = Infer<typeof MfaVerifyResponseStruct>;\n\nexport type MfaVerifyCompleteResponse = Infer<\n typeof MfaVerifyCompleteResponseStruct\n>;\n\nexport type MfaCredentialsResponse = Infer<typeof MfaCredentialsResponseStruct>;\n\nexport type MfaCredential = Infer<typeof MfaCredentialStruct>;\n\nexport type MfaPasskeyDetail = Infer<typeof MfaPasskeyDetailStruct>;\n\nexport type MfaEmailDetail = Infer<typeof MfaEmailDetailStruct>;\n\nexport type MfaEnrollRequest = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n credential_type: MfaCredentialType;\n identifier?: string;\n};\n\nexport type MfaEnrollCompleteRequest = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n credential_type: MfaCredentialType;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n flow_id: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n otp_code?: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n passkey_attestation?: string;\n};\n\nexport type MfaVerifyRequest = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n credential_type: MfaCredentialType;\n};\n\nexport type MfaVerifyCompleteRequest = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n credential_type: MfaCredentialType;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n flow_id: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n passkey_assertion?: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n otp_code?: string;\n};\n\nexport type EnrolledCredential =\n | {\n type: 'passkey';\n status: MfaCredentialStatus;\n enrolledAt?: number;\n displayName?: string;\n }\n | {\n type: 'email_otp';\n status: MfaCredentialStatus;\n enrolledAt?: number;\n email
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/mfa/types.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\n\nimport type {\n AuthenticationResponseJSONStruct,\n MfaCredentialStruct,\n MfaCredentialsResponseStruct,\n MfaEmailDetailStruct,\n MfaEnrollCompleteResponseStruct,\n MfaEnrollResponseStruct,\n MfaPasskeyDetailStruct,\n MfaVerifyCompleteResponseStruct,\n MfaVerifyResponseStruct,\n PublicKeyCredentialCreationOptionsJSONStruct,\n PublicKeyCredentialRequestOptionsJSONStruct,\n RegistrationResponseJSONStruct,\n} from './schemas.js';\nimport { MFA_CREDENTIAL_TYPES } from './schemas.js';\n\nexport { MFA_CREDENTIAL_TYPES };\n\nexport type MfaCredentialType = (typeof MFA_CREDENTIAL_TYPES)[number];\n\nexport type MfaCredentialStatus = 'active' | 'pending';\n\nexport type PublicKeyCredentialCreationOptionsJSON = Infer<\n typeof PublicKeyCredentialCreationOptionsJSONStruct\n>;\n\nexport type PublicKeyCredentialRequestOptionsJSON = Infer<\n typeof PublicKeyCredentialRequestOptionsJSONStruct\n>;\n\nexport type RegistrationResponseJSON = Infer<\n typeof RegistrationResponseJSONStruct\n>;\n\nexport type AuthenticationResponseJSON = Infer<\n typeof AuthenticationResponseJSONStruct\n>;\n\nexport type MfaEnrollResponse = Infer<typeof MfaEnrollResponseStruct>;\n\nexport type MfaEnrollCompleteResponse = Infer<\n typeof MfaEnrollCompleteResponseStruct\n>;\n\nexport type MfaVerifyResponse = Infer<typeof MfaVerifyResponseStruct>;\n\nexport type MfaVerifyCompleteResponse = Infer<\n typeof MfaVerifyCompleteResponseStruct\n>;\n\nexport type MfaCredentialsResponse = Infer<typeof MfaCredentialsResponseStruct>;\n\nexport type MfaCredential = Infer<typeof MfaCredentialStruct>;\n\nexport type MfaPasskeyDetail = Infer<typeof MfaPasskeyDetailStruct>;\n\nexport type MfaEmailDetail = Infer<typeof MfaEmailDetailStruct>;\n\nexport type MfaEnrollRequest = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n credential_type: MfaCredentialType;\n identifier?: string;\n};\n\nexport type MfaEnrollCompleteRequest = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n credential_type: MfaCredentialType;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n flow_id: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n otp_code?: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n passkey_attestation?: string;\n};\n\nexport type MfaVerifyRequest = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n credential_type: MfaCredentialType;\n};\n\nexport type MfaVerifyCompleteRequest = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n credential_type: MfaCredentialType;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n flow_id: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n passkey_assertion?: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n otp_code?: string;\n};\n\nexport type EnrolledCredential =\n | {\n type: 'passkey';\n status: MfaCredentialStatus;\n enrolledAt?: number;\n displayName?: string;\n }\n | {\n type: 'email_otp';\n status: MfaCredentialStatus;\n enrolledAt?: number;\n /**\n * Absent when the server lists an email method without its address; the\n * API marks the address optional.\n */\n email?: string;\n verified: boolean;\n };\n\n/**\n * Caller-supplied context attached to MFA trace spans. `operation` names the\n * client flow that needs the credential (for example `money.signTransaction`).\n */\nexport type TokenReason = {\n operation: string;\n};\n\nexport type EnrollmentChallenge =\n | {\n type: 'passkey';\n flowId: string;\n expiresAt: number;\n publicKey: PublicKeyCredentialCreationOptionsJSON;\n }\n | {\n type: 'email_otp';\n flowId: string;\n expiresAt: number;\n };\n\nexport type EnrollmentProof =\n | {\n type: 'passkey';\n attestation: RegistrationResponseJSON;\n }\n | {\n type: 'email_otp';\n code: string;\n };\n\nexport type VerificationChallenge =\n | {\n type: 'passkey';\n flowId: string;\n expiresAt: number;\n publicKey: PublicKeyCredentialRequestOptionsJSON;\n }\n | {\n type: 'email_otp';\n flowId: string;\n expiresAt: number;\n };\n\nexport type VerificationProof =\n | {\n type: 'passkey';\n assertion: AuthenticationResponseJSON;\n }\n | {\n type: 'email_otp';\n code: string;\n };\n\nexport type VerificationToken = {\n accessToken: string;\n expiresIn: number;\n obtainedAt: number;\n claims: {\n sub: string;\n /**\n * Methods the verification used. Usually an `MfaCredentialType`, but the\n * server may report other method names.\n */\n amr: (MfaCredentialType | (string & Record<never, never>))[];\n exp: number;\n };\n};\n\nexport type BeginEnrollmentRequest = {\n type: MfaCredentialType;\n email?: string;\n reason: TokenReason;\n /**\n * Maximum age, in milliseconds, of a verification session that may authorize\n * this enrollment. Defaults to `ENROLLMENT_MAX_SESSION_AGE_MS`. A setup flow\n * that proved a factor itself may pass the time elapsed since it started.\n * Zero never uses the session.\n */\n maxSessionAgeMs?: number;\n};\n\nexport type CompleteEnrollmentRequest = {\n flowId: string;\n proof: EnrollmentProof;\n reason: TokenReason;\n};\n\nexport type BeginVerificationRequest = {\n type: MfaCredentialType;\n reason: TokenReason;\n};\n\nexport type CompleteVerificationRequest = {\n flowId: string;\n proof: VerificationProof;\n reason: TokenReason;\n};\n\nexport type GetVerificationTokenRequest = {\n maxSessionAgeMs?: number;\n};\n\nexport type MfaErrorCode =\n | 'max_passkeys_reached'\n | 'max_identifiers_reached'\n | 'email_already_enrolled'\n | 'credential_already_enrolled'\n | 'credential_not_enrolled'\n | 'email_socially_verified'\n | 'mfa_identity_missing'\n | 'multi_primary_srp'\n | 'aal2_required'\n | 'otp_resend_cooldown'\n | 'rate_limited'\n | 'kratos_unavailable'\n | 'flow_expired'\n | 'invalid_flow'\n | 'invalid_attestation'\n | 'invalid_code'\n | 'invalid_assertion'\n | 'too_many_attempts'\n | 'verification_token_invalid'\n | 'authentication_required'\n | 'server_error'\n | 'invalid_response'\n | 'invalid_request';\n"]}
|
|
@@ -2,8 +2,8 @@ import type { PublicInterface } from '@metamask/utils';
|
|
|
2
2
|
import type { Eip1193Provider } from 'ethers';
|
|
3
3
|
import { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe.js';
|
|
4
4
|
import { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp.js';
|
|
5
|
-
import type {
|
|
6
|
-
import type { EnrolledCredential, EnrollmentChallenge, EnrollmentProof, MfaCredentialType,
|
|
5
|
+
import type { MfaVerificationAssertion } from './authentication-jwt-bearer/mfa/services.js';
|
|
6
|
+
import type { EnrolledCredential, EnrollmentChallenge, EnrollmentProof, MfaCredentialType, VerificationChallenge, VerificationProof } from './authentication-jwt-bearer/mfa/types.js';
|
|
7
7
|
import type { PairProfilesResponse } from './authentication-jwt-bearer/services.js';
|
|
8
8
|
import type { AccessToken, UserProfile, Pair, PairSocialIdentifierParams, ProfileIdentifier, OidcTokenAudience, OidcTokenClaims, UserProfileLineage } from './authentication-jwt-bearer/types.js';
|
|
9
9
|
type SIWEInterface = PublicInterface<SIWEJwtBearerAuth>;
|
|
@@ -29,8 +29,8 @@ export declare class JwtBearerAuth implements SIWEInterface, SRPInterface {
|
|
|
29
29
|
accessToken?: string;
|
|
30
30
|
}): Promise<EnrollmentChallenge>;
|
|
31
31
|
completeMfaEnrollment(flowId: string, proof: EnrollmentProof, entropySourceId?: string): Promise<void>;
|
|
32
|
-
beginMfaVerification(type: MfaCredentialType, entropySourceId?: string): Promise<
|
|
33
|
-
completeMfaVerification(flowId: string, proof:
|
|
32
|
+
beginMfaVerification(type: MfaCredentialType, entropySourceId?: string): Promise<VerificationChallenge>;
|
|
33
|
+
completeMfaVerification(flowId: string, proof: VerificationProof, entropySourceId?: string): Promise<MfaVerificationAssertion>;
|
|
34
34
|
getMfaCredentials(entropySourceId?: string): Promise<EnrolledCredential[]>;
|
|
35
35
|
exchangeMfaAssertion(assertionJwt: string): Promise<AccessToken>;
|
|
36
36
|
pairSrpProfiles(accessTokens: string[], authAccessToken: string): Promise<PairProfilesResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAG9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAG9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,0CAA0C,CAAC;AAKlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,IAAI,EACJ,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EACj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,UAAU,CACR,IAAc,EACd,IAA0C;QAE1C,IAAI,IAAI,KAAK,QAAQ,CAAC,GAAG,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,MAAM,IAAI,wBAAwB,CAChC,iDAAiD,CAClD,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,cAAc,sCAAsC,CAAC","sourcesContent":["import type { PublicInterface } from '@metamask/utils';\nimport type { Eip1193Provider } from 'ethers';\n\nimport type { Env } from '../shared/env.js';\nimport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe.js';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp.js';\nimport type { MfaStepUpAssertion } from './authentication-jwt-bearer/mfa/services.js';\nimport type {\n EnrolledCredential,\n EnrollmentChallenge,\n EnrollmentProof,\n MfaCredentialType,\n StepUpChallenge,\n StepUpProof,\n} from './authentication-jwt-bearer/mfa/types.js';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services.js';\nimport type { PairProfilesResponse } from './authentication-jwt-bearer/services.js';\nimport type {\n AccessToken,\n UserProfile,\n Pair,\n PairSocialIdentifierParams,\n ProfileIdentifier,\n OidcTokenAudience,\n OidcTokenClaims,\n UserProfileLineage,\n} from './authentication-jwt-bearer/types.js';\nimport { AuthType } from './authentication-jwt-bearer/types.js';\nimport { PairError, UnsupportedAuthTypeError } from './errors.js';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n\ntype SIWEInterface = PublicInterface<SIWEJwtBearerAuth>;\nexport type SRPInterface = PublicInterface<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n readonly #type: AuthType;\n\n readonly #env: Env;\n\n readonly #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n setCustomProvider(provider: Eip1193Provider) {\n this.#assertSRP(this.#type, this.#sdk);\n this.#sdk.setCustomProvider(provider);\n }\n\n async getAccessToken(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getAccessToken(entropySourceId);\n }\n\n async connectSnap(): Promise<string> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.connectSnap();\n }\n\n async isSnapConnected(): Promise<boolean> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.isSnapConnected();\n }\n\n async getUserProfile(entropySourceId?: string): Promise<UserProfile> {\n return await this.#sdk.getUserProfile(entropySourceId);\n }\n\n async getIdentifier(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getIdentifier(entropySourceId);\n }\n\n async getUserProfileLineage(\n entropySourceId?: string,\n ): Promise<UserProfileLineage> {\n return await this.#sdk.getUserProfileLineage(entropySourceId);\n }\n\n async getCustomerServiceToken(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getCustomerServiceToken(entropySourceId);\n }\n\n async getPartnerIdentityToken(\n claims: OidcTokenClaims,\n audience: OidcTokenAudience,\n entropySourceId?: string,\n ): Promise<string> {\n return await this.#sdk.getPartnerIdentityToken(\n claims,\n audience,\n entropySourceId,\n );\n }\n\n async beginMfaEnrollment(\n type: MfaCredentialType,\n options?: {\n email?: string;\n entropySourceId?: string;\n accessToken?: string;\n },\n ): Promise<EnrollmentChallenge> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.beginMfaEnrollment(type, options);\n }\n\n async completeMfaEnrollment(\n flowId: string,\n proof: EnrollmentProof,\n entropySourceId?: string,\n ): Promise<void> {\n this.#assertSRP(this.#type, this.#sdk);\n await this.#sdk.completeMfaEnrollment(flowId, proof, entropySourceId);\n }\n\n async beginMfaVerification(\n type: MfaCredentialType,\n entropySourceId?: string,\n ): Promise<StepUpChallenge> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.beginMfaVerification(type, entropySourceId);\n }\n\n async completeMfaVerification(\n flowId: string,\n proof: StepUpProof,\n entropySourceId?: string,\n ): Promise<MfaStepUpAssertion> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.completeMfaVerification(\n flowId,\n proof,\n entropySourceId,\n );\n }\n\n async getMfaCredentials(\n entropySourceId?: string,\n ): Promise<EnrolledCredential[]> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.getMfaCredentials(entropySourceId);\n }\n\n async exchangeMfaAssertion(assertionJwt: string): Promise<AccessToken> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.exchangeMfaAssertion(assertionJwt);\n }\n\n async pairSrpProfiles(\n accessTokens: string[],\n authAccessToken: string,\n ): Promise<PairProfilesResponse> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.pairSrpProfiles(accessTokens, authAccessToken);\n }\n\n async pairSocialIdentifier(\n params: PairSocialIdentifierParams,\n authAccessToken: string,\n ): Promise<ProfileIdentifier[] | undefined> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.pairSocialIdentifier(params, authAccessToken);\n }\n\n async signMessage(\n message: string,\n entropySourceId?: string,\n ): Promise<string> {\n return await this.#sdk.signMessage(message, entropySourceId);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n raw_message: raw,\n encrypted_storage_key: p.encryptedStorageKey,\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n\n #assertSRP(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SRPJwtBearerAuth {\n if (type === AuthType.SRP) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SRP auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe.js';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp.js';\nexport * from './authentication-jwt-bearer/types.js';\n"]}
|
|
1
|
+
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAU3E,OAAO,EACL,QAAQ,EACR,eAAe,GAChB,MAAM,yCAAyC,CAAC;AAYjD,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,SA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AAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC3D,MAAM,IAAI,SAAS,CACjB,mCAAmC,YAAY,EAAE,CAClD,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CACH,CAAC;QAEF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAChD,MAAM,eAAe,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,CAAC,MAKP;QACC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,WAAW,CACT,IAAc,EACd,IAA0C;QAE1C,IAAI,IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC3B,OAAO;QACT,CAAC;QAED,MAAM,IAAI,wBAAwB,CAChC,kDAAkD,CACnD,CAAC;IACJ,CAAC;IAED,UAAU,CACR,IAAc,EACd,IAA0C;QAE1C,IAAI,IAAI,KAAK,QAAQ,CAAC,GAAG,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,MAAM,IAAI,wBAAwB,CAChC,iDAAiD,CAClD,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,cAAc,sCAAsC,CAAC","sourcesContent":["import type { PublicInterface } from '@metamask/utils';\nimport type { Eip1193Provider } from 'ethers';\n\nimport type { Env } from '../shared/env.js';\nimport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe.js';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp.js';\nimport type { MfaVerificationAssertion } from './authentication-jwt-bearer/mfa/services.js';\nimport type {\n EnrolledCredential,\n EnrollmentChallenge,\n EnrollmentProof,\n MfaCredentialType,\n VerificationChallenge,\n VerificationProof,\n} from './authentication-jwt-bearer/mfa/types.js';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services.js';\nimport type { PairProfilesResponse } from './authentication-jwt-bearer/services.js';\nimport type {\n AccessToken,\n UserProfile,\n Pair,\n PairSocialIdentifierParams,\n ProfileIdentifier,\n OidcTokenAudience,\n OidcTokenClaims,\n UserProfileLineage,\n} from './authentication-jwt-bearer/types.js';\nimport { AuthType } from './authentication-jwt-bearer/types.js';\nimport { PairError, UnsupportedAuthTypeError } from './errors.js';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n\ntype SIWEInterface = PublicInterface<SIWEJwtBearerAuth>;\nexport type SRPInterface = PublicInterface<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n readonly #type: AuthType;\n\n readonly #env: Env;\n\n readonly #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n setCustomProvider(provider: Eip1193Provider) {\n this.#assertSRP(this.#type, this.#sdk);\n this.#sdk.setCustomProvider(provider);\n }\n\n async getAccessToken(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getAccessToken(entropySourceId);\n }\n\n async connectSnap(): Promise<string> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.connectSnap();\n }\n\n async isSnapConnected(): Promise<boolean> {\n this.#assertSRP(this.#type, this.#sdk);\n return this.#sdk.isSnapConnected();\n }\n\n async getUserProfile(entropySourceId?: string): Promise<UserProfile> {\n return await this.#sdk.getUserProfile(entropySourceId);\n }\n\n async getIdentifier(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getIdentifier(entropySourceId);\n }\n\n async getUserProfileLineage(\n entropySourceId?: string,\n ): Promise<UserProfileLineage> {\n return await this.#sdk.getUserProfileLineage(entropySourceId);\n }\n\n async getCustomerServiceToken(entropySourceId?: string): Promise<string> {\n return await this.#sdk.getCustomerServiceToken(entropySourceId);\n }\n\n async getPartnerIdentityToken(\n claims: OidcTokenClaims,\n audience: OidcTokenAudience,\n entropySourceId?: string,\n ): Promise<string> {\n return await this.#sdk.getPartnerIdentityToken(\n claims,\n audience,\n entropySourceId,\n );\n }\n\n async beginMfaEnrollment(\n type: MfaCredentialType,\n options?: {\n email?: string;\n entropySourceId?: string;\n accessToken?: string;\n },\n ): Promise<EnrollmentChallenge> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.beginMfaEnrollment(type, options);\n }\n\n async completeMfaEnrollment(\n flowId: string,\n proof: EnrollmentProof,\n entropySourceId?: string,\n ): Promise<void> {\n this.#assertSRP(this.#type, this.#sdk);\n await this.#sdk.completeMfaEnrollment(flowId, proof, entropySourceId);\n }\n\n async beginMfaVerification(\n type: MfaCredentialType,\n entropySourceId?: string,\n ): Promise<VerificationChallenge> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.beginMfaVerification(type, entropySourceId);\n }\n\n async completeMfaVerification(\n flowId: string,\n proof: VerificationProof,\n entropySourceId?: string,\n ): Promise<MfaVerificationAssertion> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.completeMfaVerification(\n flowId,\n proof,\n entropySourceId,\n );\n }\n\n async getMfaCredentials(\n entropySourceId?: string,\n ): Promise<EnrolledCredential[]> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.getMfaCredentials(entropySourceId);\n }\n\n async exchangeMfaAssertion(assertionJwt: string): Promise<AccessToken> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.exchangeMfaAssertion(assertionJwt);\n }\n\n async pairSrpProfiles(\n accessTokens: string[],\n authAccessToken: string,\n ): Promise<PairProfilesResponse> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.pairSrpProfiles(accessTokens, authAccessToken);\n }\n\n async pairSocialIdentifier(\n params: PairSocialIdentifierParams,\n authAccessToken: string,\n ): Promise<ProfileIdentifier[] | undefined> {\n this.#assertSRP(this.#type, this.#sdk);\n return await this.#sdk.pairSocialIdentifier(params, authAccessToken);\n }\n\n async signMessage(\n message: string,\n entropySourceId?: string,\n ): Promise<string> {\n return await this.#sdk.signMessage(message, entropySourceId);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n raw_message: raw,\n encrypted_storage_key: p.encryptedStorageKey,\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n\n #assertSRP(\n type: AuthType,\n _sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts _sdk is SRPJwtBearerAuth {\n if (type === AuthType.SRP) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SRP auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe.js';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp.js';\nexport * from './authentication-jwt-bearer/types.js';\n"]}
|
package/dist/sdk/errors.d.ts
CHANGED
|
@@ -26,9 +26,9 @@ export declare class CredentialAlreadyEnrolledError extends MfaError {
|
|
|
26
26
|
constructor(code: 'credential_already_enrolled' | 'email_already_enrolled' | 'email_socially_verified', message: string, status?: number);
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* The profile already has
|
|
30
|
-
* `aal:2` access token; the client must complete a
|
|
31
|
-
* same flow.
|
|
29
|
+
* The profile already has a credential that proves AAL2, so enrolling another
|
|
30
|
+
* requires an `aal:2` access token; the client must complete a verification
|
|
31
|
+
* and retry with the same flow.
|
|
32
32
|
*/
|
|
33
33
|
export declare class StepUpRequiredError extends MfaError {
|
|
34
34
|
constructor(message: string, status?: number);
|
|
@@ -78,7 +78,7 @@ export declare class MfaRateLimitedError extends MfaError {
|
|
|
78
78
|
export declare class MfaUnavailableError extends MfaError {
|
|
79
79
|
constructor(message: string, status?: number);
|
|
80
80
|
}
|
|
81
|
-
export declare class
|
|
81
|
+
export declare class VerificationTokenInvalidError extends MfaError {
|
|
82
82
|
constructor(message: string);
|
|
83
83
|
}
|
|
84
84
|
/**
|
package/dist/sdk/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/sdk/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY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AE,MAAM,EAG1B;CACF;AAED,qBAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,MAAM,SAAuC;IAEtD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B,YAAY,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAIjD;IAED;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,gBAAgB,CAQzD;CACF"}
|
package/dist/sdk/errors.js
CHANGED
|
@@ -32,9 +32,9 @@ export class CredentialAlreadyEnrolledError extends MfaError {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* The profile already has
|
|
36
|
-
* `aal:2` access token; the client must complete a
|
|
37
|
-
* same flow.
|
|
35
|
+
* The profile already has a credential that proves AAL2, so enrolling another
|
|
36
|
+
* requires an `aal:2` access token; the client must complete a verification
|
|
37
|
+
* and retry with the same flow.
|
|
38
38
|
*/
|
|
39
39
|
export class StepUpRequiredError extends MfaError {
|
|
40
40
|
constructor(message, status = HTTP_STATUS_CODES.FORBIDDEN) {
|
|
@@ -117,10 +117,10 @@ export class MfaUnavailableError extends MfaError {
|
|
|
117
117
|
this.name = 'MfaUnavailableError';
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
export class
|
|
120
|
+
export class VerificationTokenInvalidError extends MfaError {
|
|
121
121
|
constructor(message) {
|
|
122
|
-
super('
|
|
123
|
-
this.name = '
|
|
122
|
+
super('verification_token_invalid', message);
|
|
123
|
+
this.name = 'VerificationTokenInvalidError';
|
|
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esContent":["import type { MfaErrorCode } from './authentication-jwt-bearer/mfa/types.js';\nimport { HTTP_STATUS_CODES } from './constants.js';\nimport { asRecord } from './utils/as-record.js';\n\ntype ExtensibleMfaErrorCode = MfaErrorCode | (string & {});\n\n/**\n * Base error for MFA operations.\n *\n * The machine-readable code is an enumerable own property so it survives\n * JSON-RPC error serialization.\n */\nexport class MfaError extends Error {\n readonly mfaCode: ExtensibleMfaErrorCode;\n\n readonly status?: number;\n\n readonly retryAfterMs?: number;\n\n constructor(\n mfaCode: ExtensibleMfaErrorCode,\n message: string,\n options?: { status?: number; retryAfterMs?: number },\n ) {\n super(`MFA[${mfaCode}]: ${message}`);\n this.name = 'MfaError';\n this.mfaCode = mfaCode;\n this.status = options?.status;\n this.retryAfterMs = options?.retryAfterMs;\n }\n}\n\n/**\n * The credential cannot be enrolled because an equivalent one already exists:\n * `email_already_enrolled` (this profile already has a verified email),\n * `email_socially_verified` (the email is verified through a social login), or\n * `credential_already_enrolled` (the email or passkey is enrolled on another\n * profile; the profiles must be paired or the credential removed).\n */\nexport class CredentialAlreadyEnrolledError extends MfaError {\n constructor(\n code:\n | 'credential_already_enrolled'\n | 'email_already_enrolled'\n | 'email_socially_verified',\n message: string,\n status = HTTP_STATUS_CODES.CONFLICT,\n ) {\n super(code, message, { status });\n this.name = 'CredentialAlreadyEnrolledError';\n }\n}\n\n/**\n * The profile already has MFA credentials, so enrolling another requires an\n * `aal:2` access token; the client must complete a step-up and retry with the\n * same flow.\n */\nexport class StepUpRequiredError extends MfaError {\n constructor(message: string, status = HTTP_STATUS_CODES.FORBIDDEN) {\n super('aal2_required', message, { status });\n this.name = 'StepUpRequiredError';\n }\n}\n\nexport class CredentialNotEnrolledError extends MfaError {\n constructor(message: string, status = HTTP_STATUS_CODES.CONFLICT) {\n super('credential_not_enrolled', message, { status });\n this.name = 'CredentialNotEnrolledError';\n }\n}\n\n/**\n * The begin/complete flow is stale or unknown; the client must restart it.\n */\nexport class MfaFlowExpiredError extends MfaError {\n constructor(\n code: 'flow_expired' | 'invalid_flow',\n message: string,\n status?: number,\n ) {\n super(code, message, { status });\n this.name = 'MfaFlowExpiredError';\n }\n}\n\n/**\n * The profile has no identity-provider record yet. Not a stale flow: the\n * user must enroll a first credential before verifying.\n */\nexport class MfaIdentityMissingError extends MfaError {\n constructor(message: string, status = HTTP_STATUS_CODES.CONFLICT) {\n super('mfa_identity_missing', message, { status });\n this.name = 'MfaIdentityMissingError';\n }\n}\n\nexport class MfaVerificationFailedError extends MfaError {\n constructor(\n code: 'invalid_code' | 'invalid_attestation' | 'invalid_assertion',\n message: string,\n status?: number,\n ) {\n super(code, message, { status });\n this.name = 'MfaVerificationFailedError';\n }\n}\n\nexport class TooManyAttemptsError extends MfaError {\n constructor(message: string, status?: number) {\n super('too_many_attempts', message, { status });\n this.name = 'TooManyAttemptsError';\n }\n}\n\nexport class MaxPasskeysReachedError extends MfaError {\n constructor(\n message: string,\n status = HTTP_STATUS_CODES.UNPROCESSABLE_ENTITY,\n ) {\n super('max_passkeys_reached', message, { status });\n this.name = 'MaxPasskeysReachedError';\n }\n}\n\nexport class MaxIdentifiersReachedError extends MfaError {\n constructor(message: string, status = HTTP_STATUS_CODES.CONFLICT) {\n super('max_identifiers_reached', message, { status });\n this.name = 'MaxIdentifiersReachedError';\n }\n}\n\nexport class OtpResendCooldownError extends MfaError {\n constructor(\n message: string,\n retryAfterMs?: number,\n status = HTTP_STATUS_CODES.TOO_MANY_REQUESTS,\n ) {\n super('otp_resend_cooldown', message, { status, retryAfterMs });\n this.name = 'OtpResendCooldownError';\n }\n}\n\n/**\n * A 429 without an MFA-specific code: generic throttling, not an OTP resend\n * cooldown.\n */\nexport class MfaRateLimitedError extends MfaError {\n constructor(\n message: string,\n retryAfterMs?: number,\n status = HTTP_STATUS_CODES.TOO_MANY_REQUESTS,\n ) {\n super('rate_limited', message, { status, retryAfterMs });\n this.name = 'MfaRateLimitedError';\n }\n}\n\n/**\n * The identity provider or the network is unreachable. Safe to retry.\n * `status` is only set when the service answered.\n */\nexport class MfaUnavailableError extends MfaError {\n constructor(message: string, status?: number) {\n super('kratos_unavailable', message, { status });\n this.name = 'MfaUnavailableError';\n }\n}\n\nexport class ElevatedTokenInvalidError extends MfaError {\n constructor(message: string) {\n super('elevated_token_invalid', message);\n this.name = 'ElevatedTokenInvalidError';\n }\n}\n\n/**\n * Gets an MFA code from direct, serialized, or message-only errors.\n *\n * @param error - Value to inspect.\n * @returns The stable code, if present.\n */\nexport function getMfaErrorCode(\n error: unknown,\n): ExtensibleMfaErrorCode | undefined {\n const direct = asRecord(error);\n if (typeof direct?.mfaCode === 'string') {\n return direct.mfaCode;\n }\n\n const data = asRecord(direct?.data);\n const cause = asRecord(data?.cause);\n if (typeof cause?.mfaCode === 'string') {\n return cause.mfaCode;\n }\n\n const messages = [direct?.message, cause?.message];\n for (const message of messages) {\n if (typeof message === 'string') {\n const match = /^MFA\\[([^\\]]+)\\]:/u.exec(message);\n if (match?.[1]) {\n return match[1];\n }\n }\n }\n return undefined;\n}\n\n/**\n * Checks whether a value carries an MFA error code.\n *\n * @param error - Value to inspect.\n * @param codes - Optional codes to match.\n * @returns Whether the value is an MFA error with a requested code.\n */\nexport function isMfaError(\n error: unknown,\n ...codes: ExtensibleMfaErrorCode[]\n): boolean {\n const code = getMfaErrorCode(error);\n return code !== undefined && (codes.length === 0 || codes.includes(code));\n}\n\n/**\n * Gets a retry delay from direct or serialized MFA errors.\n *\n * @param error - Value to inspect.\n * @returns Retry delay in milliseconds, if present.\n */\nexport function getMfaRetryAfterMs(error: unknown): number | undefined {\n const direct = asRecord(error);\n if (typeof direct?.retryAfterMs === 'number') {\n return direct.retryAfterMs;\n }\n const data = asRecord(direct?.data);\n const cause = asRecord(data?.cause);\n return typeof cause?.retryAfterMs === 'number'\n ? cause.retryAfterMs\n : undefined;\n}\n\nexport class NonceRetrievalError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'NonceRetrievalError';\n }\n}\n\nexport class SignInError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'SignInError';\n }\n}\n\nexport class PairError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'PairError';\n }\n}\n\n/**\n * Thrown when `POST /api/v2/profile/pair/identifier` returns 409 Conflict:\n * the social identifier already belongs to another canonical profile.\n * Retrying the same request cannot succeed.\n */\nexport class PairConflictError extends PairError {\n readonly status = HTTP_STATUS_CODES.CONFLICT;\n\n constructor(message: string) {\n super(message);\n this.name = 'PairConflictError';\n }\n}\n\n/**\n * Thrown when `POST /api/v2/oidc/token` returns 422: this profile has no\n * verified email on record. Consumers should send the user through email\n * OTP (or Google pair) and retry.\n */\nexport class EmailRequiredError extends Error {\n readonly status = HTTP_STATUS_CODES.UNPROCESSABLE_ENTITY;\n\n constructor(message: string) {\n super(message);\n this.name = 'EmailRequiredError';\n }\n}\n\nexport class UserStorageError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UserStorageError';\n }\n}\n\nexport class ValidationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ValidationError';\n }\n}\n\nexport class UnsupportedAuthTypeError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UnsupportedAuthTypeError';\n }\n}\n\nexport class NotFoundError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'NotFoundError';\n }\n}\n\nexport class RateLimitedError extends Error {\n readonly status = HTTP_STATUS_CODES.TOO_MANY_REQUESTS;\n\n readonly retryAfterMs?: number;\n\n constructor(message: string, retryAfterMs?: number) {\n super(message);\n this.name = 'RateLimitedError';\n this.retryAfterMs = retryAfterMs;\n }\n\n /**\n * Check if an unknown error is a rate limit error (429 status).\n *\n * @param e - The error to check\n * @returns True if the error is a rate limit error\n */\n static isRateLimitError(e: unknown): e is RateLimitedError {\n return (\n e instanceof RateLimitedError ||\n (typeof e === 'object' &&\n e !== null &&\n 'status' in e &&\n e.status === HTTP_STATUS_CODES.TOO_MANY_REQUESTS)\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRo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ACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,MAAM,GAAG,iBAAiB,CAAC,iBAAiB,CAAC;IAE7C,YAAY,CAAU;IAE/B,YAAY,OAAe,EAAE,YAAqB;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,CAAU;QAChC,OAAO,CACL,CAAC,YAAY,gBAAgB;YAC7B,CAAC,OAAO,CAAC,KAAK,QAAQ;gBACpB,CAAC,KAAK,IAAI;gBACV,QAAQ,IAAI,CAAC;gBACb,CAAC,CAAC,MAAM,KAAK,iBAAiB,CAAC,iBAAiB,CAAC,CACpD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { MfaErrorCode } from './authentication-jwt-bearer/mfa/types.js';\nimport { HTTP_STATUS_CODES } from './constants.js';\nimport { asRecord } from './utils/as-record.js';\n\ntype ExtensibleMfaErrorCode = MfaErrorCode | (string & {});\n\n/**\n * Base error for MFA operations.\n *\n * The machine-readable code is an enumerable own property so it survives\n * JSON-RPC error serialization.\n */\nexport class MfaError extends Error {\n readonly mfaCode: ExtensibleMfaErrorCode;\n\n readonly status?: number;\n\n readonly retryAfterMs?: number;\n\n constructor(\n mfaCode: ExtensibleMfaErrorCode,\n message: string,\n options?: { status?: number; retryAfterMs?: number },\n ) {\n super(`MFA[${mfaCode}]: ${message}`);\n this.name = 'MfaError';\n this.mfaCode = mfaCode;\n this.status = options?.status;\n this.retryAfterMs = options?.retryAfterMs;\n }\n}\n\n/**\n * The credential cannot be enrolled because an equivalent one already exists:\n * `email_already_enrolled` (this profile already has a verified email),\n * `email_socially_verified` (the email is verified through a social login), or\n * `credential_already_enrolled` (the email or passkey is enrolled on another\n * profile; the profiles must be paired or the credential removed).\n */\nexport class CredentialAlreadyEnrolledError extends MfaError {\n constructor(\n code:\n | 'credential_already_enrolled'\n | 'email_already_enrolled'\n | 'email_socially_verified',\n message: string,\n status = HTTP_STATUS_CODES.CONFLICT,\n ) {\n super(code, message, { status });\n this.name = 'CredentialAlreadyEnrolledError';\n }\n}\n\n/**\n * The profile already has a credential that proves AAL2, so enrolling another\n * requires an `aal:2` access token; the client must complete a verification\n * and retry with the same flow.\n */\nexport class StepUpRequiredError extends MfaError {\n constructor(message: string, status = HTTP_STATUS_CODES.FORBIDDEN) {\n super('aal2_required', message, { status });\n this.name = 'StepUpRequiredError';\n }\n}\n\nexport class CredentialNotEnrolledError extends MfaError {\n constructor(message: string, status = HTTP_STATUS_CODES.CONFLICT) {\n super('credential_not_enrolled', message, { status });\n this.name = 'CredentialNotEnrolledError';\n }\n}\n\n/**\n * The begin/complete flow is stale or unknown; the client must restart it.\n */\nexport class MfaFlowExpiredError extends MfaError {\n constructor(\n code: 'flow_expired' | 'invalid_flow',\n message: string,\n status?: number,\n ) {\n super(code, message, { status });\n this.name = 'MfaFlowExpiredError';\n }\n}\n\n/**\n * The profile has no identity-provider record yet. Not a stale flow: the\n * user must enroll a first credential before verifying.\n */\nexport class MfaIdentityMissingError extends MfaError {\n constructor(message: string, status = HTTP_STATUS_CODES.CONFLICT) {\n super('mfa_identity_missing', message, { status });\n this.name = 'MfaIdentityMissingError';\n }\n}\n\nexport class MfaVerificationFailedError extends MfaError {\n constructor(\n code: 'invalid_code' | 'invalid_attestation' | 'invalid_assertion',\n message: string,\n status?: number,\n ) {\n super(code, message, { status });\n this.name = 'MfaVerificationFailedError';\n }\n}\n\nexport class TooManyAttemptsError extends MfaError {\n constructor(message: string, status?: number) {\n super('too_many_attempts', message, { status });\n this.name = 'TooManyAttemptsError';\n }\n}\n\nexport class MaxPasskeysReachedError extends MfaError {\n constructor(\n message: string,\n status = HTTP_STATUS_CODES.UNPROCESSABLE_ENTITY,\n ) {\n super('max_passkeys_reached', message, { status });\n this.name = 'MaxPasskeysReachedError';\n }\n}\n\nexport class MaxIdentifiersReachedError extends MfaError {\n constructor(message: string, status = HTTP_STATUS_CODES.CONFLICT) {\n super('max_identifiers_reached', message, { status });\n this.name = 'MaxIdentifiersReachedError';\n }\n}\n\nexport class OtpResendCooldownError extends MfaError {\n constructor(\n message: string,\n retryAfterMs?: number,\n status = HTTP_STATUS_CODES.TOO_MANY_REQUESTS,\n ) {\n super('otp_resend_cooldown', message, { status, retryAfterMs });\n this.name = 'OtpResendCooldownError';\n }\n}\n\n/**\n * A 429 without an MFA-specific code: generic throttling, not an OTP resend\n * cooldown.\n */\nexport class MfaRateLimitedError extends MfaError {\n constructor(\n message: string,\n retryAfterMs?: number,\n status = HTTP_STATUS_CODES.TOO_MANY_REQUESTS,\n ) {\n super('rate_limited', message, { status, retryAfterMs });\n this.name = 'MfaRateLimitedError';\n }\n}\n\n/**\n * The identity provider or the network is unreachable. Safe to retry.\n * `status` is only set when the service answered.\n */\nexport class MfaUnavailableError extends MfaError {\n constructor(message: string, status?: number) {\n super('kratos_unavailable', message, { status });\n this.name = 'MfaUnavailableError';\n }\n}\n\nexport class VerificationTokenInvalidError extends MfaError {\n constructor(message: string) {\n super('verification_token_invalid', message);\n this.name = 'VerificationTokenInvalidError';\n }\n}\n\n/**\n * Gets an MFA code from direct, serialized, or message-only errors.\n *\n * @param error - Value to inspect.\n * @returns The stable code, if present.\n */\nexport function getMfaErrorCode(\n error: unknown,\n): ExtensibleMfaErrorCode | undefined {\n const direct = asRecord(error);\n if (typeof direct?.mfaCode === 'string') {\n return direct.mfaCode;\n }\n\n const data = asRecord(direct?.data);\n const cause = asRecord(data?.cause);\n if (typeof cause?.mfaCode === 'string') {\n return cause.mfaCode;\n }\n\n const messages = [direct?.message, cause?.message];\n for (const message of messages) {\n if (typeof message === 'string') {\n const match = /^MFA\\[([^\\]]+)\\]:/u.exec(message);\n if (match?.[1]) {\n return match[1];\n }\n }\n }\n return undefined;\n}\n\n/**\n * Checks whether a value carries an MFA error code.\n *\n * @param error - Value to inspect.\n * @param codes - Optional codes to match.\n * @returns Whether the value is an MFA error with a requested code.\n */\nexport function isMfaError(\n error: unknown,\n ...codes: ExtensibleMfaErrorCode[]\n): boolean {\n const code = getMfaErrorCode(error);\n return code !== undefined && (codes.length === 0 || codes.includes(code));\n}\n\n/**\n * Gets a retry delay from direct or serialized MFA errors.\n *\n * @param error - Value to inspect.\n * @returns Retry delay in milliseconds, if present.\n */\nexport function getMfaRetryAfterMs(error: unknown): number | undefined {\n const direct = asRecord(error);\n if (typeof direct?.retryAfterMs === 'number') {\n return direct.retryAfterMs;\n }\n const data = asRecord(direct?.data);\n const cause = asRecord(data?.cause);\n return typeof cause?.retryAfterMs === 'number'\n ? cause.retryAfterMs\n : undefined;\n}\n\nexport class NonceRetrievalError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'NonceRetrievalError';\n }\n}\n\nexport class SignInError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'SignInError';\n }\n}\n\nexport class PairError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'PairError';\n }\n}\n\n/**\n * Thrown when `POST /api/v2/profile/pair/identifier` returns 409 Conflict:\n * the social identifier already belongs to another canonical profile.\n * Retrying the same request cannot succeed.\n */\nexport class PairConflictError extends PairError {\n readonly status = HTTP_STATUS_CODES.CONFLICT;\n\n constructor(message: string) {\n super(message);\n this.name = 'PairConflictError';\n }\n}\n\n/**\n * Thrown when `POST /api/v2/oidc/token` returns 422: this profile has no\n * verified email on record. Consumers should send the user through email\n * OTP (or Google pair) and retry.\n */\nexport class EmailRequiredError extends Error {\n readonly status = HTTP_STATUS_CODES.UNPROCESSABLE_ENTITY;\n\n constructor(message: string) {\n super(message);\n this.name = 'EmailRequiredError';\n }\n}\n\nexport class UserStorageError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UserStorageError';\n }\n}\n\nexport class ValidationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ValidationError';\n }\n}\n\nexport class UnsupportedAuthTypeError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UnsupportedAuthTypeError';\n }\n}\n\nexport class NotFoundError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'NotFoundError';\n }\n}\n\nexport class RateLimitedError extends Error {\n readonly status = HTTP_STATUS_CODES.TOO_MANY_REQUESTS;\n\n readonly retryAfterMs?: number;\n\n constructor(message: string, retryAfterMs?: number) {\n super(message);\n this.name = 'RateLimitedError';\n this.retryAfterMs = retryAfterMs;\n }\n\n /**\n * Check if an unknown error is a rate limit error (429 status).\n *\n * @param e - The error to check\n * @returns True if the error is a rate limit error\n */\n static isRateLimitError(e: unknown): e is RateLimitedError {\n return (\n e instanceof RateLimitedError ||\n (typeof e === 'object' &&\n e !== null &&\n 'status' in e &&\n e.status === HTTP_STATUS_CODES.TOO_MANY_REQUESTS)\n );\n }\n}\n"]}
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './authentication.js';
|
|
2
2
|
export { MFA_CREDENTIAL_TYPES } from './authentication-jwt-bearer/mfa/types.js';
|
|
3
|
-
export type { MfaCredentialType, MfaCredentialStatus, MfaErrorCode, EnrolledCredential, TokenReason, EnrollmentChallenge, EnrollmentProof,
|
|
4
|
-
export type {
|
|
3
|
+
export type { MfaCredentialType, MfaCredentialStatus, MfaErrorCode, EnrolledCredential, TokenReason, EnrollmentChallenge, EnrollmentProof, VerificationChallenge, VerificationProof, VerificationToken, BeginEnrollmentRequest, CompleteEnrollmentRequest, BeginVerificationRequest, CompleteVerificationRequest, GetVerificationTokenRequest, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON, AuthenticationResponseJSON, } from './authentication-jwt-bearer/mfa/types.js';
|
|
4
|
+
export type { MfaVerificationAssertion } from './authentication-jwt-bearer/mfa/services.js';
|
|
5
5
|
export * from './user-storage.js';
|
|
6
6
|
export * from './errors.js';
|
|
7
7
|
export * from './utils/messaging-signing-snap-requests.js';
|
package/dist/sdk/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,EAC3B,sCAAsC,EACtC,qCAAqC,EACrC,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,0CAA0C,CAAC;AAClD,YAAY,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AAC5F,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC"}
|
package/dist/sdk/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAuBhF,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC","sourcesContent":["export * from './authentication.js';\nexport { MFA_CREDENTIAL_TYPES } from './authentication-jwt-bearer/mfa/types.js';\nexport type {\n MfaCredentialType,\n MfaCredentialStatus,\n MfaErrorCode,\n EnrolledCredential,\n TokenReason,\n EnrollmentChallenge,\n EnrollmentProof,\n
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAuBhF,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC","sourcesContent":["export * from './authentication.js';\nexport { MFA_CREDENTIAL_TYPES } from './authentication-jwt-bearer/mfa/types.js';\nexport type {\n MfaCredentialType,\n MfaCredentialStatus,\n MfaErrorCode,\n EnrolledCredential,\n TokenReason,\n EnrollmentChallenge,\n EnrollmentProof,\n VerificationChallenge,\n VerificationProof,\n VerificationToken,\n BeginEnrollmentRequest,\n CompleteEnrollmentRequest,\n BeginVerificationRequest,\n CompleteVerificationRequest,\n GetVerificationTokenRequest,\n PublicKeyCredentialCreationOptionsJSON,\n PublicKeyCredentialRequestOptionsJSON,\n RegistrationResponseJSON,\n AuthenticationResponseJSON,\n} from './authentication-jwt-bearer/mfa/types.js';\nexport type { MfaVerificationAssertion } from './authentication-jwt-bearer/mfa/services.js';\nexport * from './user-storage.js';\nexport * from './errors.js';\nexport * from './utils/messaging-signing-snap-requests.js';\nexport * from '../shared/encryption/index.js';\nexport * from '../shared/env.js';\nexport * from '../shared/storage-schema.js';\n"]}
|
package/dist/sdk/mocks/auth.d.ts
CHANGED
|
@@ -67,8 +67,8 @@ export declare const MOCK_MFA_CREDENTIALS_RESPONSE: {
|
|
|
67
67
|
};
|
|
68
68
|
})[];
|
|
69
69
|
};
|
|
70
|
-
export declare const
|
|
71
|
-
export declare const
|
|
70
|
+
export declare const MOCK_VERIFICATION_ACCESS_JWT = "eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiJmODgyMjdiZC1iNjE1LTQxYTMtYjBiZS00NjdkZDc4MWE0YWQiLCJhYWwiOjIsImFtciI6WyJwYXNza2V5Il0sImV4cCI6NDEwMjQ0NDgwMH0.signature";
|
|
71
|
+
export declare const MOCK_VERIFICATION_ACCESS_TOKEN_RESPONSE: {
|
|
72
72
|
access_token: string;
|
|
73
73
|
expires_in: number;
|
|
74
74
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/sdk/mocks/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAqBpD,eAA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