Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3523542
D8996.id30475.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D8996.id30475.diff
View Options
diff --git a/native/backup/api.js b/native/backup/api.js
--- a/native/backup/api.js
+++ b/native/backup/api.js
@@ -103,4 +103,30 @@
return getBackupBytesFromBlob(blob);
}
-export { uploadBackup, getBackupID, getUserKeysAuth };
+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, { backup_id: 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, getUserKeysAuth, getUserData };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 9:35 AM (3 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2699461
Default Alt Text
D8996.id30475.diff (1 KB)
Attached To
Mode
D8996: [client-backup] implement API call to get UserData
Attached
Detach File
Event Timeline
Log In to Comment