This diff modifies native rust code to attach backup message to upload request provided the file exists.
Details
For now test that backup upload works for password users. Very next diff will enable testing for SIWE users with just one button click
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
I think you should rename the generic backup_message to siwe_backup_message
LGTM but maybe @bartek could double check Rust code
native/native_rust_library/src/backup.rs | ||
---|---|---|
55–66 ↗ | (On Diff #39388) | I think this could be simplified a bit |
shared/backup_client/src/lib.rs | ||
74–77 ↗ | (On Diff #39388) | but you'll have to make form mutable |
native/backup/use-client-backup.js | ||
---|---|---|
54 ↗ | (On Diff #39388) | is there a way to make it nullable to avoid mocking with an empty string? |
native/backup/use-client-backup.js | ||
---|---|---|
54 ↗ | (On Diff #39388) | Actually this is a bit problematic. We can change the types so that user passes undefined or null instead of empty string. However the user MUST explicitly pass undefined or null - otherwise JSI will crash. Unfortunately if we change the type in CommCoreModuleJSISchema.js to sth like this: +createNewBackup: ( backupSecret: string, siweBackupMsg: ?string, ) => Promise<void>; Flow won't complain if the user doesn't undefined explicitly so it won't prevent potential crash. Therefore it is best to create new JSI specifically for siwe backup creation. P.S. JSI crashes since it accesses arguments by accessing array. So if the user doesn't provide anything for backup message JSI will try to access out of array bounds. |
- Rename msg_backup to siwe_backup_msg
- Introcuce separate backup creation JSI calls for SIWE and password users to avoid macking empty string or potential crashes if dev forgets to specify null