Commit 45e8cad
authored
[P2] Implement Backup & Recovery API Methods (#27)
* Implement backup & recovery API methods matching ZHTP node endpoints
Added missing getBackupStatus() method and fixed parameter/type mismatches:
- Added getBackupStatus(identityId) method for GET /api/v1/identity/backup/status
- Fixed exportBackup() and importBackup() to use 'passphrase' instead of 'password'
- Updated BackupData type to match node response: { backup_data, created_at }
- Updated SeedVerification type to match node response: { verified }
- Added ImportBackupResponse type for proper import response handling
- Added comprehensive tests for all backup/recovery methods
- Fixed existing tests to match updated parameter names and response types
All backup/recovery methods now match ZHTP node implementation exactly.
* Add security improvements and validation to backup/recovery methods
Addresses code review feedback by adding:
Security Documentation:
- Added comprehensive JSDoc comments with security warnings
- Documented rate limiting (3 attempts/hour for import/recovery)
- Added passphrase strength requirements
- Warned about sensitive data handling
Client-side Validation:
- exportBackup: Validates passphrase minimum 12 characters
- importBackup: Validates passphrase minimum 12 characters
- verifySeedPhrase: Validates seed phrase has exactly 12 words
Test Coverage:
- Added 4 new test cases for validation errors
- Tests for short passphrase rejection
- Tests for invalid seed phrase word count
All 63 tests passing. Ready for production use.1 parent 19fa5ba commit 45e8cad
File tree
11 files changed
+405
-57
lines changed- dist/core
- docs/testing
- src/core
11 files changed
+405
-57
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 252 | + | |
| 253 | + | |
259 | 254 | | |
260 | 255 | | |
261 | 256 | | |
| |||
265 | 260 | | |
266 | 261 | | |
267 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
268 | 271 | | |
269 | | - | |
270 | | - | |
271 | | - | |
| 272 | + | |
272 | 273 | | |
273 | 274 | | |
274 | 275 | | |
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
278 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
279 | 285 | | |
280 | 286 | | |
281 | 287 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments