feat(pubky): add recovery file generation and decryption

This commit is contained in:
nazeh
2024-08-03 16:33:38 +03:00
parent 5ee464a5b4
commit 11334bf81c
7 changed files with 129 additions and 13 deletions

View File

@@ -12,6 +12,22 @@ pub enum Error {
#[error("Generic error: {0}")]
Generic(String),
#[error("Could not resolve endpoint for {0}")]
ResolveEndpoint(String),
// === Recovery file ==
#[error("Recovery file should start with a spec line, followed by a new line character")]
RecoveryFileMissingSpecLine,
#[error("Recovery file should start with a spec line, followed by a new line character")]
RecoveryFileVersionNotSupported,
#[error("Recovery file should contain an encrypted secret key after the new line character")]
RecoverFileMissingEncryptedSecretKey,
#[error("Recovery file encrypted secret key should be 32 bytes, got {0}")]
RecoverFileInvalidSecretKeyLength(usize),
// === Transparent ===
#[error(transparent)]
Dns(#[from] SimpleDnsError),
@@ -28,8 +44,11 @@ pub enum Error {
#[error(transparent)]
Session(#[from] pubky_common::session::Error),
#[error("Could not resolve endpoint for {0}")]
ResolveEndpoint(String),
#[error(transparent)]
Crypto(#[from] pubky_common::crypto::Error),
#[error(transparent)]
Argon(#[from] argon2::Error),
}
#[cfg(target_arch = "wasm32")]