initial commit
This commit is contained in:
6
server/node_modules/jose/dist/node/cjs/util/base64url.js
generated
vendored
Normal file
6
server/node_modules/jose/dist/node/cjs/util/base64url.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decode = exports.encode = void 0;
|
||||
const base64url = require("../runtime/base64url.js");
|
||||
exports.encode = base64url.encode;
|
||||
exports.decode = base64url.decode;
|
||||
36
server/node_modules/jose/dist/node/cjs/util/decode_jwt.js
generated
vendored
Normal file
36
server/node_modules/jose/dist/node/cjs/util/decode_jwt.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decodeJwt = void 0;
|
||||
const base64url_js_1 = require("./base64url.js");
|
||||
const buffer_utils_js_1 = require("../lib/buffer_utils.js");
|
||||
const is_object_js_1 = require("../lib/is_object.js");
|
||||
const errors_js_1 = require("./errors.js");
|
||||
function decodeJwt(jwt) {
|
||||
if (typeof jwt !== 'string')
|
||||
throw new errors_js_1.JWTInvalid('JWTs must use Compact JWS serialization, JWT must be a string');
|
||||
const { 1: payload, length } = jwt.split('.');
|
||||
if (length === 5)
|
||||
throw new errors_js_1.JWTInvalid('Only JWTs using Compact JWS serialization can be decoded');
|
||||
if (length !== 3)
|
||||
throw new errors_js_1.JWTInvalid('Invalid JWT');
|
||||
if (!payload)
|
||||
throw new errors_js_1.JWTInvalid('JWTs must contain a payload');
|
||||
let decoded;
|
||||
try {
|
||||
decoded = (0, base64url_js_1.decode)(payload);
|
||||
}
|
||||
catch {
|
||||
throw new errors_js_1.JWTInvalid('Failed to base64url decode the payload');
|
||||
}
|
||||
let result;
|
||||
try {
|
||||
result = JSON.parse(buffer_utils_js_1.decoder.decode(decoded));
|
||||
}
|
||||
catch {
|
||||
throw new errors_js_1.JWTInvalid('Failed to parse the decoded payload as JSON');
|
||||
}
|
||||
if (!(0, is_object_js_1.default)(result))
|
||||
throw new errors_js_1.JWTInvalid('Invalid JWT Claims Set');
|
||||
return result;
|
||||
}
|
||||
exports.decodeJwt = decodeJwt;
|
||||
38
server/node_modules/jose/dist/node/cjs/util/decode_protected_header.js
generated
vendored
Normal file
38
server/node_modules/jose/dist/node/cjs/util/decode_protected_header.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decodeProtectedHeader = void 0;
|
||||
const base64url_js_1 = require("./base64url.js");
|
||||
const buffer_utils_js_1 = require("../lib/buffer_utils.js");
|
||||
const is_object_js_1 = require("../lib/is_object.js");
|
||||
function decodeProtectedHeader(token) {
|
||||
let protectedB64u;
|
||||
if (typeof token === 'string') {
|
||||
const parts = token.split('.');
|
||||
if (parts.length === 3 || parts.length === 5) {
|
||||
;
|
||||
[protectedB64u] = parts;
|
||||
}
|
||||
}
|
||||
else if (typeof token === 'object' && token) {
|
||||
if ('protected' in token) {
|
||||
protectedB64u = token.protected;
|
||||
}
|
||||
else {
|
||||
throw new TypeError('Token does not contain a Protected Header');
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (typeof protectedB64u !== 'string' || !protectedB64u) {
|
||||
throw new Error();
|
||||
}
|
||||
const result = JSON.parse(buffer_utils_js_1.decoder.decode((0, base64url_js_1.decode)(protectedB64u)));
|
||||
if (!(0, is_object_js_1.default)(result)) {
|
||||
throw new Error();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch {
|
||||
throw new TypeError('Invalid Token or Protected Header formatting');
|
||||
}
|
||||
}
|
||||
exports.decodeProtectedHeader = decodeProtectedHeader;
|
||||
177
server/node_modules/jose/dist/node/cjs/util/errors.js
generated
vendored
Normal file
177
server/node_modules/jose/dist/node/cjs/util/errors.js
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.JWSSignatureVerificationFailed = exports.JWKSTimeout = exports.JWKSMultipleMatchingKeys = exports.JWKSNoMatchingKey = exports.JWKSInvalid = exports.JWKInvalid = exports.JWTInvalid = exports.JWSInvalid = exports.JWEInvalid = exports.JWEDecompressionFailed = exports.JWEDecryptionFailed = exports.JOSENotSupported = exports.JOSEAlgNotAllowed = exports.JWTExpired = exports.JWTClaimValidationFailed = exports.JOSEError = void 0;
|
||||
class JOSEError extends Error {
|
||||
static get code() {
|
||||
return 'ERR_JOSE_GENERIC';
|
||||
}
|
||||
constructor(message) {
|
||||
var _a;
|
||||
super(message);
|
||||
this.code = 'ERR_JOSE_GENERIC';
|
||||
this.name = this.constructor.name;
|
||||
(_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor);
|
||||
}
|
||||
}
|
||||
exports.JOSEError = JOSEError;
|
||||
class JWTClaimValidationFailed extends JOSEError {
|
||||
static get code() {
|
||||
return 'ERR_JWT_CLAIM_VALIDATION_FAILED';
|
||||
}
|
||||
constructor(message, claim = 'unspecified', reason = 'unspecified') {
|
||||
super(message);
|
||||
this.code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';
|
||||
this.claim = claim;
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
||||
exports.JWTClaimValidationFailed = JWTClaimValidationFailed;
|
||||
class JWTExpired extends JOSEError {
|
||||
static get code() {
|
||||
return 'ERR_JWT_EXPIRED';
|
||||
}
|
||||
constructor(message, claim = 'unspecified', reason = 'unspecified') {
|
||||
super(message);
|
||||
this.code = 'ERR_JWT_EXPIRED';
|
||||
this.claim = claim;
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
||||
exports.JWTExpired = JWTExpired;
|
||||
class JOSEAlgNotAllowed extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JOSE_ALG_NOT_ALLOWED';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JOSE_ALG_NOT_ALLOWED';
|
||||
}
|
||||
}
|
||||
exports.JOSEAlgNotAllowed = JOSEAlgNotAllowed;
|
||||
class JOSENotSupported extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JOSE_NOT_SUPPORTED';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JOSE_NOT_SUPPORTED';
|
||||
}
|
||||
}
|
||||
exports.JOSENotSupported = JOSENotSupported;
|
||||
class JWEDecryptionFailed extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JWE_DECRYPTION_FAILED';
|
||||
this.message = 'decryption operation failed';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JWE_DECRYPTION_FAILED';
|
||||
}
|
||||
}
|
||||
exports.JWEDecryptionFailed = JWEDecryptionFailed;
|
||||
class JWEDecompressionFailed extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JWE_DECOMPRESSION_FAILED';
|
||||
this.message = 'decompression operation failed';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JWE_DECOMPRESSION_FAILED';
|
||||
}
|
||||
}
|
||||
exports.JWEDecompressionFailed = JWEDecompressionFailed;
|
||||
class JWEInvalid extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JWE_INVALID';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JWE_INVALID';
|
||||
}
|
||||
}
|
||||
exports.JWEInvalid = JWEInvalid;
|
||||
class JWSInvalid extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JWS_INVALID';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JWS_INVALID';
|
||||
}
|
||||
}
|
||||
exports.JWSInvalid = JWSInvalid;
|
||||
class JWTInvalid extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JWT_INVALID';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JWT_INVALID';
|
||||
}
|
||||
}
|
||||
exports.JWTInvalid = JWTInvalid;
|
||||
class JWKInvalid extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JWK_INVALID';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JWK_INVALID';
|
||||
}
|
||||
}
|
||||
exports.JWKInvalid = JWKInvalid;
|
||||
class JWKSInvalid extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JWKS_INVALID';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JWKS_INVALID';
|
||||
}
|
||||
}
|
||||
exports.JWKSInvalid = JWKSInvalid;
|
||||
class JWKSNoMatchingKey extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JWKS_NO_MATCHING_KEY';
|
||||
this.message = 'no applicable key found in the JSON Web Key Set';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JWKS_NO_MATCHING_KEY';
|
||||
}
|
||||
}
|
||||
exports.JWKSNoMatchingKey = JWKSNoMatchingKey;
|
||||
class JWKSMultipleMatchingKeys extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
|
||||
this.message = 'multiple matching keys found in the JSON Web Key Set';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
|
||||
}
|
||||
}
|
||||
exports.JWKSMultipleMatchingKeys = JWKSMultipleMatchingKeys;
|
||||
Symbol.asyncIterator;
|
||||
class JWKSTimeout extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JWKS_TIMEOUT';
|
||||
this.message = 'request timed out';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JWKS_TIMEOUT';
|
||||
}
|
||||
}
|
||||
exports.JWKSTimeout = JWKSTimeout;
|
||||
class JWSSignatureVerificationFailed extends JOSEError {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';
|
||||
this.message = 'signature verification failed';
|
||||
}
|
||||
static get code() {
|
||||
return 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';
|
||||
}
|
||||
}
|
||||
exports.JWSSignatureVerificationFailed = JWSSignatureVerificationFailed;
|
||||
4
server/node_modules/jose/dist/node/cjs/util/runtime.js
generated
vendored
Normal file
4
server/node_modules/jose/dist/node/cjs/util/runtime.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const runtime_js_1 = require("../runtime/runtime.js");
|
||||
exports.default = runtime_js_1.default;
|
||||
Reference in New Issue
Block a user