Page MenuHomePhabricator

D8996.id30675.diff
No OneTemporary

D8996.id30675.diff

diff --git a/native/backup/api.js b/native/backup/api.js
--- a/native/backup/api.js
+++ b/native/backup/api.js
@@ -99,4 +99,30 @@
return getBackupBytesFromBlob(blob);
}
-export { uploadBackup, getBackupID, getUserKeys };
+async function getUserData(
+ backupID: string,
+ auth: BackupAuth,
+): Promise<Uint8Array> {
+ const authHeader = getBackupAuthorizationHeader(auth);
+
+ const getUserDataEndpoint = backupService.httpEndpoints.GET_USER_DATA;
+ const getUserDataResponse = await fetch(
+ makeBackupServiceEndpointURL(getUserDataEndpoint, { backupID }),
+ {
+ method: getUserDataEndpoint.method,
+ headers: {
+ Authorization: authHeader,
+ },
+ },
+ );
+
+ if (!getUserDataResponse.ok) {
+ const { status, statusText } = getUserDataResponse;
+ throw new Error(`Server responded with HTTP ${status}: ${statusText}`);
+ }
+
+ const blob = await getUserDataResponse.blob();
+ return getBackupBytesFromBlob(blob);
+}
+
+export { uploadBackup, getBackupID, getUserKeys, getUserData };

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 8:07 AM (3 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2698485
Default Alt Text
D8996.id30675.diff (1 KB)

Event Timeline