feat(communities): add getCommunityPublicKeyFromPrivateKey function

This commit is contained in:
Jonathan Rainville 2023-07-31 14:03:04 -04:00
parent edba946a71
commit f4c6cec87d
7 changed files with 27 additions and 5 deletions

View File

@ -395,3 +395,6 @@ proc authenticateToEditSharedAddresses*(self: Controller, communityId: string, a
proc authenticateWithCallback*(self: Controller) =
self.tmpAuthenticationWithCallbackInProgress = true
self.authenticate()
proc getCommunityPublicKeyFromPrivateKey*(self: Controller, communityPrivateKey: string): string =
result = self.communityService.getCommunityPublicKeyFromPrivateKey(communityPrivateKey)

View File

@ -203,3 +203,6 @@ method callbackFromAuthentication*(self: AccessInterface, authenticated: bool) {
method prepareTokenModelForCommunity*(self: AccessInterface, communityId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method getCommunityPublicKeyFromPrivateKey*(self: AccessInterface, communityPrivateKey: string): string {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -501,6 +501,9 @@ method authenticateWithCallback*(self: Module) =
method callbackFromAuthentication*(self: Module, authenticated: bool) =
self.view.callbackFromAuthentication(authenticated)
method getCommunityPublicKeyFromPrivateKey*(self: Module, communityPrivateKey: string): string =
result = self.controller.getCommunityPublicKeyFromPrivateKey(communityPrivateKey)
method prepareTokenModelForCommunity*(self: Module, communityId: string) =
let community = self.controller.getCommunityById(communityId)
var tokenPermissionsItems: seq[TokenPermissionItem] = @[]

View File

@ -659,3 +659,6 @@ QtObject:
self.delegate.editSharedAddressesWithAuthentication(communityId, addressesArray, airdropAddress)
except Exception as e:
echo "Error editing shared addresses with authentication: ", e.msg
proc getCommunityPublicKeyFromPrivateKey*(self: View, communityPrivateKey: string): string {.slot.} =
result = self.delegate.getCommunityPublicKeyFromPrivateKey(communityPrivateKey)

View File

@ -1966,25 +1966,32 @@ QtObject:
let response = status_go.shareCommunityUrlWithChatKey(communityId)
return response.result.getStr
except Exception as e:
error "error while getting community url with chat key", msg = e.msg
error "error while getting community url with chat key", msg = e.msg
proc shareCommunityUrlWithData*(self: Service, communityId: string): string =
try:
let response = status_go.shareCommunityUrlWithData(communityId)
return response.result.getStr
except Exception as e:
error "error while getting community url with data", msg = e.msg
error "error while getting community url with data", msg = e.msg
proc shareCommunityChannelUrlWithChatKey*(self: Service, communityId: string, chatId: string): string =
try:
let response = status_go.shareCommunityChannelUrlWithChatKey(communityId, chatId)
return response.result.getStr
except Exception as e:
error "error while getting community channel url with chat key ", msg = e.msg
error "error while getting community channel url with chat key ", msg = e.msg
proc shareCommunityChannelUrlWithData*(self: Service, communityId: string, chatId: string): string =
try:
let response = status_go.shareCommunityChannelUrlWithData(communityId, chatId)
return response.result.getStr
except Exception as e:
error "error while getting community channel url with data ", msg = e.msg
error "error while getting community channel url with data ", msg = e.msg
proc getCommunityPublicKeyFromPrivateKey*(self: Service, communityPrivateKey: string): string =
try:
let response = status_go.getCommunityPublicKeyFromPrivateKey(communityPrivateKey)
result = response.result.getStr
except Exception as e:
error "error while getting community public key", msg = e.msg

View File

@ -443,3 +443,6 @@ proc requestExtractDiscordChannelsAndCategories*(filesToImport: seq[string]): Rp
proc getCheckChannelPermissionResponses*(communityId: string,): RpcResponse[JsonNode] {.raises: [Exception].} =
return callPrivateRPC("getCheckChannelPermissionResponses".prefix, %*[communityId])
proc getCommunityPublicKeyFromPrivateKey*(communityPrivateKey: string,): RpcResponse[JsonNode] {.raises: [Exception].} =
return callPrivateRPC("getCommunityPublicKeyFromPrivateKey".prefix, %*[communityPrivateKey])

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 4ad84d80cc7b0363f3c8da589d7bb8930fb8a629
Subproject commit 9267e581436db4e6c761f9600243bc4f14aec36e