REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.19 KB
Close
/home/byroehnu/easepay.easetack.com/node_modules/jsonwebtoken/lib/validateAsymmetricKey.js
Text
Base64
const ASYMMETRIC_KEY_DETAILS_SUPPORTED = require('./asymmetricKeyDetailsSupported'); const RSA_PSS_KEY_DETAILS_SUPPORTED = require('./rsaPssKeyDetailsSupported'); const allowedAlgorithmsForKeys = { 'ec': ['ES256', 'ES384', 'ES512'], 'rsa': ['RS256', 'PS256', 'RS384', 'PS384', 'RS512', 'PS512'], 'rsa-pss': ['PS256', 'PS384', 'PS512'] }; const allowedCurves = { ES256: 'prime256v1', ES384: 'secp384r1', ES512: 'secp521r1', }; module.exports = function(algorithm, key) { if (!algorithm || !key) return; const keyType = key.asymmetricKeyType; if (!keyType) return; const allowedAlgorithms = allowedAlgorithmsForKeys[keyType]; if (!allowedAlgorithms) { throw new Error(`Unknown key type "${keyType}".`); } if (!allowedAlgorithms.includes(algorithm)) { throw new Error(`"alg" parameter for "${keyType}" key type must be one of: ${allowedAlgorithms.join(', ')}.`) } /* * Ignore the next block from test coverage because it gets executed * conditionally depending on the Node version. Not ignoring it would * prevent us from reaching the target % of coverage for versions of * Node under 15.7.0. */ /* istanbul ignore next */ if (ASYMMETRIC_KEY_DETAILS_SUPPORTED) { switch (keyType) { case 'ec': const keyCurve = key.asymmetricKeyDetails.namedCurve; const allowedCurve = allowedCurves[algorithm]; if (keyCurve !== allowedCurve) { throw new Error(`"alg" parameter "${algorithm}" requires curve "${allowedCurve}".`); } break; case 'rsa-pss': if (RSA_PSS_KEY_DETAILS_SUPPORTED) { const length = parseInt(algorithm.slice(-3), 10); const { hashAlgorithm, mgf1HashAlgorithm, saltLength } = key.asymmetricKeyDetails; if (hashAlgorithm !== `sha${length}` || mgf1HashAlgorithm !== hashAlgorithm) { throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${algorithm}.`); } if (saltLength !== undefined && saltLength > length >> 3) { throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${algorithm}.`) } } break; } } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 9
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
.htaccess
127 B
lr--r--r--
2026-03-14 01:49:13
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
asymmetricKeyDetailsSupported.js
99 B
lrw-r--r--
2026-02-03 15:06:12
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
JsonWebTokenError.js
428 B
lrw-r--r--
2026-02-03 15:06:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
NotBeforeError.js
362 B
lrw-r--r--
2026-02-03 15:06:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
psSupported.js
107 B
lrw-r--r--
2026-02-03 15:06:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rsaPssKeyDetailsSupported.js
99 B
lrw-r--r--
2026-02-03 15:06:16
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
timespan.js
412 B
lrw-r--r--
2026-02-03 15:06:16
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TokenExpiredError.js
395 B
lrw-r--r--
2026-02-03 15:06:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
validateAsymmetricKey.js
2.19 KB
lrw-r--r--
2026-02-03 15:06:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).