Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

oidc-token-hash

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oidc-token-hash

Create and validate ID Token hashes from OpenID Connect providers.

  • 3.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2M
decreased by-5.34%
Maintainers
1
Weekly downloads
 
Created
Source

oidc-token-hash

build codecov

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

Usage

Validating

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

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

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

Generating

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

Changelog

  • 3.0.1 - base64url comeback
  • 3.0.0 - drop lts/4 support, replace base64url dependency
  • 2.0.0 - rather then assuming the alg based on the hash length #valid() now requires a third argument with the JOSE header alg value, resulting in strict validation
  • 1.0.0 - initial release

Keywords

FAQs

Package last updated on 17 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc