chore: logs
This commit is contained in:
parent
44808424a4
commit
e4f6830311
|
@ -1,4 +1,4 @@
|
||||||
import std/strutils, uuids
|
import std/strutils, uuids, chronicles
|
||||||
import ./io_interface
|
import ./io_interface
|
||||||
|
|
||||||
import app/core/signals/types
|
import app/core/signals/types
|
||||||
|
@ -195,6 +195,7 @@ proc init*(self: Controller) =
|
||||||
|
|
||||||
self.events.on(SIGNAL_SHARED_KEYCARD_MODULE_USER_AUTHENTICATED) do(e: Args):
|
self.events.on(SIGNAL_SHARED_KEYCARD_MODULE_USER_AUTHENTICATED) do(e: Args):
|
||||||
let args = SharedKeycarModuleArgs(e)
|
let args = SharedKeycarModuleArgs(e)
|
||||||
|
debug "<<< on SIGNAL_SHARED_KEYCARD_MODULE_USER_AUTHENTICATED", uniqueIdentifier = args.uniqueIdentifier
|
||||||
if args.uniqueIdentifier != UNIQUE_COMMUNITIES_MODULE_AUTH_IDENTIFIER:
|
if args.uniqueIdentifier != UNIQUE_COMMUNITIES_MODULE_AUTH_IDENTIFIER:
|
||||||
return
|
return
|
||||||
self.delegate.onUserAuthenticated(args.pin, args.password, args.keyUid)
|
self.delegate.onUserAuthenticated(args.pin, args.password, args.keyUid)
|
||||||
|
@ -209,6 +210,7 @@ proc init*(self: Controller) =
|
||||||
|
|
||||||
self.events.on(SIGNAL_SHARED_KEYCARD_MODULE_DATA_SIGNED) do(e: Args):
|
self.events.on(SIGNAL_SHARED_KEYCARD_MODULE_DATA_SIGNED) do(e: Args):
|
||||||
let args = SharedKeycarModuleArgs(e)
|
let args = SharedKeycarModuleArgs(e)
|
||||||
|
debug "<<< on SIGNAL_SHARED_KEYCARD_MODULE_DATA_SIGNED", uniqueIdentifier = args.uniqueIdentifier
|
||||||
if args.uniqueIdentifier != UNIQUE_COMMUNITIES_MODULE_SIGNING_IDENTIFIER:
|
if args.uniqueIdentifier != UNIQUE_COMMUNITIES_MODULE_SIGNING_IDENTIFIER:
|
||||||
return
|
return
|
||||||
self.delegate.onDataSigned(args.keyUid, args.path, args.r, args.s, args.v, args.pin)
|
self.delegate.onDataSigned(args.keyUid, args.path, args.r, args.s, args.v, args.pin)
|
||||||
|
@ -398,6 +400,7 @@ proc asyncEditSharedAddresses*(self: Controller, communityId: string, addressesT
|
||||||
self.communityService.asyncEditSharedAddresses(communityId, addressesToShare, airdropAddress, signatures)
|
self.communityService.asyncEditSharedAddresses(communityId, addressesToShare, airdropAddress, signatures)
|
||||||
|
|
||||||
proc authenticate*(self: Controller) =
|
proc authenticate*(self: Controller) =
|
||||||
|
debug "<<< authenticate"
|
||||||
let data = SharedKeycarModuleAuthenticationArgs(uniqueIdentifier: UNIQUE_COMMUNITIES_MODULE_AUTH_IDENTIFIER)
|
let data = SharedKeycarModuleAuthenticationArgs(uniqueIdentifier: UNIQUE_COMMUNITIES_MODULE_AUTH_IDENTIFIER)
|
||||||
self.events.emit(SIGNAL_SHARED_KEYCARD_MODULE_AUTHENTICATE_USER, data)
|
self.events.emit(SIGNAL_SHARED_KEYCARD_MODULE_AUTHENTICATE_USER, data)
|
||||||
|
|
||||||
|
@ -422,6 +425,7 @@ proc generateEditCommunityRequestsForSigning*(self: Controller, memberPubKey: st
|
||||||
return self.communityService.generateEditCommunityRequestsForSigning(memberPubKey, communityId, addressesToReveal)
|
return self.communityService.generateEditCommunityRequestsForSigning(memberPubKey, communityId, addressesToReveal)
|
||||||
|
|
||||||
proc signCommunityRequests*(self: Controller, communityId: string, signParams: seq[SignParamsDto]): seq[string] =
|
proc signCommunityRequests*(self: Controller, communityId: string, signParams: seq[SignParamsDto]): seq[string] =
|
||||||
|
debug "<<< signCommunityRequests", communityId, signParams
|
||||||
return self.communityService.signCommunityRequests(communityId, signParams)
|
return self.communityService.signCommunityRequests(communityId, signParams)
|
||||||
|
|
||||||
proc getKeypairByAccountAddress*(self: Controller, address: string): KeypairDto =
|
proc getKeypairByAccountAddress*(self: Controller, address: string): KeypairDto =
|
||||||
|
@ -461,11 +465,13 @@ proc cancelCurrentFlow*(self: Controller) =
|
||||||
self.keycardService.cancelCurrentFlow()
|
self.keycardService.cancelCurrentFlow()
|
||||||
|
|
||||||
proc runSignFlow(self: Controller, pin, path, dataToSign: string) =
|
proc runSignFlow(self: Controller, pin, path, dataToSign: string) =
|
||||||
|
debug "<<< runSignFlow", pin, path, dataToSign
|
||||||
self.cancelCurrentFlow()
|
self.cancelCurrentFlow()
|
||||||
self.connectKeycardReponseSignal()
|
self.connectKeycardReponseSignal()
|
||||||
self.keycardService.startSignFlow(path, dataToSign, pin)
|
self.keycardService.startSignFlow(path, dataToSign, pin)
|
||||||
|
|
||||||
proc runSigningOnKeycard*(self: Controller, keyUid: string, path: string, dataToSign: string, pin: string) =
|
proc runSigningOnKeycard*(self: Controller, keyUid: string, path: string, dataToSign: string, pin: string) =
|
||||||
|
debug "<<< runSigningOnKeycard", keyUid, path, dataToSign, pin
|
||||||
var finalDataToSign = dataToSign
|
var finalDataToSign = dataToSign
|
||||||
if finalDataToSign.startsWith("0x"):
|
if finalDataToSign.startsWith("0x"):
|
||||||
finalDataToSign = finalDataToSign[2..^1]
|
finalDataToSign = finalDataToSign[2..^1]
|
||||||
|
|
|
@ -665,6 +665,7 @@ method shareCommunityChannelUrlWithData*(self: Module, communityId: string, chat
|
||||||
return self.controller.shareCommunityChannelUrlWithData(communityId, chatId)
|
return self.controller.shareCommunityChannelUrlWithData(communityId, chatId)
|
||||||
|
|
||||||
proc signRevealedAddressesForNonKeycardKeypairs(self: Module): bool =
|
proc signRevealedAddressesForNonKeycardKeypairs(self: Module): bool =
|
||||||
|
debug "<<< signRevealedAddressesForNonKeycardKeypairs"
|
||||||
var signingParams: seq[SignParamsDto]
|
var signingParams: seq[SignParamsDto]
|
||||||
for address, details in self.joiningCommunityDetails.addressesToShare.pairs:
|
for address, details in self.joiningCommunityDetails.addressesToShare.pairs:
|
||||||
if details.signature.len > 0:
|
if details.signature.len > 0:
|
||||||
|
@ -710,6 +711,8 @@ proc anyProfileKeyPairAddressSelectedToBeRevealed(self: Module): bool =
|
||||||
return false
|
return false
|
||||||
|
|
||||||
method onUserAuthenticated*(self: Module, pin: string, password: string, keyUid: string) =
|
method onUserAuthenticated*(self: Module, pin: string, password: string, keyUid: string) =
|
||||||
|
debug "<<< onUserAuthenticated", pin, password, keyUid
|
||||||
|
|
||||||
if password == "" and pin == "":
|
if password == "" and pin == "":
|
||||||
info "unsuccesful authentication"
|
info "unsuccesful authentication"
|
||||||
return
|
return
|
||||||
|
@ -728,6 +731,7 @@ method onUserAuthenticated*(self: Module, pin: string, password: string, keyUid:
|
||||||
self.signRevealedAddressesForNonKeycardKeypairsAndEmitSignal()
|
self.signRevealedAddressesForNonKeycardKeypairsAndEmitSignal()
|
||||||
|
|
||||||
method onDataSigned*(self: Module, keyUid: string, path: string, r: string, s: string, v: string, pin: string) =
|
method onDataSigned*(self: Module, keyUid: string, path: string, r: string, s: string, v: string, pin: string) =
|
||||||
|
debug "<<< onDataSigned", keyUid, path, r, s, v, pin
|
||||||
if keyUid.len == 0 or path.len == 0 or r.len == 0 or s.len == 0 or v.len == 0 or pin.len == 0:
|
if keyUid.len == 0 or path.len == 0 or r.len == 0 or s.len == 0 or v.len == 0 or pin.len == 0:
|
||||||
# being here is not an error
|
# being here is not an error
|
||||||
return
|
return
|
||||||
|
@ -746,6 +750,7 @@ method onDataSigned*(self: Module, keyUid: string, path: string, r: string, s: s
|
||||||
|
|
||||||
method prepareKeypairsForSigning*(self: Module, communityId, ensName: string, addresses: string,
|
method prepareKeypairsForSigning*(self: Module, communityId, ensName: string, addresses: string,
|
||||||
airdropAddress: string, editMode: bool) =
|
airdropAddress: string, editMode: bool) =
|
||||||
|
debug "<<< prepareKeypairsForSigning", communityId, ensName, addresses, airdropAddress, editMode
|
||||||
var addressesToShare: seq[string]
|
var addressesToShare: seq[string]
|
||||||
try:
|
try:
|
||||||
addressesToShare = map(parseJson(addresses).getElems(), proc(x:JsonNode):string = x.getStr())
|
addressesToShare = map(parseJson(addresses).getElems(), proc(x:JsonNode):string = x.getStr())
|
||||||
|
@ -800,6 +805,7 @@ method signProfileKeypairAndAllNonKeycardKeypairs*(self: Module) =
|
||||||
|
|
||||||
# if pin is provided we're signing on a keycard silently
|
# if pin is provided we're signing on a keycard silently
|
||||||
method signSharedAddressesForKeypair*(self: Module, keyUid: string, pin: string) =
|
method signSharedAddressesForKeypair*(self: Module, keyUid: string, pin: string) =
|
||||||
|
debug "<<< signSharedAddressesForKeypair", keyUid, pin
|
||||||
let keypair = self.controller.getKeypairByKeyUid(keyUid)
|
let keypair = self.controller.getKeypairByKeyUid(keyUid)
|
||||||
if keypair.isNil:
|
if keypair.isNil:
|
||||||
self.communityAccessFailed(self.joiningCommunityDetails.communityId, "cannot resolve keypair for keyUid " & keyUid)
|
self.communityAccessFailed(self.joiningCommunityDetails.communityId, "cannot resolve keypair for keyUid " & keyUid)
|
||||||
|
@ -843,6 +849,7 @@ method joinCommunityOrEditSharedAddresses*(self: Module) =
|
||||||
# The user reveals address after sending join coummunity request, before that he sees only the name of the wallet account, not the address.
|
# The user reveals address after sending join coummunity request, before that he sees only the name of the wallet account, not the address.
|
||||||
self.events.emit(MARK_WALLET_ADDRESSES_AS_SHOWN, WalletAddressesArgs(addresses: addressesToShare))
|
self.events.emit(MARK_WALLET_ADDRESSES_AS_SHOWN, WalletAddressesArgs(addresses: addressesToShare))
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.joiningCommunityDetails.action == Action.EditSharedAddresses:
|
if self.joiningCommunityDetails.action == Action.EditSharedAddresses:
|
||||||
self.controller.asyncEditSharedAddresses(self.joiningCommunityDetails.communityId,
|
self.controller.asyncEditSharedAddresses(self.joiningCommunityDetails.communityId,
|
||||||
addressesToShare,
|
addressesToShare,
|
||||||
|
@ -851,7 +858,8 @@ method joinCommunityOrEditSharedAddresses*(self: Module) =
|
||||||
# The user reveals address after sending edit coummunity request, before that he sees only the name of the wallet account, not the address.
|
# The user reveals address after sending edit coummunity request, before that he sees only the name of the wallet account, not the address.
|
||||||
self.events.emit(MARK_WALLET_ADDRESSES_AS_SHOWN, WalletAddressesArgs(addresses: addressesToShare))
|
self.events.emit(MARK_WALLET_ADDRESSES_AS_SHOWN, WalletAddressesArgs(addresses: addressesToShare))
|
||||||
return
|
return
|
||||||
self.communityAccessFailed(self.joiningCommunityDetails.communityId, "unexpected action")
|
|
||||||
|
self.communityAccessFailed(self.joiningCommunityDetails.communityId, "unexpected action: " & $self.joiningCommunityDetails.action)
|
||||||
|
|
||||||
method getCommunityPublicKeyFromPrivateKey*(self: Module, communityPrivateKey: string): string =
|
method getCommunityPublicKeyFromPrivateKey*(self: Module, communityPrivateKey: string): string =
|
||||||
result = self.controller.getCommunityPublicKeyFromPrivateKey(communityPrivateKey)
|
result = self.controller.getCommunityPublicKeyFromPrivateKey(communityPrivateKey)
|
||||||
|
|
|
@ -755,36 +755,43 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
onPrepareForSigning: {
|
onPrepareForSigning: {
|
||||||
|
console.log("<<< onPrepareForSigning")
|
||||||
root.rootStore.prepareKeypairsForSigning(dialogRoot.communityId, dialogRoot.name, sharedAddresses, airdropAddress, false)
|
root.rootStore.prepareKeypairsForSigning(dialogRoot.communityId, dialogRoot.name, sharedAddresses, airdropAddress, false)
|
||||||
|
|
||||||
dialogRoot.keypairSigningModel = root.rootStore.communitiesModuleInst.keypairsSigningModel
|
dialogRoot.keypairSigningModel = root.rootStore.communitiesModuleInst.keypairsSigningModel
|
||||||
}
|
}
|
||||||
|
|
||||||
onSignProfileKeypairAndAllNonKeycardKeypairs: {
|
onSignProfileKeypairAndAllNonKeycardKeypairs: {
|
||||||
|
console.log("<<< onSignProfileKeypairAndAllNonNonKeycardKeypairs")
|
||||||
root.rootStore.signProfileKeypairAndAllNonKeycardKeypairs()
|
root.rootStore.signProfileKeypairAndAllNonKeycardKeypairs()
|
||||||
}
|
}
|
||||||
|
|
||||||
onSignSharedAddressesForKeypair: {
|
onSignSharedAddressesForKeypair: {
|
||||||
|
console.log("<<< onSignSharedAddressesForKeypair")
|
||||||
root.rootStore.signSharedAddressesForKeypair(keyUid)
|
root.rootStore.signSharedAddressesForKeypair(keyUid)
|
||||||
}
|
}
|
||||||
|
|
||||||
onJoinCommunity: {
|
onJoinCommunity: {
|
||||||
|
console.log("<<< onJoinCommunity")
|
||||||
root.rootStore.joinCommunityOrEditSharedAddresses()
|
root.rootStore.joinCommunityOrEditSharedAddresses()
|
||||||
}
|
}
|
||||||
|
|
||||||
onCancelMembershipRequest: {
|
onCancelMembershipRequest: {
|
||||||
|
console.log("<<< onCancelMembershipRequest")
|
||||||
root.rootStore.cancelPendingRequest(dialogRoot.communityId)
|
root.rootStore.cancelPendingRequest(dialogRoot.communityId)
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: root.communitiesStore.communitiesModuleInst
|
target: root.communitiesStore.communitiesModuleInst
|
||||||
function onCommunityAccessRequested(communityId: string) {
|
function onCommunityAccessRequested(communityId: string) {
|
||||||
|
console.log("<<< onCommunityAccessRequested:", communityId, dialogRoot.communityId)
|
||||||
if (communityId !== dialogRoot.communityId)
|
if (communityId !== dialogRoot.communityId)
|
||||||
return
|
return
|
||||||
root.communitiesStore.spectateCommunity(communityId);
|
root.communitiesStore.spectateCommunity(communityId);
|
||||||
dialogRoot.close();
|
dialogRoot.close();
|
||||||
}
|
}
|
||||||
function onCommunityAccessFailed(communityId: string, error: string) {
|
function onCommunityAccessFailed(communityId: string, error: string) {
|
||||||
|
console.log("<<< onCommunityAccessFailed:", communityId, error)
|
||||||
if (communityId !== dialogRoot.communityId)
|
if (communityId !== dialogRoot.communityId)
|
||||||
return
|
return
|
||||||
dialogRoot.close();
|
dialogRoot.close();
|
||||||
|
@ -792,6 +799,7 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSharedAddressesUpdated: {
|
onSharedAddressesUpdated: {
|
||||||
|
console.log("<<< onSharedAddressesUpdated")
|
||||||
root.rootStore.updatePermissionsModel(dialogRoot.communityId, sharedAddresses)
|
root.rootStore.updatePermissionsModel(dialogRoot.communityId, sharedAddresses)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,6 +814,8 @@ QtObject {
|
||||||
target: root.rootStore.communitiesModuleInst
|
target: root.rootStore.communitiesModuleInst
|
||||||
|
|
||||||
function onAllSharedAddressesSigned() {
|
function onAllSharedAddressesSigned() {
|
||||||
|
console.log("<<< onAllSharedAddressesSigned")
|
||||||
|
|
||||||
if (dialogRoot.profileProvesOwnershipOfSelectedAddresses) {
|
if (dialogRoot.profileProvesOwnershipOfSelectedAddresses) {
|
||||||
dialogRoot.joinCommunity()
|
dialogRoot.joinCommunity()
|
||||||
dialogRoot.close()
|
dialogRoot.close()
|
||||||
|
|
|
@ -208,6 +208,7 @@ StatusStackModal {
|
||||||
}
|
}
|
||||||
|
|
||||||
function proceedToSigningOrSubmitRequest(uidOfComponentThisFunctionIsCalledFrom) {
|
function proceedToSigningOrSubmitRequest(uidOfComponentThisFunctionIsCalledFrom) {
|
||||||
|
console.log("<<< proceedToSigningOrSubmitRequest")
|
||||||
const selected = d.getSelectedAddresses()
|
const selected = d.getSelectedAddresses()
|
||||||
root.prepareForSigning(selected.airdropAddress, selected.addresses)
|
root.prepareForSigning(selected.airdropAddress, selected.addresses)
|
||||||
if (root.profileProvesOwnershipOfSelectedAddresses) {
|
if (root.profileProvesOwnershipOfSelectedAddresses) {
|
||||||
|
@ -419,14 +420,17 @@ StatusStackModal {
|
||||||
keypairSigningModel: root.keypairSigningModel
|
keypairSigningModel: root.keypairSigningModel
|
||||||
|
|
||||||
onSignProfileKeypairAndAllNonKeycardKeypairs: {
|
onSignProfileKeypairAndAllNonKeycardKeypairs: {
|
||||||
|
console.log("<<< SharedAddressesSigningPanel.onSignProfileKeypairAndAllNonKeycardKeypairs")
|
||||||
root.signProfileKeypairAndAllNonKeycardKeypairs()
|
root.signProfileKeypairAndAllNonKeycardKeypairs()
|
||||||
}
|
}
|
||||||
|
|
||||||
onSignSharedAddressesForKeypair: {
|
onSignSharedAddressesForKeypair: {
|
||||||
|
console.log("<<< SharedAddressesSigningPanel.onSignSharedAddressesForKeypair")
|
||||||
root.signSharedAddressesForKeypair(keyUid)
|
root.signSharedAddressesForKeypair(keyUid)
|
||||||
}
|
}
|
||||||
|
|
||||||
onJoinCommunity: {
|
onJoinCommunity: {
|
||||||
|
console.log("<<< SharedAddressesSigningPanel.onJoinCommunity")
|
||||||
if (root.isEditMode) {
|
if (root.isEditMode) {
|
||||||
root.editRevealedAddresses()
|
root.editRevealedAddresses()
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue