Skip to content

Commit 1d709b6

Browse files
committed
added project key to keymachine and guard requests
1 parent fae4d82 commit 1d709b6

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Packages/Sequence-Unity/Sequence/SequenceSDK/EcosystemWallet/Guard/GuardService.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1+
using System.Collections.Generic;
12
using System.Threading.Tasks;
3+
using Sequence.Config;
24
using Sequence.Utils;
35

46
namespace Sequence.EcosystemWallet
57
{
68
public class GuardService
79
{
10+
private readonly Dictionary<string, string> _headers = new()
11+
{
12+
{ "X-Access-Key", SequenceConfig.GetConfig().BuilderAPIKey }
13+
};
14+
815
private readonly HttpClient _client;
916

1017
public GuardService(string url)
@@ -20,7 +27,7 @@ public async Task<SignWithResponse> SignWith(SignWithArgs args)
2027
private async Task<TResponse> SendRequest<TArgs, TResponse>(string endpoint, TArgs args)
2128
{
2229
var path = $"rpc/Guard/{endpoint}";
23-
return await _client.SendPostRequest<TArgs, TResponse>(path, args);
30+
return await _client.SendPostRequest<TArgs, TResponse>(path, args, _headers);
2431
}
2532
}
2633
}

Packages/Sequence-Unity/Sequence/SequenceSDK/EcosystemWallet/KeyMachine/KeyMachineApi.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1+
using System.Collections.Generic;
12
using System.Threading.Tasks;
3+
using Sequence.Config;
24
using Sequence.EcosystemWallet.KeyMachine.Models;
35
using Sequence.Utils;
46

57
namespace Sequence.EcosystemWallet
68
{
79
internal class KeyMachineApi
810
{
11+
private readonly Dictionary<string, string> _headers = new()
12+
{
13+
{ "X-Access-Key", SequenceConfig.GetConfig().BuilderAPIKey }
14+
};
15+
916
private const string DefaultHost = "https://keymachine.sequence.app";
1017

1118
private readonly string _host;
@@ -43,7 +50,7 @@ public async Task<ConfigReturn> GetConfiguration(string imageHash)
4350

4451
private async Task<TReturn> SendRequest<TArgs, TReturn>(string endpoint, TArgs args)
4552
{
46-
return await _httpClient.SendPostRequest<TArgs, TReturn>("rpc/Sessions/" + endpoint, args);
53+
return await _httpClient.SendPostRequest<TArgs, TReturn>("rpc/Sessions/" + endpoint, args, _headers);
4754
}
4855
}
4956
}

0 commit comments

Comments
 (0)