Skip to content

Commit

Permalink
fix: check for nil pubnonce for v2 user
Browse files Browse the repository at this point in the history
  • Loading branch information
metalurgical committed Jul 16, 2024
1 parent 1fcc104 commit 6516d25
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Sources/TorusUtils/Helpers/NodeUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,14 @@ internal class NodeUtils {
}
} else {
typeOfUser = .v2
let publicNonce = KeyUtils.getPublicKeyFromCoords(pubKeyX: thresholdNonceData!.pubNonce!.x, pubKeyY: thresholdNonceData!.pubNonce!.y)
let oAuthPubKey = KeyUtils.getPublicKeyFromCoords(pubKeyX: oAuthPublicKeyX, pubKeyY: oAuthPublicKeyY)
finalPubKey = try KeyUtils.combinePublicKeys(keys: [oAuthPubKey, publicNonce])
pubNonce = PubNonce(x: thresholdNonceData!.pubNonce!.x, y: thresholdNonceData!.pubNonce!.y)
if thresholdNonceData!.pubNonce != nil {
let publicNonce = KeyUtils.getPublicKeyFromCoords(pubKeyX: thresholdNonceData!.pubNonce!.x, pubKeyY: thresholdNonceData!.pubNonce!.y)
finalPubKey = try KeyUtils.combinePublicKeys(keys: [oAuthPubKey, publicNonce])
pubNonce = PubNonce(x: thresholdNonceData!.pubNonce!.x, y: thresholdNonceData!.pubNonce!.y)
} else {
finalPubKey = oAuthPubKey
}
}

if finalPubKey == nil {
Expand All @@ -554,7 +558,7 @@ internal class NodeUtils {
finalPrivKey = privateKeyWithNonce.magnitude.serialize().hexString.addLeading0sForLength64()
}

var isUpgraded: Bool? = nil
var isUpgraded: Bool?
if typeOfUser == .v2 {
isUpgraded = metadataNonce == BigInt(0)
}
Expand Down

0 comments on commit 6516d25

Please sign in to comment.