Skip to content

Commit

Permalink
feat(core/utils): error on unlock with empty device_bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
steveej committed Sep 4, 2024
1 parent fb9f0ab commit b82bebd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ pub async fn get_seed_from_locked_device_bundle(

/// unlock seed_bundles to access the pub-key and seed
pub async fn unlock(device_bundle: &str, passphrase: &str) -> SeedExplorerResult<SigningKey> {
if device_bundle.is_empty() {
return Err(SeedExplorerError::Generic(
"called with device_bundle".into(),
));
}

let cipher = base64::decode_config(device_bundle, base64::URL_SAFE_NO_PAD)?;
match UnlockedSeedBundle::from_locked(&cipher).await?.remove(0) {
LockedSeedCipher::PwHash(cipher) => {
Expand Down

0 comments on commit b82bebd

Please sign in to comment.