Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions Thirdweb.Tests/Thirdweb.Client/Thirdweb.Client.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public void ClientIdAndSecretKeyInitialization()
Assert.NotNull(client.ClientId);
Assert.NotNull(client.SecretKey);
Assert.Null(client.BundleId);
Assert.NotEqual(client.ClientId, clientId);
Assert.Equal(client.ClientId, Utils.ComputeClientIdFromSecretKey(client.SecretKey));
Assert.Equal(client.ClientId, clientId);
Assert.NotEqual(client.ClientId, Utils.ComputeClientIdFromSecretKey(client.SecretKey));
Assert.Equal(client.SecretKey, this.SecretKey);
}

Expand Down
13 changes: 3 additions & 10 deletions Thirdweb/Thirdweb.Client/ThirdwebClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,9 @@ private ThirdwebClient(
throw new InvalidOperationException("ClientId or SecretKey must be provided");
}

if (!string.IsNullOrEmpty(secretKey))
{
this.ClientId = Utils.ComputeClientIdFromSecretKey(secretKey);
this.SecretKey = secretKey;
}
else
{
this.ClientId = clientId;
}

// Respects provided clientId if any, otherwise computes it from secretKey
this.ClientId = !string.IsNullOrEmpty(clientId) ? clientId : (string.IsNullOrEmpty(secretKey) ? null : Utils.ComputeClientIdFromSecretKey(secretKey));
this.SecretKey = secretKey;
this.BundleId = bundleId;

this.FetchTimeoutOptions = fetchTimeoutOptions ?? new TimeoutOptions();
Expand Down
Loading