fix: resolve remaining Kotlin compiler warnings in commons and cli

- Suppress DEPRECATION on REASONABLE_SIGN_KINDS, which intentionally lists the
  deprecated TorrentCommentEvent kind.
- Replace deprecated readLine() with readlnOrNull() in SecureKeyStorage.
- Drop unnecessary !! non-null assertions in KeyCommands and NostrConnect where
  the receiver is already smart-cast to non-null.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018nqdy4VTLKidUWzGTJPja9
This commit is contained in:
Claude
2026-07-07 21:39:04 +00:00
parent 560b95c2ec
commit 01d61b0851
4 changed files with 4 additions and 3 deletions
@@ -77,7 +77,7 @@ object KeyCommands {
Output.emit(mapOf("valid" to false))
return 0
}
val npub = hex!!.hexToByteArray().toNpub()
val npub = hex.hexToByteArray().toNpub()
Output.emit(mapOf("valid" to true, "pubkey" to hex, "npub" to npub))
return 0
}
@@ -81,7 +81,7 @@ object NostrConnect {
}
}
if (secret == null) return null
return Offer(clientPubkey, relays, secret!!, name)
return Offer(clientPubkey, relays, secret, name)
}
private fun buildOffer(
@@ -185,6 +185,7 @@ class NostrSignerPermissionLedger(
* Deliberately conservative: when a kind's blast radius is unclear, it is left out so the user
* is asked rather than surprised.
*/
@Suppress("DEPRECATION") // TorrentCommentEvent is deprecated (NIP-22) but still a reasonable sign kind
val REASONABLE_SIGN_KINDS: Set<Int> =
setOf(
TextNoteEvent.KIND, // 1 — short text notes & replies
@@ -324,7 +324,7 @@ actual class SecureKeyStorage private actual constructor() {
} else {
// Fallback for non-interactive environments (testing, etc.)
print("Enter master password: ")
readLine() ?: throw SecureStorageException("Password required for fallback storage")
readlnOrNull() ?: throw SecureStorageException("Password required for fallback storage")
}
}
return fallbackPassword!!