Skip to content

Commit 052af55

Browse files
sujankotagithub-actions[bot]
authored andcommitted
🤖 🎨 Autoformat
1 parent b2fce36 commit 052af55

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

‎lib/tdf3/src/models/manifest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export type Manifest = {
66
payload: Payload;
77
encryptionInformation: EncryptionInformation;
88
assertions: Assertion[];
9-
tdf_spec_version : string;
9+
tdf_spec_version: string;
1010
};

‎lib/tdf3/src/tdf.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ export async function writeStream(cfg: EncryptConfiguration): Promise<DecoratedR
619619
let bytesProcessed = 0;
620620
let crcCounter = 0;
621621
let fileByteCount = 0;
622-
let segmentHashList:Uint8Array[] = [];
622+
let segmentHashList: Uint8Array[] = [];
623623

624624
const zipWriter = new ZipWriter();
625625
const manifest = await _generateManifest(
@@ -852,7 +852,7 @@ export async function writeStream(cfg: EncryptConfiguration): Promise<DecoratedR
852852
cfg.segmentIntegrityAlgorithm,
853853
cfg.cryptoService
854854
);
855-
855+
856856
const payloadSig = hex.decodeArrayBuffer(payloadSigInHex);
857857
segmentHashList.push(new Uint8Array(payloadSig));
858858

@@ -1087,8 +1087,9 @@ async function decryptChunk(
10871087
cryptoService
10881088
);
10891089

1090-
const segmentHash = isLegacyTDF ? btoa(segmentHashAsHex) :
1091-
btoa(String.fromCharCode(...new Uint8Array(hex.decodeArrayBuffer(segmentHashAsHex))));
1090+
const segmentHash = isLegacyTDF
1091+
? btoa(segmentHashAsHex)
1092+
: btoa(String.fromCharCode(...new Uint8Array(hex.decodeArrayBuffer(segmentHashAsHex))));
10921093

10931094
if (hash !== segmentHash) {
10941095
throw new IntegrityError('Failed integrity check on segment hash');
@@ -1104,7 +1105,7 @@ async function updateChunkQueue(
11041105
cipher: SymmetricCipher,
11051106
segmentIntegrityAlgorithm: IntegrityAlgorithm,
11061107
cryptoService: CryptoService,
1107-
isLegacyTDF: boolean,
1108+
isLegacyTDF: boolean
11081109
) {
11091110
const chunksInOneDownload = 500;
11101111
let requests = [];
@@ -1145,7 +1146,7 @@ async function updateChunkQueue(
11451146
slice,
11461147
cipher,
11471148
segmentIntegrityAlgorithm,
1148-
isLegacyTDF
1149+
isLegacyTDF,
11491150
});
11501151
}
11511152
})()
@@ -1160,7 +1161,7 @@ export async function sliceAndDecrypt({
11601161
cipher,
11611162
cryptoService,
11621163
segmentIntegrityAlgorithm,
1163-
isLegacyTDF
1164+
isLegacyTDF,
11641165
}: {
11651166
buffer: Uint8Array;
11661167
reconstructedKeyBinary: Binary;
@@ -1187,7 +1188,7 @@ export async function sliceAndDecrypt({
11871188
cipher,
11881189
segmentIntegrityAlgorithm,
11891190
cryptoService,
1190-
isLegacyTDF,
1191+
isLegacyTDF
11911192
);
11921193
slice[index].decryptedChunk = result;
11931194
if (_resolve) {
@@ -1245,22 +1246,21 @@ export async function readStream(cfg: DecryptConfiguration) {
12451246
throw new UnsupportedError(`Unsupported integrity alg [${integrityAlgorithm}]`);
12461247
}
12471248

1248-
const payloadForSigCalculation = isLegacyTDF ? Binary.fromString(hex.encode(aggregateHash))
1249-
: Binary.fromString(aggregateHash);
1249+
const payloadForSigCalculation = isLegacyTDF
1250+
? Binary.fromString(hex.encode(aggregateHash))
1251+
: Binary.fromString(aggregateHash);
12501252
const payloadSigInHex = await getSignature(
12511253
keyForDecryption,
12521254
payloadForSigCalculation,
12531255
integrityAlgorithm,
1254-
cfg.cryptoService,
1256+
cfg.cryptoService
12551257
);
12561258

1257-
const rootSig = isLegacyTDF ? base64.encode(payloadSigInHex)
1259+
const rootSig = isLegacyTDF
1260+
? base64.encode(payloadSigInHex)
12581261
: base64.encodeArrayBuffer(hex.decodeArrayBuffer(payloadSigInHex));
12591262

1260-
if (
1261-
manifest.encryptionInformation.integrityInformation.rootSignature.sig !==
1262-
rootSig
1263-
) {
1263+
if (manifest.encryptionInformation.integrityInformation.rootSignature.sig !== rootSig) {
12641264
throw new IntegrityError('Failed integrity check on root signature');
12651265
}
12661266

@@ -1320,7 +1320,7 @@ export async function readStream(cfg: DecryptConfiguration) {
13201320
cipher,
13211321
segmentIntegrityAlg,
13221322
cfg.cryptoService,
1323-
isLegacyTDF,
1323+
isLegacyTDF
13241324
);
13251325

13261326
let progress = 0;
@@ -1365,4 +1365,4 @@ async function concatenateUint8Array(uint8arrays: Uint8Array[]): Promise<Uint8Ar
13651365

13661366
// Convert that ArrayBuffer to a Uint8Array.
13671367
return new Uint8Array(buffer);
1368-
}
1368+
}

0 commit comments

Comments
 (0)