Files
FrenoCorp/node_modules/@clerk/backend/dist/chunk-RZ7A7F6X.mjs

89 lines
3.1 KiB
JavaScript

// src/errors.ts
import { ClerkError } from "@clerk/shared/error";
import { ClerkAPIResponseError, isClerkAPIResponseError } from "@clerk/shared/error";
var TokenVerificationErrorCode = {
InvalidSecretKey: "clerk_key_invalid"
};
var TokenVerificationErrorReason = {
TokenExpired: "token-expired",
TokenInvalid: "token-invalid",
TokenInvalidAlgorithm: "token-invalid-algorithm",
TokenInvalidAuthorizedParties: "token-invalid-authorized-parties",
TokenInvalidSignature: "token-invalid-signature",
TokenNotActiveYet: "token-not-active-yet",
TokenIatInTheFuture: "token-iat-in-the-future",
TokenVerificationFailed: "token-verification-failed",
InvalidSecretKey: "secret-key-invalid",
LocalJWKMissing: "jwk-local-missing",
RemoteJWKFailedToLoad: "jwk-remote-failed-to-load",
RemoteJWKInvalid: "jwk-remote-invalid",
RemoteJWKMissing: "jwk-remote-missing",
JWKFailedToResolve: "jwk-failed-to-resolve",
JWKKidMismatch: "jwk-kid-mismatch"
};
var TokenVerificationErrorAction = {
ContactSupport: "Contact support@clerk.com",
EnsureClerkJWT: "Make sure that this is a valid Clerk-generated JWT.",
SetClerkJWTKey: "Set the CLERK_JWT_KEY environment variable.",
SetClerkSecretKey: "Set the CLERK_SECRET_KEY environment variable.",
EnsureClockSync: "Make sure your system clock is in sync (e.g. turn off and on automatic time synchronization)."
};
var TokenVerificationError = class _TokenVerificationError extends Error {
constructor({
action,
message,
reason
}) {
super(message);
Object.setPrototypeOf(this, _TokenVerificationError.prototype);
this.reason = reason;
this.message = message;
this.action = action;
}
getFullMessage() {
return `${[this.message, this.action].filter((m) => m).join(" ")} (reason=${this.reason}, token-carrier=${this.tokenCarrier})`;
}
};
var SignJWTError = class extends Error {
};
var MachineTokenVerificationErrorCode = {
TokenInvalid: "token-invalid",
InvalidSecretKey: "secret-key-invalid",
UnexpectedError: "unexpected-error",
TokenVerificationFailed: "token-verification-failed"
};
var _MachineTokenVerificationError = class _MachineTokenVerificationError extends ClerkError {
constructor({
message,
code,
status,
action
}) {
super({ message, code });
Object.setPrototypeOf(this, _MachineTokenVerificationError.prototype);
this.status = status;
this.action = action;
}
// Keep message unformatted, matching ClerkAPIResponseError's approach
static formatMessage(_name, msg, _code, _docsUrl) {
return msg;
}
getFullMessage() {
return `${this.message} (code=${this.code}, status=${this.status || "n/a"})`;
}
};
_MachineTokenVerificationError.kind = "MachineTokenVerificationError";
var MachineTokenVerificationError = _MachineTokenVerificationError;
export {
TokenVerificationErrorCode,
TokenVerificationErrorReason,
TokenVerificationErrorAction,
TokenVerificationError,
SignJWTError,
MachineTokenVerificationErrorCode,
MachineTokenVerificationError,
ClerkAPIResponseError,
isClerkAPIResponseError
};
//# sourceMappingURL=chunk-RZ7A7F6X.mjs.map