UNPKG

@aktivco-it/rutoken-plugin-bootstrap

Version:
99 lines (97 loc) 7.12 kB
/* eslint max-len: ["error", { "ignoreStrings": true }] */ const getErrorCodes = (errorCodes) => ({ 'DEFAULT_ERROR': 'An error has occurred', [errorCodes.UNKNOWN_ERROR]: 'Unknown error', [errorCodes.BAD_PARAMS]: 'Wrong parameters', [errorCodes.NOT_ENOUGH_MEMORY]: 'Low memory', [errorCodes.DEVICE_NOT_FOUND]: 'Device not found', [errorCodes.DEVICE_ERROR]: 'Device error', [errorCodes.TOKEN_INVALID]: 'Device read/write error. Device may have been removed. Try refreshing the page ', [errorCodes.CERTIFICATE_CATEGORY_BAD]: 'Invalid certificate type', [errorCodes.CERTIFICATE_EXISTS]: 'Certificate already exists on the device', [errorCodes.CERTIFICATE_NOT_FOUND]: 'Certificate not found', [errorCodes.CERTIFICATE_HASH_NOT_UNIQUE]: 'Certificate hash not unique', [errorCodes.CA_CERTIFICATES_NOT_FOUND]: 'Root certificates not found', [errorCodes.CERTIFICATE_VERIFICATION_ERROR]: 'Certificate verification error', [errorCodes.PKCS11_LOAD_FAILED]: 'PKCS#11 library load failed', [errorCodes.PIN_LENGTH_INVALID]: 'PIN length invalid', [errorCodes.PIN_INCORRECT]: 'Current PIN incorrect', [errorCodes.PIN_LOCKED]: 'PIN locked', [errorCodes.PIN_CHANGED]: 'PIN changed', [errorCodes.SESSION_INVALID]: 'Token state changed', [errorCodes.USER_NOT_LOGGED_IN]: 'Please log in to the device', [errorCodes.ALREADY_LOGGED_IN]: 'You are already logged in', [errorCodes.ATTRIBUTE_READ_ONLY]: 'Attribute cannot be changed', [errorCodes.KEY_NOT_FOUND]: 'No key pair found for the certificate', [errorCodes.KEY_ID_NOT_UNIQUE]: 'Key pair ID not unique', [errorCodes.CEK_NOT_AUTHENTIC]: 'Wrong key selected', [errorCodes.KEY_LABEL_NOT_UNIQUE]: 'Key pair label not unique', [errorCodes.WRONG_KEY_TYPE]: 'Wrong key type', [errorCodes.LICENCE_READ_ONLY]: 'Licence read only', [errorCodes.DATA_INVALID]: 'Data invalid', [errorCodes.UNSUPPORTED_BY_TOKEN]: 'Operation not supported by token', [errorCodes.KEY_FUNCTION_NOT_PERMITTED]: 'Operation not permitted for this key type', [errorCodes.BASE64_DECODE_FAILED]: 'Base64 data decoding error', [errorCodes.PEM_ERROR]: 'PEM error', [errorCodes.ASN1_ERROR]: 'ASN1 structure decoding error', [errorCodes.FUNCTION_REJECTED]: 'Operation rejected by user', [errorCodes.FUNCTION_FAILED]: 'Operation failed', [errorCodes.MECHANISM_INVALID]: 'Mechanism invalid', [errorCodes.ATTRIBUTE_VALUE_INVALID]: 'Attribute invalid', [errorCodes.X509_UNABLE_TO_GET_ISSUER_CERT]: 'Unable to get issuer certificate', [errorCodes.X509_UNABLE_TO_GET_CRL]: 'Unable to get CRL', [errorCodes.X509_UNABLE_TO_DECRYPT_CERT_SIGNATURE]: 'Unable to decrypt certificate signature', [errorCodes.X509_UNABLE_TO_DECRYPT_CRL_SIGNATURE]: 'Unable to decrypt CRL signature', [errorCodes.X509_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY]: 'Unable to decode issuer public key', [errorCodes.X509_CERT_SIGNATURE_FAILURE]: 'Wrong certificate signature', [errorCodes.X509_CRL_SIGNATURE_FAILURE]: 'Wrong CRL signature', [errorCodes.X509_CERT_NOT_YET_VALID]: 'Certificate not yet valid', [errorCodes.X509_CRL_NOT_YET_VALID]: 'CRL not yet valid', [errorCodes.X509_CERT_HAS_EXPIRED]: 'Certificate has expired', [errorCodes.X509_CRL_HAS_EXPIRED]: 'CRL has expired', [errorCodes.X509_ERROR_IN_CERT_NOT_BEFORE_FIELD]: 'Error in certificate \'notBefore\' field', [errorCodes.X509_ERROR_IN_CERT_NOT_AFTER_FIELD]: 'Error in certificate \'notAfter\' field', [errorCodes.X509_ERROR_IN_CRL_LAST_UPDATE_FIELD]: 'Error in CRL \'lastUpdate\' field', [errorCodes.X509_ERROR_IN_CRL_NEXT_UPDATE_FIELD]: 'Error in CRL \'nextUpdate\' field', [errorCodes.X509_OUT_OF_MEM]: 'Not enough memory', [errorCodes.X509_DEPTH_ZERO_SELF_SIGNED_CERT]: 'Untrusted self-signed certificate', [errorCodes.X509_SELF_SIGNED_CERT_IN_CHAIN]: 'Untrusted self-signed certificate found in chain', [errorCodes.X509_UNABLE_TO_GET_ISSUER_CERT_LOCALLY]: 'Unable to get issuer local certificate', [errorCodes.X509_UNABLE_TO_VERIFY_LEAF_SIGNATURE]: 'Unable to verify first certificate', [errorCodes.X509_CERT_CHAIN_TOO_LONG]: 'Certificate chain too long', [errorCodes.X509_CERT_REVOKED]: 'Certificate revoked', [errorCodes.X509_INVALID_CA]: 'Invalid root certificate', [errorCodes.X509_INVALID_NON_CA]: 'Invalid non-root certificate labelled as root certificate', [errorCodes.X509_PATH_LENGTH_EXCEEDED]: 'Path length exceeded', [errorCodes.X509_PROXY_PATH_LENGTH_EXCEEDED]: 'Proxy path length exceeded', [errorCodes.X509_PROXY_CERTIFICATES_NOT_ALLOWED]: 'Proxy certificates not allowed', [errorCodes.X509_INVALID_PURPOSE]: 'Invalid certificate purpose', [errorCodes.X509_CERT_UNTRUSTED]: 'Certificate untrusted', [errorCodes.X509_CERT_REJECTED]: 'Certificate rejected', [errorCodes.X509_APPLICATION_VERIFICATION]: 'Application verification failed', [errorCodes.X509_SUBJECT_ISSUER_MISMATCH]: 'Subject and Issuer mismatch', [errorCodes.X509_AKID_SKID_MISMATCH]: 'Mismatch between key identifier of the subject and trusted authority ', [errorCodes.X509_AKID_ISSUER_SERIAL_MISMATCH]: 'Mismatch between serial number of the subject and trusted authority ', [errorCodes.X509_KEYUSAGE_NO_CERTSIGN]: 'Key cannot be used for certificate signature', [errorCodes.X509_UNABLE_TO_GET_CRL_ISSUER]: 'Unable to get issuer CRL', [errorCodes.X509_UNHANDLED_CRITICAL_EXTENSION]: 'Extension not supported', [errorCodes.X509_KEYUSAGE_NO_CRL_SIGN]: 'Key cannot be used for CRL signature', [errorCodes.X509_KEYUSAGE_NO_DIGITAL_SIGNATURE]: 'Key cannot be used for digital signature', [errorCodes.X509_UNHANDLED_CRITICAL_CRL_EXTENSION]: 'CRL extension not supported', [errorCodes.X509_INVALID_EXTENSION]: 'Invalid or incorrect certificate extension', [errorCodes.X509_INVALID_POLICY_EXTENSION]: 'Invalid or incorrect certificate policy extension', [errorCodes.X509_NO_EXPLICIT_POLICY]: 'No explicit policy', [errorCodes.X509_DIFFERENT_CRL_SCOPE]: 'Different CRL scope', [errorCodes.X509_UNSUPPORTED_EXTENSION_FEATURE]: 'Unsupported extension', [errorCodes.X509_UNNESTED_RESOURCE]: 'RFC 3779 incorrect resource inheritance ', [errorCodes.X509_PERMITTED_VIOLATION]: 'Wrong certificate structure', [errorCodes.X509_EXCLUDED_VIOLATION]: 'Wrong certificate structure', [errorCodes.X509_SUBTREE_MINMAX]: 'Wrong certificate structure', [errorCodes.X509_UNSUPPORTED_CONSTRAINT_TYPE]: 'Wrong certificate structure', [errorCodes.X509_UNSUPPORTED_CONSTRAINT_SYNTAX]: 'Wrong certificate structure', [errorCodes.X509_UNSUPPORTED_NAME_SYNTAX]: 'Wrong certificate structure', [errorCodes.X509_CRL_PATH_VALIDATION_ERROR]: 'Wrong CRL path', [errorCodes.CMS_CERTIFICATE_ALREADY_PRESENT]: 'Certificate already in use', [errorCodes.CANT_HARDWARE_VERIFY_CMS]: 'Multiple signature verification with hash computation is not supported on the device', }); export default getErrorCodes;