Skip to content

Commit

Permalink
chore: temp code for hmac debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Dec 11, 2024
1 parent 153c1f4 commit 506414d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/jwt-service/src/functions/JWE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ export class CompactJwtEncrypter implements JweEncrypter {
const iv = base64ToBytes(ivB64)
const ciphertext = base64ToBytes(ciphertextB64)

if (this._alg?.startsWith('ECDH')) {
const derivedKey = await deriveEcdhKey(this.recipientKey as CryptoKey)
if (this._alg?.startsWith('ECDH') && '_import' in this.recipientKey) {
const derivedKey = await deriveEcdhKey(this.recipientKey)
verifyHmacEcdh(iv, ciphertext, derivedKey)
}

Expand Down Expand Up @@ -388,7 +388,7 @@ export function toWebCryptoCiphertext(ciphertext: string, tag: string): Uint8Arr
}


async function deriveEcdhKey(publicKey: jose.KeyLike): Promise<Uint8Array> {
async function deriveEcdhKey(publicKey: any): Promise<Uint8Array> {
const keyData = (publicKey as any)._import.keyData
if (!keyData.x || !keyData.y) {
throw new Error('Invalid public key format')
Expand Down

0 comments on commit 506414d

Please sign in to comment.