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

35
node_modules/jose/lib/help/get_key.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
const errors = require('../errors')
const Key = require('../jwk/key/base')
const importKey = require('../jwk/import')
const { KeyStore } = require('../jwks/keystore')
module.exports = (input, keyStoreAllowed = false) => {
if (input instanceof Key) {
return input
}
if (input instanceof KeyStore) {
if (!keyStoreAllowed) {
throw new TypeError('key argument for this operation must not be a JWKS.KeyStore instance')
}
return input
}
try {
return importKey(input)
} catch (err) {
if (err instanceof errors.JOSEError && !(err instanceof errors.JWKImportFailed)) {
throw err
}
let msg
if (keyStoreAllowed) {
msg = 'key must be an instance of a key instantiated by JWK.asKey, a valid JWK.asKey input, or a JWKS.KeyStore instance'
} else {
msg = 'key must be an instance of a key instantiated by JWK.asKey, or a valid JWK.asKey input'
}
throw new TypeError(msg)
}
}