diff options
| author | Your Name <you@example.com> | 2026-05-27 17:05:56 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-27 17:05:56 +0530 |
| commit | 9869113e1eb4ba76b6b85e09c72d6ec83620d8ae (patch) | |
| tree | 7d4eff447c9e74b66c2eb050d845fbccbaf96cc6 /src | |
| parent | ed07956521a0edc25cc44b73fbd267fc2763fdac (diff) | |
Fix borrow checker: clone npub before move, capture secret before dropping guard
Diffstat (limited to 'src')
| -rw-r--r-- | src/nip46.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nip46.rs b/src/nip46.rs index 04e3036..ecbde2b 100644 --- a/src/nip46.rs +++ b/src/nip46.rs | |||
| @@ -66,7 +66,7 @@ impl Nip46Client { | |||
| 66 | let records = self.db.get_all_nip46_sessions().await?; | 66 | let records = self.db.get_all_nip46_sessions().await?; |
| 67 | let existing: HashMap<String, _> = records | 67 | let existing: HashMap<String, _> = records |
| 68 | .into_iter() | 68 | .into_iter() |
| 69 | .map(|r| (r.npub, r)) | 69 | .map(|r| (r.npub.clone(), r)) |
| 70 | .collect(); | 70 | .collect(); |
| 71 | 71 | ||
| 72 | for pk in npubs { | 72 | for pk in npubs { |
| @@ -215,6 +215,7 @@ impl Nip46Client { | |||
| 215 | ResponseResult::GetPublicKey(pk) => { | 215 | ResponseResult::GetPublicKey(pk) => { |
| 216 | let pk_hex = session.npub.to_hex(); | 216 | let pk_hex = session.npub.to_hex(); |
| 217 | let signer_hex = pk.to_hex(); | 217 | let signer_hex = pk.to_hex(); |
| 218 | let client_secret_hex = session.client_keys.secret_key().to_secret_hex(); | ||
| 218 | 219 | ||
| 219 | tracing::info!( | 220 | tracing::info!( |
| 220 | npub = %pk_hex, | 221 | npub = %pk_hex, |
| @@ -232,7 +233,7 @@ impl Nip46Client { | |||
| 232 | let _ = db | 233 | let _ = db |
| 233 | .upsert_nip46_session( | 234 | .upsert_nip46_session( |
| 234 | &pk_hex, | 235 | &pk_hex, |
| 235 | &session.client_keys.secret_key().to_secret_hex(), | 236 | &client_secret_hex, |
| 236 | Some(&signer_hex), | 237 | Some(&signer_hex), |
| 237 | true, | 238 | true, |
| 238 | ) | 239 | ) |