Page MenuHomePhabricator

D8996.id.diff
No OneTemporary

D8996.id.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
Sat, Sep 28, 11:26 PM (17 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2192548
Default Alt Text
D8996.id.diff (1 KB)

Event Timeline