From 3d0b535ff6aa999d8d8f46254d346cabfea3d3c5 Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Fri, 30 Aug 2024 14:31:15 +0200 Subject: [PATCH] feat(core/utils): error on unlock with empty device_bundle --- core/src/utils.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/utils.rs b/core/src/utils.rs index 04446cf..22ab901 100644 --- a/core/src/utils.rs +++ b/core/src/utils.rs @@ -89,6 +89,10 @@ 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 { + if device_bundle.is_empty() { + bail!("called with device_bundle"); + } + let cipher = base64::decode_config(device_bundle, base64::URL_SAFE_NO_PAD)?; match UnlockedSeedBundle::from_locked(&cipher).await?.remove(0) { LockedSeedCipher::PwHash(cipher) => {