commit e7b2cc9df1f486ca35e1368779044af55843b015
parent 8b7b77c2e82e3924527bdf4d0d24a652200d1741
Author: William Casarin <jb55@jb55.com>
Date: Sun, 25 Dec 2022 15:16:14 -0800
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.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git 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 {