From e7b2cc9df1f486ca35e1368779044af55843b015 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Sun, 25 Dec 2022 15:16:14 -0800 Subject: [PATCH] hack: trim whitespace on stored keys Noticed a crash when I accidently logged in with whitespace in the keys. We should probably not save keys with whitespace in them, this is just a hack for now. --- damus/Util/Keys.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/damus/Util/Keys.swift b/damus/Util/Keys.swift index 9bc318a8..6f797f83 100644 --- a/damus/Util/Keys.swift +++ b/damus/Util/Keys.swift @@ -133,7 +133,8 @@ func get_saved_pubkey() -> String? { } func get_saved_privkey() -> String? { - try? Vault.getPrivateKey(keychainConfiguration: DamusKeychainConfiguration()) + let mkey = try? Vault.getPrivateKey(keychainConfiguration: DamusKeychainConfiguration()); + return mkey.map { $0.trimmingCharacters(in: .whitespaces) } } fileprivate func removePrivateKeyFromUserDefaults() throws {