Use the PublicKey type for public keys in the database#1291
Use the PublicKey type for public keys in the database#1291robinlinden wants to merge 1 commit intoevilcorpltd:masterfrom
Conversation
| value class PublicKey(private val value: String) { | ||
| fun bytes() = hexToBytes(value) | ||
| fun string() = value | ||
| fun fingerprint() = value.take(8) |
Check warning
Code scanning / detekt
Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning
| private val viewModel: ChatViewModel by viewModels { vmFactory } | ||
|
|
||
| private lateinit var contactPubKey: String | ||
| private var contactPubKey = PublicKey("") |
There was a problem hiding this comment.
It's a bit strange that the empty string is a valid public key, but ok.
There was a problem hiding this comment.
Yeah, this one made me sad. No way to have a lateinit value class apparently. I'll clean these things up once I add a require in the PublicKey-ctor to require all pks to be valid pks. :/
| @@ -1,4 +1,4 @@ | |||
| // SPDX-FileCopyrightText: 2019-2020 aTox contributors | |||
| // SPDX-FileCopyrightText: 2019-2025 Robin Lindén <dev@robinlinden.eu> | |||
There was a problem hiding this comment.
Only you now? :P no more contributors.
There was a problem hiding this comment.
Yeah, it was always just me in this file, but I set all files to "aTox contributors" in the script that added them. :( I add back myself as I touch files.
86fef43 to
bb6a698
Compare
This means a lot of conversions go away.
bb6a698 to
9dee188
Compare
No description provided.