fix: privatekey update actually creates a new key (#541)

Fixes #540
This commit is contained in:
lollipopkit🏳️‍⚧️
2024-08-16 21:00:34 +08:00
committed by GitHub
parent 7558b4806d
commit ef297673f3
9 changed files with 12 additions and 34 deletions

View File

@@ -203,8 +203,9 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage> {
try {
final decrypted = await Computer.shared.start(decyptPem, [key, pwd]);
final pki = PrivateKeyInfo(id: name, key: decrypted);
if (widget.pki != null) {
PrivateKeyProvider.update(widget.pki!, pki);
final originPki = widget.pki;
if (originPki != null) {
PrivateKeyProvider.update(originPki, pki);
} else {
PrivateKeyProvider.add(pki);
}