From 8479fcfddad4ec12692b45783e532afba737113d Mon Sep 17 00:00:00 2001 From: ivanovSPvirtru Date: Fri, 8 Sep 2023 11:36:14 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20=F0=9F=8E=A8=20Autoformat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: sivanov --- lib/tdf3/src/binary.ts | 8 ++++---- lib/tdf3/src/tdf.ts | 5 +---- lib/tdf3/src/utils/index.ts | 6 +++++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/tdf3/src/binary.ts b/lib/tdf3/src/binary.ts index 74174a0d..bb7771cc 100644 --- a/lib/tdf3/src/binary.ts +++ b/lib/tdf3/src/binary.ts @@ -106,7 +106,7 @@ class ArrayBufferBinary extends Binary { override asHex(): string { return Array.from(new Uint8Array(this.value)) - .map(byte => byte.toString(16).padStart(2, '0')) + .map((byte) => byte.toString(16).padStart(2, '0')) .join(''); } @@ -152,7 +152,7 @@ class ByteArrayBinary extends Binary { } override asHex(): string { - return this.value.map(byte => byte.toString(16).padStart(2, '0')).join(''); + return this.value.map((byte) => byte.toString(16).padStart(2, '0')).join(''); } override isByteArray(): boolean { @@ -201,13 +201,13 @@ class StringBinary extends Binary { override asB64(): string { const uint8Array = new TextEncoder().encode(this.asString()); - const charArray = Array.from(uint8Array, byte => String.fromCharCode(byte)); + const charArray = Array.from(uint8Array, (byte) => String.fromCharCode(byte)); return btoa(charArray.join('')); } override asHex(): string { return Array.from(new TextEncoder().encode(this.value)) - .map(byte => byte.toString(16).padStart(2, '0')) + .map((byte) => byte.toString(16).padStart(2, '0')) .join(''); } diff --git a/lib/tdf3/src/tdf.ts b/lib/tdf3/src/tdf.ts index d7c1f6d2..f125510d 100644 --- a/lib/tdf3/src/tdf.ts +++ b/lib/tdf3/src/tdf.ts @@ -476,10 +476,7 @@ export class TDF extends EventEmitter { return hex.encodeArrayBuffer(new Uint8Array(payloadBinary.asByteArray()).slice(-16).buffer); case 'hs256': // simple hmac is the default - return await this.cryptoService.hmac( - unwrappedKeyBinary.asHex(), - payloadBinary.asString() - ); + return await this.cryptoService.hmac(unwrappedKeyBinary.asHex(), payloadBinary.asString()); default: throw new IllegalArgumentError(`Unsupported signature alg [${algorithmType}]`); } diff --git a/lib/tdf3/src/utils/index.ts b/lib/tdf3/src/utils/index.ts index e73e6baa..5a0c24c1 100644 --- a/lib/tdf3/src/utils/index.ts +++ b/lib/tdf3/src/utils/index.ts @@ -11,7 +11,11 @@ export function base64ToBuffer(b64: string): Uint8Array { } export function bufferToBase64(slice: Uint8Array) { - return btoa(Array.from(slice).map(byte => String.fromCharCode(byte)).join('')); + return btoa( + Array.from(slice) + .map((byte) => String.fromCharCode(byte)) + .join('') + ); } export function isAppIdProviderCheck(