From d75e813f450192942f7fe88728cc4a6d503858ac Mon Sep 17 00:00:00 2001 From: pankcuf Date: Tue, 11 Jul 2023 19:01:08 +0700 Subject: [PATCH 1/3] fix: hashing scheme for platform node key id --- .../Derivation Paths/DSAuthenticationKeysDerivationPath.m | 2 +- DashSync/shared/Models/Masternode/DSLocalMasternode.m | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DashSync/shared/Models/Derivation Paths/DSAuthenticationKeysDerivationPath.m b/DashSync/shared/Models/Derivation Paths/DSAuthenticationKeysDerivationPath.m index 50d5b3172..3c92666c2 100644 --- a/DashSync/shared/Models/Derivation Paths/DSAuthenticationKeysDerivationPath.m +++ b/DashSync/shared/Models/Derivation Paths/DSAuthenticationKeysDerivationPath.m @@ -107,7 +107,7 @@ + (instancetype)blockchainIdentityECDSAKeysDerivationPathForChain:(DSChain *)cha + (instancetype)blockchainIdentityBLSKeysDerivationPathForChain:(DSChain *)chain { UInt256 indexes[] = {uint256_from_long(FEATURE_PURPOSE), uint256_from_long(chain_coin_type(chain.chainType)), uint256_from_long(FEATURE_PURPOSE_IDENTITIES), uint256_from_long(FEATURE_PURPOSE_IDENTITIES_SUBFEATURE_AUTHENTICATION), uint256_from_long(1)}; BOOL hardenedIndexes[] = {YES, YES, YES, YES, YES}; - DSAuthenticationKeysDerivationPath *blockchainIdentityBLSKeysDerivationPath = [DSAuthenticationKeysDerivationPath derivationPathWithIndexes:indexes hardened:hardenedIndexes length:5 type:DSDerivationPathType_MultipleUserAuthentication signingAlgorithm:/*[chain activeBLSType]*/KeyKind_BLS reference:DSDerivationPathReference_BlockchainIdentities onChain:chain]; + DSAuthenticationKeysDerivationPath *blockchainIdentityBLSKeysDerivationPath = [DSAuthenticationKeysDerivationPath derivationPathWithIndexes:indexes hardened:hardenedIndexes length:5 type:DSDerivationPathType_MultipleUserAuthentication signingAlgorithm:KeyKind_BLS reference:DSDerivationPathReference_BlockchainIdentities onChain:chain]; blockchainIdentityBLSKeysDerivationPath.shouldStoreExtendedPrivateKey = YES; blockchainIdentityBLSKeysDerivationPath.usesHardenedKeys = YES; return blockchainIdentityBLSKeysDerivationPath; diff --git a/DashSync/shared/Models/Masternode/DSLocalMasternode.m b/DashSync/shared/Models/Masternode/DSLocalMasternode.m index 9edd4373d..61ac78ea1 100644 --- a/DashSync/shared/Models/Masternode/DSLocalMasternode.m +++ b/DashSync/shared/Models/Masternode/DSLocalMasternode.m @@ -455,7 +455,10 @@ - (void)registrationTransactionFundedByAccount:(DSAccount *)fundingAccount toAdd } else { platformNodeKey = [platformNodeKeysDerivationPath privateKeyAtIndex:self.platformNodeWalletIndex fromSeed:seed]; } - UInt160 platformNodeID = [DSKeyManager publicKeyData:platformNodeKey].hash160; + + UInt256 platformNodeIDsha = [DSKeyManager publicKeyData:platformNodeKey].SHA256; + NSData *data = [NSData dataWithBytes:platformNodeIDsha.u8 length:20]; + UInt160 platformNodeID = data.UInt160; OpaqueKey *ownerKey; if (self.ownerWalletIndex == UINT32_MAX) { From a0b7b0bf258f05fb2fbe0cc8dd151723540e6354 Mon Sep 17 00:00:00 2001 From: tikhop Date: Tue, 11 Jul 2023 17:28:03 +0400 Subject: [PATCH 2/3] feat(ui): Present anything from auth manager on top of the current context --- .../Managers/Service Managers/Auth/DSAuthenticationManager.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DashSync/shared/Models/Managers/Service Managers/Auth/DSAuthenticationManager.m b/DashSync/shared/Models/Managers/Service Managers/Auth/DSAuthenticationManager.m index 9f40a7504..34d94e80d 100644 --- a/DashSync/shared/Models/Managers/Service Managers/Auth/DSAuthenticationManager.m +++ b/DashSync/shared/Models/Managers/Service Managers/Auth/DSAuthenticationManager.m @@ -958,8 +958,13 @@ - (void)presentController:(UIViewController *)controller animated:(BOOL)animated completion:(void (^_Nullable)(void))completion { UIWindow *window = [UIWindow keyWindow]; + UIViewController *presentingController = [window ds_presentingViewController]; NSParameterAssert(presentingController); + + //NOTE: Make sure we present anything on top of the current context + controller.modalPresentationStyle = UIModalPresentationOverFullScreen; + [presentingController presentViewController:controller animated:animated completion:completion]; } #endif From aa68a00b23e00c272cba5f8a312677c464c165b6 Mon Sep 17 00:00:00 2001 From: pankcuf Date: Wed, 12 Jul 2023 00:30:02 +0700 Subject: [PATCH 3/3] chore: shorthand for platform node hash --- DashSync/shared/Models/Masternode/DSLocalMasternode.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DashSync/shared/Models/Masternode/DSLocalMasternode.m b/DashSync/shared/Models/Masternode/DSLocalMasternode.m index 61ac78ea1..067909eda 100644 --- a/DashSync/shared/Models/Masternode/DSLocalMasternode.m +++ b/DashSync/shared/Models/Masternode/DSLocalMasternode.m @@ -456,9 +456,8 @@ - (void)registrationTransactionFundedByAccount:(DSAccount *)fundingAccount toAdd platformNodeKey = [platformNodeKeysDerivationPath privateKeyAtIndex:self.platformNodeWalletIndex fromSeed:seed]; } - UInt256 platformNodeIDsha = [DSKeyManager publicKeyData:platformNodeKey].SHA256; - NSData *data = [NSData dataWithBytes:platformNodeIDsha.u8 length:20]; - UInt160 platformNodeID = data.UInt160; + UInt256 platformNodeHash = [DSKeyManager publicKeyData:platformNodeKey].SHA256; + UInt160 platformNodeID = *(UInt160 *)&platformNodeHash; OpaqueKey *ownerKey; if (self.ownerWalletIndex == UINT32_MAX) {