Skip to content

Commit 87179ce

Browse files
authored
Merge pull request #1490 from WalletConnect/develop
BOM_1.35.1
2 parents f9a7369 + de3b6fc commit 87179ce

15 files changed

Lines changed: 162 additions & 32 deletions

File tree

ReadMe.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dependencies {
2323

2424
| BOM | [Core SDK](core/android) | [Sign SDK](protocol/sign) | [Auth SDK](protocol/auth) | [Chat SDK](protocol/chat) | [Notify SDK](protocol/notify) | [web3wallet](product/web3wallet) | [web3modal](product/web3modal) | [WalletConnectModal](product/walletconnectmodal) |
2525
|-----------------------------------------------------------------------------------------|--------------------------|---------------------------|---------------------------|---------------------------|:------------------------------|----------------------------------|--------------------------------|--------------------------------------------------|
26+
| 1.35.1 | 1.35.1 | 2.35.1 | 1.28.9 | 1.0.0.beta36 | 1.3.10 | 1.35.1 | 1.6.5 | 1.5.10 |
2627
| 1.35.0 | 1.35.0 | 2.35.0 | 1.28.8 | 1.0.0.beta35 | 1.3.9 | 1.35.0 | 1.6.4 | 1.5.9 |
2728
| 1.34.1 | 1.34.1 | 2.34.1 | 1.28.7 | 1.0.0.beta34 | 1.3.8 | 1.34.1 | 1.6.3 | 1.5.8 |
2829
| 1.34.0 | 1.34.0 | 2.34.0 | 1.28.6 | 1.0.0.beta33 | 1.3.7 | 1.34.0 | 1.6.2 | 1.5.7 |

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ const val KEY_PUBLISH_ARTIFACT_ID = "PUBLISH_ARTIFACT_ID"
55
const val KEY_SDK_NAME = "SDK_NAME"
66

77
//Latest versions
8-
const val BOM_VERSION = "1.35.0"
9-
const val FOUNDATION_VERSION = "1.18.2"
10-
const val CORE_VERSION = "1.35.0"
11-
const val SIGN_VERSION = "2.35.0"
12-
const val AUTH_VERSION = "1.28.8"
13-
const val CHAT_VERSION = "1.0.0-beta35"
14-
const val NOTIFY_VERSION = "1.3.9"
15-
const val WEB_3_WALLET_VERSION = "1.35.0"
16-
const val WEB_3_MODAL_VERSION = "1.6.4"
17-
const val WC_MODAL_VERSION = "1.5.9"
18-
const val MODAL_CORE_VERSION = "1.6.4"
8+
const val BOM_VERSION = "1.35.1"
9+
const val FOUNDATION_VERSION = "1.18.3"
10+
const val CORE_VERSION = "1.35.1"
11+
const val SIGN_VERSION = "2.35.1"
12+
const val AUTH_VERSION = "1.28.9"
13+
const val CHAT_VERSION = "1.0.0-beta36"
14+
const val NOTIFY_VERSION = "1.3.10"
15+
const val WEB_3_WALLET_VERSION = "1.35.1"
16+
const val WEB_3_MODAL_VERSION = "1.6.5"
17+
const val WC_MODAL_VERSION = "1.5.10"
18+
const val MODAL_CORE_VERSION = "1.6.5"
1919

2020
//Artifact ids
2121
const val ANDROID_BOM = "android-bom"

core/android/src/main/kotlin/com/walletconnect/android/internal/common/modal/domain/usecase/GetSamplesWalletsUseCaseInterface.kt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ internal class GetSampleWalletsUseCase(
1616
"com.walletconnect.sample.wallet.debug" to SampleWalletDebug,
1717
"com.walletconnect.sample.wallet.internal" to SampleWalletInternal,
1818
"com.walletconnect.sample.wallet" to SampleWalletRelease,
19-
"com.walletconnect.web3wallet.rnsample.internal" to RNSampleWallet
19+
"com.walletconnect.web3wallet.rnsample.internal" to RNSampleWallet,
20+
"com.walletconnect.flutterwallet" to FLSampleWallet,
21+
"com.walletconnect.flutterwallet.internal" to FLSampleWalletInternal
2022
)
2123
samples.forEach { (walletPackage, wallet) ->
2224
wallet.apply {
@@ -78,4 +80,30 @@ private val RNSampleWallet = Wallet(
7880
webAppLink = null,
7981
linkMode = "https://lab.web3modal.com/rn_walletkit",
8082
true
83+
)
84+
85+
private val FLSampleWallet = Wallet(
86+
id = "FLSampleWallet",
87+
name = "FL Sample",
88+
homePage = "https://walletconnect.com",
89+
imageUrl = "https://raw.githubusercontent.com/WalletConnect/WalletConnectKotlinV2/develop/sample/wallet/src/main/res/drawable-xxxhdpi/wc_icon.png",
90+
order = "5",
91+
mobileLink = "wcflutterwallet://",
92+
playStore = null,
93+
webAppLink = null,
94+
linkMode = "https://lab.web3modal.com/flutter_walletkit",
95+
true
96+
)
97+
98+
private val FLSampleWalletInternal = Wallet(
99+
id = "FLSampleWalletInternal",
100+
name = "FL Sample Internal",
101+
homePage = "https://walletconnect.com",
102+
imageUrl = "https://raw.githubusercontent.com/WalletConnect/WalletConnectKotlinV2/develop/sample/wallet/src/main/res/drawable-xxxhdpi/wc_icon.png",
103+
order = "6",
104+
mobileLink = "wcflutterwallet-internal://",
105+
playStore = null,
106+
webAppLink = null,
107+
linkMode = "https://dev.lab.web3modal.com/flutter_walletkit_internal",
108+
true
81109
)

core/android/src/main/kotlin/com/walletconnect/android/verify/client/VerifyClient.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ internal class VerifyClient(
3636
}
3737
}
3838

39-
override fun resolveV2(attestation: String, metadataUrl: String, onSuccess: (VerifyResult) -> Unit, onError: (Throwable) -> Unit) {
39+
override fun resolveV2(attestationId: String, attestationJWT: String, metadataUrl: String, onSuccess: (VerifyResult) -> Unit, onError: (Throwable) -> Unit) {
4040
try {
41-
verifyRepository.resolveV2(attestation, metadataUrl, onSuccess, onError)
41+
verifyRepository.resolveV2(attestationId, attestationJWT, metadataUrl, onSuccess, onError)
4242
} catch (e: Exception) {
4343
onError(e)
4444
}

core/android/src/main/kotlin/com/walletconnect/android/verify/client/VerifyInterface.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ interface VerifyInterface {
66
fun initialize()
77
fun register(attestationId: String, onSuccess: () -> Unit, onError: (Throwable) -> Unit)
88
fun resolve(attestationId: String, metadataUrl: String, onSuccess: (VerifyResult) -> Unit, onError: (Throwable) -> Unit)
9-
fun resolveV2(attestation: String, metadataUrl: String, onSuccess: (VerifyResult) -> Unit, onError: (Throwable) -> Unit)
9+
fun resolveV2(attestationId: String, attestationJWT: String, metadataUrl: String, onSuccess: (VerifyResult) -> Unit, onError: (Throwable) -> Unit)
1010
}

core/android/src/main/kotlin/com/walletconnect/android/verify/domain/ResolveAttestationIdUseCase.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ResolveAttestationIdUseCase(private val verifyInterface: VerifyInterface,
3636
request: WCRequest,
3737
onResolve: (VerifyContext) -> Unit
3838
) {
39-
verifyInterface.resolveV2(request.attestation!!, metadataUrl,
39+
verifyInterface.resolveV2(sha256(request.encryptedMessage.toByteArray()), request.attestation!!, metadataUrl,
4040
onSuccess = { result ->
4141
insertContext(VerifyContext(request.id, result.origin, result.validation, verifyUrl, result.isScam)) { verifyContext -> onResolve(verifyContext) }
4242
},
@@ -64,8 +64,12 @@ class ResolveAttestationIdUseCase(private val verifyInterface: VerifyInterface,
6464
private fun insertContext(context: VerifyContext, onResolve: (VerifyContext) -> Unit) {
6565
scope.launch {
6666
supervisorScope {
67-
repository.insertOrAbort(context)
68-
onResolve(context)
67+
try {
68+
repository.insertOrAbort(context)
69+
onResolve(context)
70+
} catch (e: Exception) {
71+
onResolve(context)
72+
}
6973
}
7074
}
7175
}

core/android/src/main/kotlin/com/walletconnect/android/verify/domain/VerifyRepository.kt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ internal class VerifyRepository(
3434
}
3535
}
3636

37-
fun resolveV2(attestationJWT: String, metadataUrl: String, onSuccess: (VerifyResult) -> Unit, onError: (Throwable) -> Unit) {
37+
fun resolveV2(attestationId: String, attestationJWT: String, metadataUrl: String, onSuccess: (VerifyResult) -> Unit, onError: (Throwable) -> Unit) {
3838
scope.launch {
3939
supervisorScope {
4040
getVerifyPublicKey().fold(
@@ -47,7 +47,7 @@ internal class VerifyRepository(
4747
return@supervisorScope
4848
}
4949

50-
onSuccess(VerifyResult(getValidation(claims, metadataUrl), claims.isScam, claims.origin))
50+
checkIds(attestationId, claims, metadataUrl, onSuccess, onError)
5151
} catch (e: Exception) {
5252
onError(e)
5353
}
@@ -78,6 +78,20 @@ internal class VerifyRepository(
7878
}
7979
}
8080

81+
private fun checkIds(
82+
attestationId: String,
83+
claims: VerifyClaims,
84+
metadataUrl: String,
85+
onSuccess: (VerifyResult) -> Unit,
86+
onError: (Throwable) -> Unit
87+
) {
88+
if (attestationId != claims.id) {
89+
resolve(attestationId, metadataUrl, onSuccess, onError)
90+
} else {
91+
onSuccess(VerifyResult(getValidation(claims, metadataUrl), claims.isScam, claims.origin))
92+
}
93+
}
94+
8195
private fun getValidation(claims: VerifyClaims, metadataUrl: String): Validation =
8296
when {
8397
!claims.isVerified || currentTimeInSeconds >= claims.expiration -> Validation.UNKNOWN

core/android/src/test/kotlin/com/walletconnect/android/internal/ResolveAttestationUseCaseTest.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.walletconnect.utils.Empty
1515
import io.mockk.Runs
1616
import io.mockk.coEvery
1717
import io.mockk.coVerify
18+
import io.mockk.invoke
1819
import io.mockk.just
1920
import io.mockk.mockk
2021
import io.mockk.verify
@@ -77,8 +78,8 @@ class ResolveAttestationUseCaseTest {
7778
isScam = false
7879
)
7980

80-
coEvery { verifyInterface.resolveV2(any(), any(), any(), any()) } answers {
81-
thirdArg<(VerifyResult) -> Unit>().invoke(result)
81+
coEvery { verifyInterface.resolveV2(any(), any(), any(), captureLambda(), any()) } answers {
82+
lambda<(VerifyResult) -> Unit>().invoke(result)
8283
}
8384

8485
coEvery { repository.insertOrAbort(any()) } just Runs
@@ -90,7 +91,7 @@ class ResolveAttestationUseCaseTest {
9091
}
9192

9293
coVerify {
93-
verifyInterface.resolveV2("jwt", metadataUrl, any(), any())
94+
verifyInterface.resolveV2(any(), "jwt", metadataUrl, any(), any())
9495
}
9596
coVerify {
9697
repository.insertOrAbort(withArg { context ->
@@ -121,8 +122,8 @@ class ResolveAttestationUseCaseTest {
121122
)
122123
val metadataUrl = "https://metadata.url"
123124

124-
coEvery { verifyInterface.resolveV2(any(), any(), any(), any()) } answers {
125-
thirdArg<(VerifyResult) -> Unit>().invoke(result)
125+
coEvery { verifyInterface.resolveV2(any(), any(), any(), captureLambda(), any()) } answers {
126+
lambda<(VerifyResult) -> Unit>().invoke(result)
126127
}
127128

128129
coEvery { repository.insertOrAbort(any()) } just Runs
@@ -134,7 +135,7 @@ class ResolveAttestationUseCaseTest {
134135
}
135136

136137
coVerify {
137-
verifyInterface.resolveV2("jwt", metadataUrl, any(), any())
138+
verifyInterface.resolveV2(any(), "jwt", metadataUrl, any(), any())
138139
}
139140
coVerify {
140141
repository.insertOrAbort(withArg { context ->

core/android/src/test/kotlin/com/walletconnect/android/internal/VerifyClientTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class VerifyClientTest {
5757
val onSuccess = mockk<(VerifyResult) -> Unit>(relaxed = true)
5858
val onError = mockk<(Throwable) -> Unit>(relaxed = true)
5959

60-
verifyClient.resolveV2(attestation, metadataUrl, onSuccess, onError)
60+
verifyClient.resolveV2("id", attestation, metadataUrl, onSuccess, onError)
6161

62-
coVerify { verifyRepository.resolveV2(attestation, metadataUrl, onSuccess, onError) }
62+
coVerify { verifyRepository.resolveV2("id", attestation, metadataUrl, onSuccess, onError) }
6363
}
6464
}

core/android/src/test/kotlin/com/walletconnect/android/internal/VerifyRepositoryTest.kt

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ class VerifyRepositoryTest {
7777
coVerify { verifyPublicKeyStorageRepository.upsertPublicKey(newKey, any()) }
7878
}
7979

80+
8081
@Test
81-
fun `resolveV2 calls onSuccess when JWT is valid`() = testScope.runTest {
82+
fun `resolveV2 calls onSuccess when JWT is valid and ids match`() = testScope.runTest {
83+
val attestationId = "5106a25552e89acfb5bed83ee21bf4e80dbcd51b0b203f6925a369aacb1c860b"
8284
val attestationJWT = "attestationJWT"
8385
val metadataUrl = "https://metadata.url"
8486
val publicKey = "0409b2f80ce60e6f59ed77ef0e984c4efa84b40d608c0b4d039edaf2989a01f2d92931708c7b50c464c347dd55b0eca971d05fbdba3ab00323e69e166fef61440d"
@@ -93,7 +95,38 @@ class VerifyRepositoryTest {
9395
val onSuccess = mockk<(VerifyResult) -> Unit>(relaxed = true)
9496
val onError = mockk<(Throwable) -> Unit>(relaxed = true)
9597

96-
verifyRepository.resolveV2(attestationJWT, metadataUrl, onSuccess, onError)
98+
verifyRepository.resolveV2(attestationId, attestationJWT, metadataUrl, onSuccess, onError)
99+
100+
advanceUntilIdle()
101+
102+
verify { onSuccess(verifyResult) }
103+
}
104+
105+
@Test
106+
fun `resolveV2 calls onSuccess when JWT is valid and ids do not match`() = testScope.runTest {
107+
val attestationId = "test"
108+
val attestationJWT = "attestationJWT"
109+
val metadataUrl = "https://metadata.url"
110+
val publicKey = "0409b2f80ce60e6f59ed77ef0e984c4efa84b40d608c0b4d039edaf2989a01f2d92931708c7b50c464c347dd55b0eca971d05fbdba3ab00323e69e166fef61440d"
111+
val verifyResult = VerifyResult(Validation.INVALID, false, "https://react-dapp-v2-git-chore-verify-v2-samples-walletconnect1.vercel.app")
112+
val claimsJson =
113+
"""{"exp":1722579908,"id":"5106a25552e89acfb5bed83ee21bf4e80dbcd51b0b203f6925a369aacb1c860b","origin":"https://react-dapp-v2-git-chore-verify-v2-samples-walletconnect1.vercel.app","isScam":null,"isVerified":true}"""
114+
115+
coEvery { verifyPublicKeyStorageRepository.getPublicKey() } returns Pair(publicKey, currentTimeInSeconds + 1000)
116+
every { jwtRepository.verifyJWT(any(), any()) } returns true
117+
every { jwtRepository.decodeClaimsJWT(any()) } returns claimsJson
118+
coEvery { verifyService.resolveAttestation(attestationId) } returns Response.success(
119+
Origin(
120+
"attId",
121+
origin = "https://react-dapp-v2-git-chore-verify-v2-samples-walletconnect1.vercel.app",
122+
isScam = false
123+
)
124+
)
125+
126+
val onSuccess = mockk<(VerifyResult) -> Unit>(relaxed = true)
127+
val onError = mockk<(Throwable) -> Unit>(relaxed = true)
128+
129+
verifyRepository.resolveV2(attestationId, attestationJWT, metadataUrl, onSuccess, onError)
97130

98131
advanceUntilIdle()
99132

0 commit comments

Comments
 (0)