mirror of
https://github.com/danbulant/jose
synced 2026-05-24 20:41:46 +00:00
BREAKING CHANGE: Revised, Promise-based API BREAKING CHANGE: No dependencies BREAKING CHANGE: Browser support (using [Web Cryptography API](https://www.w3.org/TR/WebCryptoAPI/)) BREAKING CHANGE: Support for verification using a remote JWKS endpoint BREAKING CHANGE: Experimental Node.js libuv thread pool based runtime (non-blocking 🎉)
29 lines
555 B
TypeScript
29 lines
555 B
TypeScript
import { JOSENotSupported } from '../../util/errors.js'
|
|
|
|
export default function dsaDigest(alg: string) {
|
|
switch (alg) {
|
|
case 'PS256':
|
|
case 'RS256':
|
|
case 'ES256':
|
|
case 'ES256K':
|
|
return 'sha256'
|
|
|
|
case 'PS384':
|
|
case 'RS384':
|
|
case 'ES384':
|
|
return 'sha384'
|
|
|
|
case 'PS512':
|
|
case 'RS512':
|
|
case 'ES512':
|
|
return 'sha512'
|
|
|
|
case 'EdDSA':
|
|
return undefined
|
|
|
|
default:
|
|
throw new JOSENotSupported(
|
|
`alg ${alg} is unsupported either by JOSE or your javascript runtime`,
|
|
)
|
|
}
|
|
}
|