From b3b5bd0ecc7f1d6e7b1a2017317546c0c33669e9 Mon Sep 17 00:00:00 2001 From: SuperBatata Date: Sat, 12 Aug 2023 01:18:40 +0100 Subject: [PATCH] fixed duplicate code --- src/main/kotlin/id/walt/idp/nfts/NFTController.kt | 2 +- src/main/kotlin/id/walt/idp/siwe/siwaManager.kt | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/id/walt/idp/nfts/NFTController.kt b/src/main/kotlin/id/walt/idp/nfts/NFTController.kt index 25aba1b..baedaf8 100644 --- a/src/main/kotlin/id/walt/idp/nfts/NFTController.kt +++ b/src/main/kotlin/id/walt/idp/nfts/NFTController.kt @@ -94,7 +94,7 @@ object NFTController { } ChainEcosystem.ALGORAND -> { - address = SiwaManager.getAddress(message) + address = SiwaManager.getPublicKey(message) val publicKey = SiwaManager.getPublicKey(message) SiwaManager.verifySignature(session!!, message, publicKey,signature) } diff --git a/src/main/kotlin/id/walt/idp/siwe/siwaManager.kt b/src/main/kotlin/id/walt/idp/siwe/siwaManager.kt index ad68a18..69e37ca 100644 --- a/src/main/kotlin/id/walt/idp/siwe/siwaManager.kt +++ b/src/main/kotlin/id/walt/idp/siwe/siwaManager.kt @@ -50,12 +50,7 @@ object SiwaManager { - fun getAddress(message:String): String{ - val regex = Regex("Public Key: ([A-Z0-9]+)\\s*\\.\\s*Date:") - val matchResult = regex.find(message) - val publicKey = matchResult?.groupValues?.get(1) - return publicKey!! - } + fun getNonce(message: String): String{ val nonce= message.split(".").last().split(":").last().trim()