@@ -36,9 +36,9 @@ export type VaultStorage = KeyStorage & {
36
36
delete ( kind : VaultStorageKind , uid : string ) : Promise < void >
37
37
}
38
38
39
- export type VaultStorageData = DContinuationToken | DRecord | DRecordMetadata | DRecordNonSharedData | DTeam | DSharedFolder | DSharedFolderUser | DSharedFolderTeam | DSharedFolderRecord | DSharedFolderFolder | DUserFolder | DProfile | DReusedPasswords | DBWRecord | DBWSecurityData
39
+ export type VaultStorageData = DProfilePic | DContinuationToken | DRecord | DRecordMetadata | DRecordNonSharedData | DTeam | DSharedFolder | DSharedFolderUser | DSharedFolderTeam | DSharedFolderRecord | DSharedFolderFolder | DUserFolder | DProfile | DReusedPasswords | DBWRecord | DBWSecurityData
40
40
41
- export type VaultStorageKind = 'record' | 'metadata' | 'non_shared_data' | 'team' | 'shared_folder' | 'shared_folder_user' | 'shared_folder_team' | 'shared_folder_record' | 'shared_folder_folder' | 'user_folder' | 'profile' | 'continuationToken' | 'reused_passwords' | 'bw_record' | 'bw_security_data'
41
+ export type VaultStorageKind = 'profilePic' | ' record' | 'metadata' | 'non_shared_data' | 'team' | 'shared_folder' | 'shared_folder_user' | 'shared_folder_team' | 'shared_folder_record' | 'shared_folder_folder' | 'user_folder' | 'profile' | 'continuationToken' | 'reused_passwords' | 'bw_record' | 'bw_security_data'
42
42
43
43
export type VaultStorageResult < T extends VaultStorageKind > = (
44
44
T extends 'continuationToken' ? DContinuationToken :
@@ -166,6 +166,14 @@ export type DProfile = {
166
166
revision : number
167
167
}
168
168
169
+ export type DProfilePic = {
170
+ kind : 'profilePic'
171
+ data : {
172
+ url : string
173
+ revision : number
174
+ }
175
+ }
176
+
169
177
export type DBWRecord = {
170
178
kind : 'bw_record'
171
179
uid : string
@@ -664,6 +672,20 @@ const processProfile = async (profile: IProfile | null | undefined, storage: Vau
664
672
}
665
673
}
666
674
675
+ const processProfilePic = async ( profilePic , storage ) => {
676
+ try {
677
+ if ( ! profilePic )
678
+ return ;
679
+ await storage . put ( {
680
+ kind : 'profilePic' ,
681
+ data : profilePic ,
682
+ } ) ;
683
+ }
684
+ catch ( e : any ) {
685
+ console . error ( `Profile picture cannot be decrypted (${ e . message } )` ) ;
686
+ }
687
+ } ;
688
+
667
689
const processSharedFolderFolders = async ( folders : ISharedFolderFolder [ ] , storage : VaultStorage , dependencies : Dependencies ) => {
668
690
for ( const folder of folders as NN < ISharedFolderFolder > [ ] ) {
669
691
const sharedFolderUid = webSafe64FromBytes ( folder . sharedFolderUid )
@@ -1015,6 +1037,10 @@ export const syncDown = async (options: SyncDownOptions): Promise<SyncResult> =>
1015
1037
profiler ?. time ( 'processProfile' )
1016
1038
await processProfile ( resp . profile , storage )
1017
1039
profiler ?. timeEnd ( 'processProfile' )
1040
+
1041
+ profiler ?. time ( 'processProfilePic' )
1042
+ await processProfilePic ( resp . profilePic , storage ) ;
1043
+ profiler ?. timeEnd ( 'processProfilePic' )
1018
1044
1019
1045
profiler ?. time ( 'processBreachWatchRecords' )
1020
1046
await processBreachWatchRecords ( resp . breachWatchRecords , storage )
0 commit comments