Skip to content

Commit

Permalink
Merge branch 'sign_2.5' into feature/meta/allowing_tests_for_all_PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
Talhaali00 authored Mar 13, 2024
2 parents 66d729d + bbd9951 commit a12707b
Show file tree
Hide file tree
Showing 215 changed files with 6,467 additions and 823 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
* @WalletConnect/kotlin-team @kacperoak @Elyniss @jakubuid @TalhaAli00
1 change: 1 addition & 0 deletions .github/workflows/ci_db_migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
types:
- opened
- synchronize
- edited

concurrency:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci_instrumented_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ concurrency:
jobs:
sdk_tests:
name: Run Instrumented Tests
runs-on:
group: apple-silicon
runs-on: macos-latest-xlarge
steps:
- uses: actions/checkout@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci_internal_sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'protocol/**'
- 'product/**'
- 'sample/**'
workflow_dispatch:

jobs:
release_samples_internal:
Expand Down
1 change: 1 addition & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ WalletConnect v2 protocols for Android applications.

| 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) |
|-----------------------------------------------------------------------------------------|--------------------------|---------------------------|---------------------------|---------------------------|:------------------------------|----------------------------------|--------------------------------|--------------------------------------------------|
| 1.23.0 | 1.28.0 | 2.26.0 | 1.26.0 | 1.0.0.beta25 | 1.1.0 | 1.21.0 | 1.3.0 | 1.3.0 |
| 1.22.2 | 1.27.2 | 2.25.2 | 1.25.2 | 1.0.0.beta25 | 1.0.2 | 1.20.2 | 1.2.2 | 1.2.2 |
| 1.22.1 | 1.27.0 | 2.25.0 | 1.25.0 | 1.0.0.beta23 | 1.0.0 | 1.20.0 | 1.2.1 | 1.2.0 |
| 1.22.0 | 1.27.0 | 2.25.0 | 1.25.0 | 1.0.0.beta23 | 1.0.0 | 1.20.0 | 1.2.0 | 1.2.0 |
Expand Down
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ allprojects {
if (requested.group == "androidx.navigation" && requested.name == "navigation-compose") {
useVersion(composeNavigationVersion)
}
if (requested.group == "org.bouncycastle" && requested.name == "bcprov-jdk15on") {
useTarget("org.bouncycastle:bcprov-jdk18on:$bouncyCastleVersion")
}
}
}
}
Expand Down
25 changes: 2 additions & 23 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import org.gradle.kotlin.dsl.DependencyHandlerScope

fun DependencyHandlerScope.scanner() {
"implementation"("com.google.mlkit:barcode-scanning:$mlKitBarcode")
"implementation"("androidx.camera:camera-camera2:$camera2Version")
"implementation"("androidx.camera:camera-lifecycle:$camera2Version")
"implementation"("androidx.camera:camera-view:1.0.0-alpha21")
}

fun DependencyHandlerScope.lifecycle() {
"implementation"("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion")
"implementation"("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion")
Expand Down Expand Up @@ -63,17 +56,12 @@ fun DependencyHandlerScope.okhttp() {
}

fun DependencyHandlerScope.bouncyCastle() {
"api"("org.bouncycastle:bcprov-jdk15on:$bouncyCastleVersion")
}

fun DependencyHandlerScope.sqlDelightAndroid() {
"api"("com.squareup.sqldelight:android-driver:$sqlDelightVersion")
"api"("com.squareup.sqldelight:coroutines-extensions-jvm:$sqlDelightVersion")

"api"("org.bouncycastle:bcprov-jdk18on:$bouncyCastleVersion")
}

fun DependencyHandlerScope.sqlCipher() {
"api"("net.zetetic:android-database-sqlcipher:$sqlCipherVersion")
"api"("app.cash.sqldelight:async-extensions:2.0.0")
}

fun DependencyHandlerScope.reLinker() {
Expand All @@ -93,15 +81,6 @@ fun DependencyHandlerScope.koinAndroid() {
"api"("io.insert-koin:koin-android:$koinVersion")
}

fun DependencyHandlerScope.koinTest() {
"testImplementation"("io.insert-koin:koin-test-junit5:$koinVersion")
}

fun DependencyHandlerScope.glide_N_kapt() {
"implementation"("com.github.bumptech.glide:glide:4.12.0")
"kapt"("com.github.bumptech.glide:compiler:4.12.0")
}

fun DependencyHandlerScope.multibaseJava() {
"api"("com.github.multiformats:java-multibase:$multibaseVersion") //https://mvnrepository.com/artifact/com.github.multiformats/java-multibase/1.1.0 vulnerability detected with library
}
Expand Down
27 changes: 12 additions & 15 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ const val KEY_PUBLISH_ARTIFACT_ID = "PUBLISH_ARTIFACT_ID"
const val KEY_SDK_NAME = "SDK_NAME"

//Latest versions
const val BOM_VERSION = "1.22.2"
const val FOUNDATION_VERSION = "1.14.2"
const val CORE_VERSION = "1.27.2"
const val SIGN_VERSION = "2.25.2"
const val AUTH_VERSION = "1.25.2"
const val CHAT_VERSION = "1.0.0-beta25"
const val NOTIFY_VERSION = "1.0.2"
const val WEB_3_WALLET_VERSION = "1.20.2"
const val WEB_3_MODAL_VERSION = "1.2.2"
const val WC_MODAL_VERSION = "1.2.2"
const val MODAL_CORE_VERSION = "1.2.2"
const val BOM_VERSION = "1.23.0"
const val FOUNDATION_VERSION = "1.15.0"
const val CORE_VERSION = "1.28.0"
const val SIGN_VERSION = "2.26.0"
const val AUTH_VERSION = "1.26.0"
const val CHAT_VERSION = "1.0.0-beta26"
const val NOTIFY_VERSION = "1.1.0"
const val WEB_3_WALLET_VERSION = "1.21.0"
const val WEB_3_MODAL_VERSION = "1.3.0"
const val WC_MODAL_VERSION = "1.3.0"
const val MODAL_CORE_VERSION = "1.3.0"

val jvmVersion = JavaVersion.VERSION_11
const val MIN_SDK: Int = 23
Expand All @@ -39,13 +39,11 @@ const val composeViewModelVersion = "2.6.1"
const val scarletVersion = "1.0.0"
const val scarletPackage = "com.github.WalletConnect.Scarlet"
const val koinVersion = "3.4.2"
const val mlKitBarcode = "17.0.3"
const val camera2Version = "1.1.0-alpha01"
const val lifecycleVersion = "2.6.1"
const val navVersion = "2.5.3"
const val retrofitVersion = "2.9.0"
const val okhttpVersion = "4.11.0"
const val bouncyCastleVersion = "1.70"
const val bouncyCastleVersion = "1.77"
const val sqlCipherVersion = "4.5.3@aar"
const val multibaseVersion = "1.1.1"
const val jUnit4Version = "4.13.2"
Expand All @@ -59,7 +57,6 @@ const val androidSecurityVersion = "1.1.0-alpha06"
const val web3jVersion = "4.9.5"
const val kethereumVersion = "0.85.7"
const val wsRestJavaVersion = "3.1.0"
const val fcmVersion = "23.1.1"
const val relinkerVersion = "1.4.5"
const val accompanistVersion = "0.31.3-beta"
const val coreKtxVersion = "1.10.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package com.walletconnect.android.internal.common.cacao
package com.walletconnect.android

import com.walletconnect.android.BuildConfig
import com.walletconnect.android.cacao.signature.SignatureType
import com.walletconnect.android.internal.common.model.ProjectId
import com.walletconnect.android.internal.common.signing.cacao.Cacao
import com.walletconnect.android.internal.common.signing.cacao.CacaoType
import com.walletconnect.android.internal.common.signing.cacao.CacaoVerifier
import com.walletconnect.android.internal.common.signing.cacao.toCAIP122Message
import com.walletconnect.android.internal.common.signing.cacao.toCAIP222Message
import com.walletconnect.android.utils.cacao.CacaoSignerInterface
import com.walletconnect.android.utils.cacao.sign
import com.walletconnect.android.utils.cacao.signHex
import com.walletconnect.util.hexToBytes
import org.junit.Assert
import org.junit.Test
Expand All @@ -31,27 +29,29 @@ internal class CacaoTest {
exp = null,
statement = "I accept the ServiceOrg Terms of Service: https://service.invalid/tos",
requestId = null,
resources = listOf("ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/", "https://example.com/my-web2-claim.json")
resources = listOf(
"ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/",
"https://example.com/my-web2-claim.json",
"urn:recap:eyJhdHQiOnsiZWlwMTU1Ijp7InJlcXVlc3QvcGVyc29uYWxfc2lnbiI6W3siY2hhaW5zIjpbImVpcDE1NToxIl19XSwicmVxdWVzdC9ldGhfc2lnblR5cGVkRGF0YV92NCI6W3siY2hhaW5zIjpbImVpcDE1NToxIl19XX19fQ=="
)
)

private val privateKey = "305c6cde3846927892cd32762f6120539f3ec74c9e3a16b9b798b1e85351ae2a".hexToBytes()

@Test
fun signAndVerifyWithEIP191Test() {
print(payload.toCAIP122Message(chainName))
val message = payload.toCAIP122Message(chainName)
val message = payload.toCAIP222Message(chainName)
val signature: Cacao.Signature = cacaoSigner.sign(message, privateKey, SignatureType.EIP191)
val cacao = Cacao(CacaoType.EIP4361.toHeader(), payload, signature)
val cacao = Cacao(CacaoType.CAIP222.toHeader(), payload, signature)
val result: Boolean = cacaoVerifier.verify(cacao)
Assert.assertTrue(result)
}

@Test
fun signHexAndVerifyWithEIP191Test() {
print(payload.toCAIP122Message(chainName))
val message = payload.toCAIP122Message(chainName)
val signature: Cacao.Signature = cacaoSigner.signHex(Numeric.toHexString(message.toByteArray()), privateKey, SignatureType.EIP191)
val cacao = Cacao(CacaoType.EIP4361.toHeader(), payload, signature)
val message = payload.toCAIP222Message(chainName)
val signature: Cacao.Signature = cacaoSigner.sign(Numeric.toHexString(message.toByteArray()), privateKey, SignatureType.EIP191)
val cacao = Cacao(CacaoType.CAIP222.toHeader(), payload, signature)
val result: Boolean = cacaoVerifier.verify(cacao)
assert(result)
}
Expand All @@ -74,7 +74,7 @@ internal class CacaoTest {
)

val signatureString = "0xb518b65724f224f8b12dedeeb06f8b278eb7d3b42524959bed5d0dfa49801bd776c7ee05de396eadc38ee693c917a04d93b20981d68c4a950cbc42ea7f4264bc1c"
val signature: Cacao.Signature = Cacao.Signature(SignatureType.EIP1271.header, signatureString, payload.toCAIP122Message())
val signature: Cacao.Signature = Cacao.Signature(SignatureType.EIP1271.header, signatureString, payload.toCAIP222Message())
val cacao = Cacao(CacaoType.EIP4361.toHeader(), payload, signature)
val result: Boolean = cacaoVerifier.verify(cacao)
Assert.assertTrue(result)
Expand All @@ -99,7 +99,7 @@ internal class CacaoTest {
)

val signatureString = "0xdeaddeaddead4095116db01baaf276361efd3a73c28cf8cc28dabefa945b8d536011289ac0a3b048600c1e692ff173ca944246cf7ceb319ac2262d27b395c82b1c"
val signature: Cacao.Signature = Cacao.Signature(SignatureType.EIP1271.header, signatureString, payload.toCAIP122Message())
val signature: Cacao.Signature = Cacao.Signature(SignatureType.EIP1271.header, signatureString, payload.toCAIP222Message())
val cacao = Cacao(CacaoType.EIP4361.toHeader(), payload, signature)
val result: Boolean = cacaoVerifier.verify(cacao)
Assert.assertFalse(result)
Expand Down
Loading

0 comments on commit a12707b

Please sign in to comment.