UNPKG

jose

Version:

Universal 'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK with no dependencies

14 lines (13 loc) 404 B
import { JOSENotSupported } from '../util/errors.js'; export default function hmacDigest(alg) { switch (alg) { case 'HS256': return 'sha256'; case 'HS384': return 'sha384'; case 'HS512': return 'sha512'; default: throw new JOSENotSupported(`alg ${alg} is unsupported either by JOSE or your javascript runtime`); } }