From a616e67eefe4201b28683b91d78398d95877db32 Mon Sep 17 00:00:00 2001 From: David Mihalcik Date: Mon, 21 Oct 2024 20:19:15 -0400 Subject: [PATCH] fix(sdk): Remove stray call to node:Buffer --- lib/tdf3/src/models/assertion.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tdf3/src/models/assertion.ts b/lib/tdf3/src/models/assertion.ts index dc08b08c..89a3ee12 100644 --- a/lib/tdf3/src/models/assertion.ts +++ b/lib/tdf3/src/models/assertion.ts @@ -2,6 +2,7 @@ import { canonicalizeEx } from 'json-canonicalize'; import { SignJWT, jwtVerify } from 'jose'; import { AssertionKey } from './../client/AssertionConfig.js'; import { ConfigurationError, InvalidFileError } from '../../../src/errors.js'; +import { hex } from 'src/encodings/index.js'; export type AssertionKeyAlg = 'RS256' | 'HS256'; export type AssertionType = 'handling' | 'other'; @@ -47,7 +48,7 @@ export async function hash(this: Assertion): Promise { const result = canonicalizeEx(this, { exclude: ['binding', 'hash', 'sign', 'verify'] }); const hash = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(result)); - return Buffer.from(hash).toString('hex'); + return hex.encodeArrayBuffer(hash); } /**