// Copyright © Aptos // SPDX-License-Identifier: Apache-2.0 export const AuthError = { missing_client: 'missing_client', redirect_mismatch: 'redirect_mismatch', state_mismatch: 'state_mismatch', } as const; export const AuthErrorMessages: Record< keyof typeof AuthError, { code: number; description: string; shortMessage: string } > = { [AuthError.state_mismatch]: { code: 0, description: 'State mismatch', shortMessage: 'An error occurred while logging in, please try again.', }, [AuthError.redirect_mismatch]: { code: 1, description: 'Redirect mismatch', shortMessage: 'An error occurred while logging in, please try again.', }, [AuthError.missing_client]: { code: 2, description: 'Missing client', shortMessage: 'An error occurred while logging in, please try again.', }, } as const; export const isAuthError = (code: string): code is keyof typeof AuthError => Object.values(AuthError).includes(code as any);