feat: wrappers and debugging get/set for the closed groups in user groups

This commit is contained in:
0x330a
2023-08-31 15:03:29 +10:00
parent 51716e718a
commit 63e156cce5
12 changed files with 223 additions and 75 deletions

View File

@@ -0,0 +1,27 @@
package org.session.libsignal.utilities
class SessionId {
companion object {
// needed because JNI doesn't want to detect alternate constructors :shrug:
@JvmStatic
fun from(id: String): SessionId = SessionId(id)
}
var prefix: IdPrefix?
var publicKey: String
constructor(id: String) {
prefix = IdPrefix.fromValue(id)
publicKey = id.drop(2)
}
constructor(prefix: IdPrefix, publicKey: ByteArray) {
this.prefix = prefix
this.publicKey = publicKey.toHexString()
}
fun hexString() = prefix?.value + publicKey
fun bytes(): ByteArray = Hex.fromStringCondensed(prefix?.value + publicKey)
}