-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the PublicKey type for public keys in the database #1291
base: master
Are you sure you want to change the base?
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
@@ -67,7 +67,7 @@ class OpenMultiplePersistableDocuments : ActivityResultContracts.OpenMultipleDoc | |||
class ChatFragment : BaseFragment<FragmentChatBinding>(FragmentChatBinding::inflate) { | |||
private val viewModel: ChatViewModel by viewModels { vmFactory } | |||
|
|||
private lateinit var contactPubKey: String | |||
private var contactPubKey = PublicKey("") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit strange that the empty string is a valid public key, but ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only you now? :P no more contributors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
This is in preparation of using it in the database types now that that is a thing that's possible.
8ff249c
to
86fef43
Compare
This means a lot of conversions go away.
86fef43
to
bb6a698
Compare
No description provided.