Comparing version 7.2.8 to 7.3.0
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ | ||
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */ |
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15733
1204409
38
+ Added@noble/ciphers@^0.3.0
+ Added@scure/base@^1.1.3
+ Added@noble/ciphers@0.3.0(transitive)
+ Added@scure/base@1.2.1(transitive)
- Removed@stablelib/xchacha20poly1305@^1.0.1
- Removedbech32@^2.0.0
- Removed@stablelib/aead@1.0.1(transitive)
- Removed@stablelib/binary@1.0.1(transitive)
- Removed@stablelib/chacha@1.0.1(transitive)
- Removed@stablelib/chacha20poly1305@1.0.1(transitive)
- Removed@stablelib/constant-time@1.0.1(transitive)
- Removed@stablelib/int@1.0.1(transitive)
- Removed@stablelib/poly1305@1.0.1(transitive)
- Removed@stablelib/wipe@1.0.1(transitive)
- Removed@stablelib/xchacha20@1.0.1(transitive)
- Removed@stablelib/xchacha20poly1305@1.0.1(transitive)
- Removedbech32@2.0.0(transitive)