Skip to content

Commit

Permalink
fix: detect wvd automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalygashkov committed Dec 29, 2024
1 parent defcb4d commit b2da0d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b2da0d6

Please sign in to comment.