From b2da0d671f8b8a97b8a6f1646091c74d057f0e2d Mon Sep 17 00:00:00 2001 From: Vitaly Gashkov Date: Sun, 29 Dec 2024 21:47:13 +0500 Subject: [PATCH] fix: detect wvd automatically --- src/lib/client.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/client.ts b/src/lib/client.ts index d9cc47b..a67847f 100644 --- a/src/lib/client.ts +++ b/src/lib/client.ts @@ -42,7 +42,8 @@ export class Client { #key?: { forDecrypt: CryptoKey; forSign: CryptoKey }; static async fromPacked(data: Uint8Array, format: 'wvd' | 'azot' = 'azot') { - if (format === 'wvd') { + const isWvd = fromBuffer(data.slice(0, 3)).toText() == 'WVD'; + if (format === 'wvd' || isWvd) { const parsed = parseWvd(data); const pcks1 = `-----BEGIN RSA PRIVATE KEY-----\n${fromBuffer(parsed.privateKey).toBase64()}\n-----END RSA PRIVATE KEY-----`; const key = fromText(pcks1).toBuffer();