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

did-jwt

Package Overview
Dependencies
Maintainers
6
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

did-jwt - npm Package Compare versions

Comparing version 7.2.2 to 7.2.3

src/__tests__/util.test.ts

4

lib/util.d.ts

@@ -31,3 +31,3 @@ import { bases } from 'multiformats/basics';

export declare function bytesToMultibase(b: Uint8Array, base: keyof typeof bases): string;
export declare function hexToBytes(s: string): Uint8Array;
export declare function hexToBytes(s: string, minLength?: number): Uint8Array;
export declare function encodeBase64url(s: string): string;

@@ -37,3 +37,3 @@ export declare function decodeBase64url(s: string): string;

export declare function bytesToBigInt(b: Uint8Array): bigint;
export declare function bigintToBytes(n: bigint): Uint8Array;
export declare function bigintToBytes(n: bigint, minLength?: number): Uint8Array;
export declare function stringToBytes(s: string): Uint8Array;

@@ -40,0 +40,0 @@ export declare function toJose({ r, s, recoveryParam }: EcdsaSignature, recoverable?: boolean): string;

{
"name": "did-jwt",
"version": "7.2.2",
"version": "7.2.3",
"description": "Library for Signing and Verifying JWTs that use DIDs as issuers and JWEs that use DIDs as recipients",

@@ -5,0 +5,0 @@ "type": "module",

@@ -214,4 +214,4 @@ // @ts-ignore

kty: 'EC',
x: bytesToBase64url(bigintToBytes(publicKeyPoint.x)),
y: bytesToBase64url(bigintToBytes(publicKeyPoint.y)),
x: bytesToBase64url(bigintToBytes(publicKeyPoint.x, 32)),
y: bytesToBase64url(bigintToBytes(publicKeyPoint.y, 32)),
}

@@ -218,0 +218,0 @@ const publicKeyMultibase = bytesToMultibase(publicKeyBytes, 'base58btc')

@@ -59,4 +59,14 @@ import { concat, fromString, toString } from 'uint8arrays'

export function hexToBytes(s: string): Uint8Array {
const input = s.startsWith('0x') ? s.substring(2) : s
export function hexToBytes(s: string, minLength?: number): Uint8Array {
let input = s.startsWith('0x') ? s.substring(2) : s
if (input.length % 2 !== 0) {
input = `0${input}`
}
if (minLength) {
const paddedLength = Math.max(input.length, minLength * 2)
input = input.padStart(paddedLength, '00')
}
return u8a.fromString(input.toLowerCase(), 'base16')

@@ -81,4 +91,4 @@ }

export function bigintToBytes(n: bigint): Uint8Array {
return u8a.fromString(n.toString(16), 'base16')
export function bigintToBytes(n: bigint, minLength?: number): Uint8Array {
return hexToBytes(n.toString(16), minLength)
}

@@ -85,0 +95,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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