swc/bundler/tests/.cache/deno/912159cca395c89550a8bf4dd96c59caa7a0491c.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

17 lines
596 B
TypeScript

// Loaded from https://deno.land/x/djwt@v1.9/_algorithm.ts
/*
* JSW §1: Cryptographic algorithms and identifiers for use with this specification
* are described in the separate JSON Web Algorithms (JWA) specification:
* https://www.rfc-editor.org/rfc/rfc7518
*/
export type Algorithm = "none" | "HS256" | "HS512" | "RS256";
export type AlgorithmInput = Algorithm | Array<Exclude<Algorithm, "none">>;
export function verify(algorithm: AlgorithmInput, jwtAlg: string): boolean {
return Array.isArray(algorithm)
? (algorithm as string[]).includes(jwtAlg)
: algorithm === jwtAlg;
}