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.8 to 7.3.0

2

dist/did-jwt.js.LICENSE.txt
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */

8

package.json
{
"name": "did-jwt",
"version": "7.2.8",
"version": "7.3.0",
"description": "Library for Signing and Verifying JWTs that use DIDs as issuers and JWEs that use DIDs as recipients",

@@ -56,2 +56,3 @@ "type": "module",

"@greymass/eosio": "^0.7.0",
"@jest/globals": "^29.7.0",
"@semantic-release/changelog": "6.0.3",

@@ -73,2 +74,3 @@ "@semantic-release/git": "10.0.1",

"jest": "29.6.4",
"jest-config": "^29.7.0",
"jsontokens": "4.0.1",

@@ -91,6 +93,6 @@ "jsonwebtoken": "9.0.2",

"dependencies": {
"@noble/ciphers": "^0.3.0",
"@noble/curves": "^1.0.0",
"@noble/hashes": "^1.3.0",
"@stablelib/xchacha20poly1305": "^1.0.1",
"bech32": "^2.0.0",
"@scure/base": "^1.1.3",
"canonicalize": "^2.0.0",

@@ -97,0 +99,0 @@ "did-resolver": "^4.1.0",

import { secp256k1 } from '@noble/curves/secp256k1'
import { bech32 } from 'bech32'
import { bech32 } from '@scure/base'
import { sha256, ripemd160 } from '../Digest.js'

@@ -4,0 +4,0 @@

import type { Decrypter, Encrypter, EncryptionResult, ProtectedHeader } from './types.js'
import { bytesToBase64url, encodeBase64url } from '../util.js'
import { fromString } from 'uint8arrays/from-string'
import { XChaCha20Poly1305 } from '@stablelib/xchacha20poly1305'
import { xchacha20poly1305 } from '@noble/ciphers/chacha'
import { randomBytes } from '@noble/hashes/utils'
export function xc20pEncrypter(key: Uint8Array): (cleartext: Uint8Array, aad?: Uint8Array) => EncryptionResult {
const cipher = new XChaCha20Poly1305(key)
return (cleartext: Uint8Array, aad?: Uint8Array) => {
const iv = randomBytes(cipher.nonceLength)
const sealed = cipher.seal(iv, cleartext, aad)
const iv = randomBytes(24)
const cipher = xchacha20poly1305(key, iv, aad)
const sealed = cipher.encrypt(cleartext)
return {
ciphertext: sealed.subarray(0, sealed.length - cipher.tagLength),
tag: sealed.subarray(sealed.length - cipher.tagLength),
ciphertext: sealed.subarray(0, sealed.length - 16),
tag: sealed.subarray(sealed.length - 16),
iv,

@@ -42,6 +42,8 @@ }

export function xc20pDirDecrypter(key: Uint8Array): Decrypter {
const cipher = new XChaCha20Poly1305(key)
async function decrypt(sealed: Uint8Array, iv: Uint8Array, aad?: Uint8Array): Promise<Uint8Array | null> {
return cipher.open(iv, sealed, aad)
try {
return xchacha20poly1305(key, iv, aad).decrypt(sealed)
} catch (error) {
return null
}
}

@@ -48,0 +50,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 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

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