Skip to content

Commit e6ef4af

Browse files
authored
Merge pull request WalletConnect#85 from WalletConnect/fix/pairing-validation
add validation checks for pairing topic
2 parents f7049b4 + dba6089 commit e6ef4af

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

WalletConnectSharp.Core/Controllers/Pairing.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,17 @@ public async Task<PairingStruct> Pair(string uri, bool activatePairing = true)
127127
var topic = uriParams.Topic;
128128
var symKey = uriParams.SymKey;
129129
var relay = uriParams.Relay;
130+
131+
if (this.Store.Keys.Contains(topic))
132+
{
133+
throw new ArgumentException($"Topic {topic} already has pairing");
134+
}
135+
136+
if (await this.Core.Crypto.HasKeys(topic))
137+
{
138+
throw new ArgumentException($"Topic {topic} already has keychain");
139+
}
140+
130141
var expiry = Clock.CalculateExpiry(Clock.FIVE_MINUTES);
131142
var pairing = new PairingStruct()
132143
{

0 commit comments

Comments
 (0)