"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PkiServiceError = exports.QuoteValidationError = exports.AttestationDcapQuoteVerifyEnclaveError = exports.AttestationDcapQuoteVerifyServiceError = void 0;
class AttestationDcapQuoteVerifyServiceError extends Error {
    constructor(msg) {
        super(msg);
        this.name = AttestationDcapQuoteVerifyServiceError.name;
    }
}
exports.AttestationDcapQuoteVerifyServiceError = AttestationDcapQuoteVerifyServiceError;
class AttestationDcapQuoteVerifyEnclaveError extends Error {
    constructor(msg) {
        super(msg);
        this.name = AttestationDcapQuoteVerifyEnclaveError.name;
    }
}
exports.AttestationDcapQuoteVerifyEnclaveError = AttestationDcapQuoteVerifyEnclaveError;
class QuoteValidationError extends AttestationDcapQuoteVerifyEnclaveError {
    constructor(verifyResult) {
        super();
        this.verifyResult = verifyResult;
        this.criticalError = false;
        this.verifyResult = verifyResult;
        this.criticalError = false;
        switch (verifyResult) {
            case 0xa001:
                this.message = `The SGX platform firmware and SW are at the latest security patching level but there are 
                platform hardware configurations may expose the enclave to vulnerabilities.`;
                break;
            case 0xa002:
            case 0xa003:
            case 0xa004:
                this.message = `The SGX platform firmware and SW are not at the latest security patching level. The 
                platform needs to be patched with firmware and/or software patches.`;
                break;
            case 0xa007:
            case 0xa008:
                this.message = `The SGX platform firmware and SW are at the latest security patching level but there 
                are certain vulnerabilities that can only be mitigated with software mitigations implemented by the enclave.`;
                break;
            default:
                this.criticalError = true;
                this.message = `Quote verification failed. Verification result: 0x${Number(verifyResult).toString(16)}`;
                break;
        }
    }
}
exports.QuoteValidationError = QuoteValidationError;
class PkiServiceError extends Error {
    constructor(msg) {
        super(msg);
        this.name = PkiServiceError.name;
    }
}
exports.PkiServiceError = PkiServiceError;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NneC1uYXRpdmUtbW9kdWxlL2Vycm9ycy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