Skip to content

Create and validate hashes pushed by OpenID Connect providers to ID Tokens.

License

Notifications You must be signed in to change notification settings

nagyistge/oidc-token-hash

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oidc-token-hash

build dependencies npm licence

oidc-token-hash validates (and generates) ID Token claims like at_hash or c_hash for OpenID Clients and Providers.

Usage

Validating

const oidcTokenHash = require('oidc-token-hash');

const at_hash = 'x7vk7f6BvQj0jQHYFIk4ag';
const access_token = 'YmJiZTAwYmYtMzgyOC00NzhkLTkyOTItNjJjNDM3MGYzOWIy9sFhvH8K_x8UIHj1osisS57f5DduL-ar_qw5jl3lthwpMjm283aVMQXDmoqqqydDSqJfbhptzw8rUVwkuQbolw';

oidcTokenHash(at_hash, access_token); // => true
oidcTokenHash(at_hash, 'foobar'); // => false
oidcTokenHash.valid('foobar', access_token); // => false

Generating

// access_token from first example
oidcTokenHash.generate(access_token); // => 'x7vk7f6BvQj0jQHYFIk4ag'
oidcTokenHash.generate(access_token, 384); // => 'ups_76_7CCye_J1WIyGHKVG7AAs2olYm'
oidcTokenHash.generate(access_token, 512); // => 'EGEAhGYyfuwDaVTifvrWSoD5MSy_5hZPy6I7Vm-7pTQ'

About

Create and validate hashes pushed by OpenID Connect providers to ID Tokens.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%