Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign 2.5 #1296

Merged
merged 187 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
e6ec797
Merge branch 'gitignore_update' of github.com:WalletConnect/WalletCon…
jakubuid Dec 11, 2023
efce688
Add SessionAuthenticate Rpc
jakubuid Dec 11, 2023
50de60c
Add AuthenticateSessionUseCase.kt
jakubuid Dec 11, 2023
a1859e8
Implement AuthenticateSessionUseCase.kt
jakubuid Dec 11, 2023
c471ec7
Add OnSessionAuthenticateResponseUseCase.kt and OnSessionAuthenticate…
jakubuid Dec 11, 2023
d6f5d8d
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Dec 12, 2023
bb536de
Implement OnSessionAuthenticateUseCase.kt
jakubuid Dec 12, 2023
1bc6b98
Add ApproveSessionAuthenticateUseCase.kt and RejectSessionAuthenticat…
jakubuid Dec 12, 2023
68b96e9
Implement ApproveSessionAuthenticateUseCase.kk
jakubuid Dec 13, 2023
08b461e
Implement RejectSessionAuthenticateUseCase.kk
jakubuid Dec 13, 2023
7f40296
Implement OnSessionAuthenticateResponseUseCase.kk
jakubuid Dec 13, 2023
13c53a7
Add onSessionAuthenticateResponse event in SignProtocol.kt
jakubuid Dec 13, 2023
9ac915b
Change name
jakubuid Dec 13, 2023
2b37a43
Add FormatAuthenticateMessageUseCase.kt
jakubuid Dec 13, 2023
ad4c2e2
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Dec 13, 2023
a0377e2
Add utils for generating CACAO
jakubuid Dec 13, 2023
aa74837
Add formatAuthMessage to w3w
jakubuid Dec 13, 2023
a281368
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Dec 14, 2023
9df467a
Add test for session authenticate pair
jakubuid Dec 14, 2023
c405596
Add session authenticate rejection test
jakubuid Dec 14, 2023
ddf52c2
Add session authenticate approve test
jakubuid Dec 15, 2023
38bad60
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Dec 15, 2023
8606271
Add session authenticate methods to w3w
jakubuid Dec 15, 2023
16a8e5a
Add session authenticated methods to modals
jakubuid Dec 15, 2023
668b587
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Dec 15, 2023
6fde6cb
Merge branch 'caip_222' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Dec 15, 2023
1d71351
Address PR comments
jakubuid Dec 20, 2023
cfab8af
Merge branch 'caip_222' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Dec 20, 2023
fddd7f3
Align methods names with specs
jakubuid Dec 20, 2023
e9ff3ba
Address PR comments
jakubuid Jan 2, 2024
904f510
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Jan 2, 2024
cf0607a
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Jan 2, 2024
ab8ad34
Merge branch 'caip_222' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Jan 2, 2024
4aca1d5
Fix authenticate public params
jakubuid Jan 2, 2024
4e2c5bc
Refactor params to be in line with specs
jakubuid Jan 2, 2024
64d19b6
Add test for encoding and decoding recaps
jakubuid Jan 3, 2024
7d6015c
Encode ReCaps
jakubuid Jan 3, 2024
95def21
Adjust integration tests to new params
jakubuid Jan 3, 2024
bd70809
Merge pull request #1267 from WalletConnect/caip_222
jakubuid Jan 4, 2024
63220ed
Add ReCaps integration tests
jakubuid Jan 4, 2024
ccf8b71
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Jan 4, 2024
960558b
Add alphabetic sort for actions
jakubuid Jan 4, 2024
7cb8e8e
ReCaps decoding
jakubuid Jan 5, 2024
b25de03
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Jan 5, 2024
eeec72b
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Jan 5, 2024
caad190
Set iat internally
jakubuid Jan 5, 2024
cc07a33
Add isAuthenticate flag to Session
jakubuid Jan 5, 2024
cea30b0
Authenticates session with ReCaps flow
jakubuid Jan 5, 2024
ac843be
Authenticates session with ReCaps flow
jakubuid Jan 5, 2024
50ce3c0
Send session request over authenticated session flow
jakubuid Jan 5, 2024
343effd
Fix statement generation
jakubuid Jan 8, 2024
59a3d48
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Jan 25, 2024
ea45ebb
Resolve merge conflicts
jakubuid Jan 25, 2024
3702609
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Jan 30, 2024
ac0494d
Implement missing method
jakubuid Jan 30, 2024
bf373a4
Add migration
jakubuid Jan 30, 2024
995fc33
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Jan 31, 2024
ad4e440
Fix merging
jakubuid Jan 31, 2024
9d9a699
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Jan 31, 2024
bd988cc
Fix merging
jakubuid Jan 31, 2024
d04eece
Address PR comments
jakubuid Jan 31, 2024
5082f79
Add dynamic switcher
jakubuid Feb 1, 2024
92b3c1b
Merge pull request #1272 from WalletConnect/sign_2.5_recaps
jakubuid Feb 2, 2024
497fdf9
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Feb 2, 2024
0a1c34a
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Feb 2, 2024
847ab9c
Fix testing and add more logs
jakubuid Feb 2, 2024
fa76a1c
Send authenticate from dapp successfully
jakubuid Feb 2, 2024
b8b4534
Session authenticate flow
jakubuid Feb 4, 2024
739ffa1
Send request over authenticated session
jakubuid Feb 4, 2024
dd13b4e
Display all auth messages
jakubuid Feb 4, 2024
6700daa
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Feb 4, 2024
8bb59cc
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Feb 4, 2024
b5a1de5
Merge branch 'feat/dynamic_switcher' of github.com:WalletConnect/Wall…
jakubuid Feb 4, 2024
50b7788
Address PR comments
jakubuid Feb 5, 2024
ca63ea1
Implement fallback in SessionAuthenticateUseCase
jakubuid Feb 6, 2024
d3ea682
Merge branch 'feat/dynamic_switcher' of github.com:WalletConnect/Wall…
jakubuid Feb 6, 2024
288b70e
Fix
jakubuid Feb 6, 2024
14575a8
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Feb 6, 2024
14974b4
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Feb 6, 2024
210921e
Merge branch 'feat/dynamic_switcher' of github.com:WalletConnect/Wall…
jakubuid Feb 6, 2024
9368d9a
Fix calling onSuccess twice
jakubuid Feb 6, 2024
5b83f2b
Subscribe and publish
jakubuid Feb 6, 2024
a1bf5ca
Dynamic switcher update
jakubuid Feb 6, 2024
74351b0
Add tests for CapBox
jakubuid Feb 7, 2024
d5badd8
Merge pull request #1300 from WalletConnect/feat/dynamic_switcher
jakubuid Feb 9, 2024
f748d16
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Feb 9, 2024
4966dd0
Fix testing
jakubuid Feb 9, 2024
08d1652
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Feb 9, 2024
8b7a88a
Clean up
jakubuid Feb 9, 2024
b2f655c
Add runCatching
jakubuid Feb 9, 2024
14f3099
Fix parsing recaps
jakubuid Feb 11, 2024
0b09ee5
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Feb 11, 2024
cbda1f7
Merge branch 'feat/samples_for_session_authenticate' of github.com:Wa…
jakubuid Feb 11, 2024
1779c0f
Clean up
jakubuid Feb 11, 2024
24d0be8
Add todo
jakubuid Feb 12, 2024
51b5268
Merge pull request #1305 from WalletConnect/feat/samples_for_session_…
jakubuid Feb 12, 2024
17b68cf
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Feb 12, 2024
226b21b
Add named params
jakubuid Feb 12, 2024
fb4353c
Add generateAuthPayloadParams
jakubuid Feb 12, 2024
d6b81d1
Allow a wallet to modify recaps
jakubuid Feb 13, 2024
a1d1a6b
Add throws annotations
jakubuid Feb 13, 2024
50e5e2a
Merge pull request #1318 from WalletConnect/fix/recaps_parsing
jakubuid Feb 13, 2024
9ab8b65
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Feb 13, 2024
de60bdf
Add GenerateAuthPayloadParamsTest
jakubuid Feb 13, 2024
c120e0e
Add more tests for parsing and decoding ReCaps
jakubuid Feb 13, 2024
dd1745d
Fix Cacao tests
jakubuid Feb 13, 2024
a727b32
Compatibility with iOS
jakubuid Feb 14, 2024
d7ece3b
Add session authenticate expiry and validation
jakubuid Feb 15, 2024
366b659
Remove isAuthenticated flag
jakubuid Feb 15, 2024
e7c354c
Add GetPendingAuthenticateRequestUseCase
jakubuid Feb 15, 2024
f6760a7
Handle case with no methods - authentication without a session
jakubuid Feb 15, 2024
31d803f
Merge pull request #1320 from WalletConnect/sign_2_5/allow_wallet_upd…
jakubuid Feb 15, 2024
bee3448
Add Dynamic Switcher button to Dapp
jakubuid Feb 15, 2024
0ab0457
Deprecate Auth
jakubuid Feb 15, 2024
ad9ed3d
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Feb 15, 2024
96df48e
Fix DB migration
jakubuid Feb 15, 2024
6fd1440
Return pairing url when both session authenticate and proposal succeeded
jakubuid Feb 16, 2024
1fed6e2
Add chains dynamically to session authenticate
jakubuid Feb 16, 2024
8f3cd26
Fix crash when events list is empty
jakubuid Feb 16, 2024
cedf81a
Improve chains validation
jakubuid Feb 16, 2024
e23f859
Fix CapBox support
jakubuid Feb 16, 2024
e7357b9
Enable notifications for authenticated sessions
jakubuid Feb 17, 2024
520f429
Test fixing
jakubuid Feb 19, 2024
4d0323e
Remove prints
jakubuid Feb 19, 2024
d18f60b
Fixes after cross-platform testing
jakubuid Feb 20, 2024
b9e952d
Fix updating connection list after approving the session authenticate
jakubuid Feb 20, 2024
c5b247b
Fix replaceWith
jakubuid Feb 20, 2024
17422d9
Add more logs
jakubuid Feb 20, 2024
a170a28
Merge pull request #1324 from WalletConnect/sign_2_5/final_remarks
jakubuid Feb 20, 2024
8148f5a
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Feb 20, 2024
41879ef
Test fixing
jakubuid Feb 20, 2024
00e07ad
Test fixing
jakubuid Feb 21, 2024
4045fc1
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Feb 21, 2024
3196368
Remove iat from request
jakubuid Feb 21, 2024
37a1936
Fix KeyServer tests
jakubuid Feb 21, 2024
e512966
Trigger internal samples release on dispatch
jakubuid Feb 21, 2024
0615f16
Trigger internal samples release on dispatch
jakubuid Feb 21, 2024
0cf0ea4
Trigger internal samples release on dispatch
jakubuid Feb 21, 2024
884c110
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Feb 21, 2024
25fc06d
Add proguard rules
jakubuid Feb 21, 2024
311f00a
Signing uptade
jakubuid Feb 23, 2024
2e597cb
Add pro guard rules for web3wallet
jakubuid Feb 26, 2024
0689eea
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Feb 27, 2024
54b7556
Fix iat handling
jakubuid Feb 27, 2024
be7a1c7
Add QR display for Sign 2.5
jakubuid Feb 28, 2024
a2f83e7
Change method names
jakubuid Feb 28, 2024
6f95d6e
Increase publish timeout
jakubuid Feb 28, 2024
ba896dd
Change aud to uri in public interface
jakubuid Feb 28, 2024
bfdb42f
Improve showing message flow
jakubuid Feb 28, 2024
3b7c387
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Feb 28, 2024
1d69f54
Add version
jakubuid Feb 28, 2024
9e859bb
Fix signing a message
jakubuid Feb 28, 2024
2cf878b
Improve signing a messages on a wallet
jakubuid Feb 29, 2024
f3ecc06
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Feb 29, 2024
564949b
Merge pull request #1332 from WalletConnect/feat/improve_authenticate…
jakubuid Feb 29, 2024
2091a61
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Mar 5, 2024
4fc8c5f
Add events to authenticated session
jakubuid Mar 5, 2024
ebae134
Add default implementations to Web3Wallet interface
jakubuid Mar 7, 2024
314b5e0
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Mar 7, 2024
9e01512
Default optional fields to null
jakubuid Mar 8, 2024
76bc333
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Mar 11, 2024
af6db1f
Base64 without padding
jakubuid Mar 11, 2024
32e4943
Handle recaps as the final position on the resources list
jakubuid Mar 11, 2024
df1089a
Merge ReCaps before sending session authenticate
jakubuid Mar 11, 2024
b4d01a0
Add tests for merging ReCaps
jakubuid Mar 11, 2024
1d16ae4
Add tests for Cacao Utils functions
jakubuid Mar 11, 2024
b0a9a24
Merge statements on the wallet side
jakubuid Mar 11, 2024
e0a26a9
Kotlin and JS compatible
jakubuid Mar 12, 2024
c5599c9
Move tests into androidTest dir
jakubuid Mar 13, 2024
f63e8c7
Merge pull request #1342 from WalletConnect/fix/inconsystency_in_recaps
jakubuid Mar 13, 2024
bbd9951
Fix building a statement
jakubuid Mar 13, 2024
52c1425
Add default methods and events
jakubuid Mar 13, 2024
e270666
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Mar 13, 2024
9266697
Add CapBox
jakubuid Mar 14, 2024
3b51564
With is already registered flow
jakubuid Mar 14, 2024
f4ede0c
Merge branch 'develop' of github.com:WalletConnect/WalletConnectKotli…
jakubuid Mar 14, 2024
146cb3b
Merge branch 'sign_2.5' of github.com:WalletConnect/WalletConnectKotl…
jakubuid Mar 14, 2024
55a8a3d
Simplify IsRegisteredUseCase
jakubuid Mar 14, 2024
0c288c2
Update
jakubuid Mar 14, 2024
9784be2
Remove allApps flag
jakubuid Mar 15, 2024
76e52ac
Merge pull request #1344 from WalletConnect/feat/cap_box
jakubuid Mar 15, 2024
86b45eb
Improve readability
jakubuid Mar 15, 2024
7f9e3a3
Add check if session authenticate is implemented
jakubuid Mar 15, 2024
1b9c52b
Clean up
jakubuid Mar 15, 2024
5b68e8e
Clean up
jakubuid Mar 15, 2024
3e55bb6
Merge pull request #1346 from WalletConnect/feat/enable_authenticate
jakubuid Mar 18, 2024
8023f24
Update Sign integration tests
jakubuid Mar 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.Ignore
Expand All @@ -32,27 +30,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 @@ -76,7 +76,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 @@ -101,7 +101,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
Loading