Changeset View
Changeset View
Standalone View
Standalone View
native/media/encryption-utils.js
Show First 20 Lines • Show All 262 Lines • ▼ Show 20 Lines | let success = true, | ||||
exceptionMessage; | exceptionMessage; | ||||
const steps: DecryptFileStep[] = []; | const steps: DecryptFileStep[] = []; | ||||
// Step 1. Fetch the file and convert it to a Uint8Array | // Step 1. Fetch the file and convert it to a Uint8Array | ||||
const fetchStartTime = Date.now(); | const fetchStartTime = Date.now(); | ||||
let data; | let data; | ||||
try { | try { | ||||
const response = await fetch(getFetchableURI(holder)); | const response = await fetch(getFetchableURI(holder)); | ||||
if (!response.ok) { | |||||
throw new Error(`HTTP error ${response.status}: ${response.statusText}`); | |||||
} | |||||
const buf = await response.arrayBuffer(); | const buf = await response.arrayBuffer(); | ||||
data = new Uint8Array(buf); | data = new Uint8Array(buf); | ||||
} catch (e) { | } catch (e) { | ||||
success = false; | success = false; | ||||
exceptionMessage = getMessageForException(e); | exceptionMessage = getMessageForException(e); | ||||
} | } | ||||
steps.push({ | steps.push({ | ||||
step: 'fetch_file', | step: 'fetch_file', | ||||
▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines |