Skip to content

Commit

Permalink
Merge branch 'main' into ds/subscription_api
Browse files Browse the repository at this point in the history
* main:
  Handle duplicate certificates (#1425)
  • Loading branch information
nirinchev committed Nov 14, 2023
2 parents 9da1d1e + 581ceae commit f08b999
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,18 @@ he8Y4IWS6wY7bCkjCWDcRQJMEhg76fsO3txE+FiYruq9RUWhiF1myv4Q6W+CyBFC
Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5
-----END CERTIFICATE-----''';

final context = SecurityContext(withTrustedRoots: true);
context.setTrustedCertificatesBytes(const AsciiEncoder().convert(isrgRootX1CertPEM));
return HttpClient(context: context);
try {
final context = SecurityContext(withTrustedRoots: true);
context.setTrustedCertificatesBytes(const AsciiEncoder().convert(isrgRootX1CertPEM));
return HttpClient(context: context);
} on TlsException catch (e) {
if (e.osError?.message.contains("CERT_ALREADY_IN_HASH_TABLE") == true) {
// certificate is already trusted. Nothing to do here
return HttpClient();
} else {
rethrow;
}
}
}();

/// A class exposing configuration options for an [App]
Expand Down
Empty file removed topic.md
Empty file.

0 comments on commit f08b999

Please sign in to comment.