UNPKG

oidc-token-hash

Version:

oidc-token-hash validates (and generates) ID Token `_hash` claims such as `at_hash` or `c_hash`

8 lines (5 loc) 300 B
const crypto = require('crypto'); const [major, minor] = process.version.substring(1).split('.').map((x) => parseInt(x, 10)); const xofOutputLength = major > 12 || (major === 12 && minor >= 8); const shake256 = xofOutputLength && crypto.getHashes().includes('shake256'); module.exports = shake256;