Skip to content

Commit

Permalink
add optional http client in create()
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan-tbd committed May 7, 2024
1 parent 1bc9694 commit 5b9260c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/web5/lib/src/dids/did_dht/did_dht.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class DidDht {
List<DidService> services = const [],
List<DidDhtRegisteredDidType>? types,
List<DidCreateVerificationMethod> verificationMethods = const [],
http.Client? client,
}) async {
keyManager ??= InMemoryKeyManager();

Expand Down Expand Up @@ -85,8 +86,9 @@ class DidDht {
final message = await Bep44Message.create(dnsPacket.encode(), seq, sign);

final gatewayUrl = Uri.parse('$gatewayUri/$id');
// TODO: add optional client
final response = await http.Client().put(
final httpClient = client ??= http.Client();

final response = await httpClient.put(
gatewayUrl,
headers: {
'Content-Type': 'application/octet-stream',
Expand Down

0 comments on commit 5b9260c

Please sign in to comment.