2024-10-21 12:14:48 +02:00
|
|
|
import QtQml 2.15
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
readonly property QtObject _d: QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
property var globalUtilsInst: globalUtils
|
|
|
|
}
|
|
|
|
|
|
|
|
function isChatKey(value) {
|
|
|
|
return (Utils.startsWith0x(value) && Utils.isHex(value) && value.length === 132)
|
|
|
|
|| d.globalUtilsInst.isCompressedPubKey(value)
|
|
|
|
}
|
2024-10-21 13:28:57 +02:00
|
|
|
|
|
|
|
function isCommunityPublicKey(value) {
|
|
|
|
return (Utils.startsWith0x(value) && Utils.isHex(value) && value.length === Constants.communityIdLength)
|
|
|
|
|| d.globalUtilsInst.isCompressedPubKey(value)
|
|
|
|
}
|
2024-10-21 15:40:14 +02:00
|
|
|
|
|
|
|
function isCompressedPubKey(pubKey) {
|
|
|
|
return d.globalUtilsInst.isCompressedPubKey(pubKey)
|
|
|
|
}
|
2024-10-22 00:01:34 +02:00
|
|
|
|
|
|
|
function isAlias(name) {
|
|
|
|
return d.globalUtilsInst.isAlias(name)
|
|
|
|
}
|
2024-10-22 14:39:42 +02:00
|
|
|
|
|
|
|
function getEmojiHash(publicKey) {
|
|
|
|
if (publicKey === "" || !isChatKey(publicKey))
|
|
|
|
return []
|
|
|
|
|
|
|
|
return JSON.parse(d.globalUtilsInst.getEmojiHashAsJson(publicKey))
|
|
|
|
}
|
2024-10-22 18:00:22 +02:00
|
|
|
|
|
|
|
function changeCommunityKeyCompression(communityKey) {
|
|
|
|
return d.globalUtilsInst.changeCommunityKeyCompression(communityKey)
|
|
|
|
}
|
2024-10-28 12:51:56 +01:00
|
|
|
|
|
|
|
function getCompressedPk(publicKey) {
|
|
|
|
if (publicKey === "") {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
if (!isChatKey(publicKey))
|
|
|
|
return publicKey
|
|
|
|
return d.globalUtilsInst.getCompressedPk(publicKey)
|
|
|
|
}
|
2024-10-21 12:14:48 +02:00
|
|
|
}
|