hmac_digest.js 406 B

12345678910111213
  1. import { JOSENotSupported } from '../util/errors.js';
  2. export default function hmacDigest(alg) {
  3. switch (alg) {
  4. case 'HS256':
  5. return 'sha256';
  6. case 'HS384':
  7. return 'sha384';
  8. case 'HS512':
  9. return 'sha512';
  10. default:
  11. throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
  12. }
  13. }