Skip to content

Commit b82bebd

Browse files
committed
feat(core/utils): error on unlock with empty device_bundle
1 parent fb9f0ab commit b82bebd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/src/utils.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ pub async fn get_seed_from_locked_device_bundle(
8989

9090
/// unlock seed_bundles to access the pub-key and seed
9191
pub async fn unlock(device_bundle: &str, passphrase: &str) -> SeedExplorerResult<SigningKey> {
92+
if device_bundle.is_empty() {
93+
return Err(SeedExplorerError::Generic(
94+
"called with device_bundle".into(),
95+
));
96+
}
97+
9298
let cipher = base64::decode_config(device_bundle, base64::URL_SAFE_NO_PAD)?;
9399
match UnlockedSeedBundle::from_locked(&cipher).await?.remove(0) {
94100
LockedSeedCipher::PwHash(cipher) => {

0 commit comments

Comments
 (0)