Add node modules and compiled JavaScript from main (#54)

Co-authored-by: Oliver King <oking3@uncc.edu>
This commit is contained in:
github-actions[bot]
2022-06-29 15:41:55 -04:00
committed by GitHub
parent 4a983766a0
commit 52d71d28bd
6814 changed files with 2048539 additions and 2 deletions

30
node_modules/jose/lib/jwt/decode.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
const base64url = require('../help/base64url')
const errors = require('../errors')
module.exports = (token, { complete = false } = {}) => {
if (typeof token !== 'string' || !token) {
throw new TypeError('JWT must be a string')
}
const { 0: header, 1: payload, 2: signature, length } = token.split('.')
if (length === 5) {
throw new TypeError('encrypted JWTs cannot be decoded')
}
if (length !== 3) {
throw new errors.JWTMalformed('JWTs must have three components')
}
try {
const result = {
header: base64url.JSON.decode(header),
payload: base64url.JSON.decode(payload),
signature
}
return complete ? result : result.payload
} catch (err) {
throw new errors.JWTMalformed('JWT is malformed')
}
}