@@ -619,7 +619,7 @@ export async function writeStream(cfg: EncryptConfiguration): Promise<DecoratedR
619
619
let bytesProcessed = 0 ;
620
620
let crcCounter = 0 ;
621
621
let fileByteCount = 0 ;
622
- let segmentHashList :Uint8Array [ ] = [ ] ;
622
+ let segmentHashList : Uint8Array [ ] = [ ] ;
623
623
624
624
const zipWriter = new ZipWriter ( ) ;
625
625
const manifest = await _generateManifest (
@@ -852,7 +852,7 @@ export async function writeStream(cfg: EncryptConfiguration): Promise<DecoratedR
852
852
cfg . segmentIntegrityAlgorithm ,
853
853
cfg . cryptoService
854
854
) ;
855
-
855
+
856
856
const payloadSig = hex . decodeArrayBuffer ( payloadSigInHex ) ;
857
857
segmentHashList . push ( new Uint8Array ( payloadSig ) ) ;
858
858
@@ -1087,8 +1087,9 @@ async function decryptChunk(
1087
1087
cryptoService
1088
1088
) ;
1089
1089
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 ) ) ) ) ;
1092
1093
1093
1094
if ( hash !== segmentHash ) {
1094
1095
throw new IntegrityError ( 'Failed integrity check on segment hash' ) ;
@@ -1104,7 +1105,7 @@ async function updateChunkQueue(
1104
1105
cipher : SymmetricCipher ,
1105
1106
segmentIntegrityAlgorithm : IntegrityAlgorithm ,
1106
1107
cryptoService : CryptoService ,
1107
- isLegacyTDF : boolean ,
1108
+ isLegacyTDF : boolean
1108
1109
) {
1109
1110
const chunksInOneDownload = 500 ;
1110
1111
let requests = [ ] ;
@@ -1145,7 +1146,7 @@ async function updateChunkQueue(
1145
1146
slice,
1146
1147
cipher,
1147
1148
segmentIntegrityAlgorithm,
1148
- isLegacyTDF
1149
+ isLegacyTDF,
1149
1150
} ) ;
1150
1151
}
1151
1152
} ) ( )
@@ -1160,7 +1161,7 @@ export async function sliceAndDecrypt({
1160
1161
cipher,
1161
1162
cryptoService,
1162
1163
segmentIntegrityAlgorithm,
1163
- isLegacyTDF
1164
+ isLegacyTDF,
1164
1165
} : {
1165
1166
buffer : Uint8Array ;
1166
1167
reconstructedKeyBinary : Binary ;
@@ -1187,7 +1188,7 @@ export async function sliceAndDecrypt({
1187
1188
cipher ,
1188
1189
segmentIntegrityAlgorithm ,
1189
1190
cryptoService ,
1190
- isLegacyTDF ,
1191
+ isLegacyTDF
1191
1192
) ;
1192
1193
slice [ index ] . decryptedChunk = result ;
1193
1194
if ( _resolve ) {
@@ -1245,22 +1246,21 @@ export async function readStream(cfg: DecryptConfiguration) {
1245
1246
throw new UnsupportedError ( `Unsupported integrity alg [${ integrityAlgorithm } ]` ) ;
1246
1247
}
1247
1248
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 ) ;
1250
1252
const payloadSigInHex = await getSignature (
1251
1253
keyForDecryption ,
1252
1254
payloadForSigCalculation ,
1253
1255
integrityAlgorithm ,
1254
- cfg . cryptoService ,
1256
+ cfg . cryptoService
1255
1257
) ;
1256
1258
1257
- const rootSig = isLegacyTDF ? base64 . encode ( payloadSigInHex )
1259
+ const rootSig = isLegacyTDF
1260
+ ? base64 . encode ( payloadSigInHex )
1258
1261
: base64 . encodeArrayBuffer ( hex . decodeArrayBuffer ( payloadSigInHex ) ) ;
1259
1262
1260
- if (
1261
- manifest . encryptionInformation . integrityInformation . rootSignature . sig !==
1262
- rootSig
1263
- ) {
1263
+ if ( manifest . encryptionInformation . integrityInformation . rootSignature . sig !== rootSig ) {
1264
1264
throw new IntegrityError ( 'Failed integrity check on root signature' ) ;
1265
1265
}
1266
1266
@@ -1320,7 +1320,7 @@ export async function readStream(cfg: DecryptConfiguration) {
1320
1320
cipher ,
1321
1321
segmentIntegrityAlg ,
1322
1322
cfg . cryptoService ,
1323
- isLegacyTDF ,
1323
+ isLegacyTDF
1324
1324
) ;
1325
1325
1326
1326
let progress = 0 ;
@@ -1365,4 +1365,4 @@ async function concatenateUint8Array(uint8arrays: Uint8Array[]): Promise<Uint8Ar
1365
1365
1366
1366
// Convert that ArrayBuffer to a Uint8Array.
1367
1367
return new Uint8Array ( buffer ) ;
1368
- }
1368
+ }
0 commit comments