From f3aac373363a5dd50a32cb9136196ae4292dd0fc Mon Sep 17 00:00:00 2001 From: Jan Romann Date: Fri, 6 Dec 2024 15:51:30 +0100 Subject: [PATCH] feat(binding_coap): add support for PEM root certificates --- lib/binding_coap.dart | 3 +++ lib/src/binding_coap/coap_client.dart | 3 +-- lib/src/binding_coap/coap_config.dart | 5 ++--- pubspec.yaml | 6 ++++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/binding_coap.dart b/lib/binding_coap.dart index f2b33fb7..5bbb288c 100644 --- a/lib/binding_coap.dart +++ b/lib/binding_coap.dart @@ -10,6 +10,9 @@ /// [spec link]: https://www.w3.org/TR/wot-binding-templates/ library binding_coap; +export "package:coap/coap.dart" + show Certificate, DerCertificate, PemCertificate; + export "src/binding_coap/coap_client_factory.dart"; export "src/binding_coap/coap_config.dart"; export "src/binding_coap/coap_server.dart"; diff --git a/lib/src/binding_coap/coap_client.dart b/lib/src/binding_coap/coap_client.dart index 1900cb21..8da3cf51 100644 --- a/lib/src/binding_coap/coap_client.dart +++ b/lib/src/binding_coap/coap_client.dart @@ -5,7 +5,6 @@ // SPDX-License-Identifier: BSD-3-Clause import "dart:async"; -import "dart:typed_data"; import "package:coap/coap.dart" as coap; import "package:coap/config/coap_config_default.dart"; @@ -41,7 +40,7 @@ class _InternalCoapConfig extends CoapConfigDefault { final bool dtlsWithTrustedRoots; @override - final List rootCertificates; + final List rootCertificates; } coap.PskCredentialsCallback? _createPskCallback( diff --git a/lib/src/binding_coap/coap_config.dart b/lib/src/binding_coap/coap_config.dart index 462c906d..cef0b957 100644 --- a/lib/src/binding_coap/coap_config.dart +++ b/lib/src/binding_coap/coap_config.dart @@ -4,8 +4,7 @@ // // SPDX-License-Identifier: BSD-3-Clause -import "dart:typed_data"; - +import "package:coap/coap.dart"; import "package:meta/meta.dart"; /// Allows for configuring the behavior of CoAP clients and servers. @@ -34,7 +33,7 @@ class CoapConfig { final String? dtlsCiphers; /// List of custom root certificates to use with OpenSSL. - final List rootCertificates; + final List rootCertificates; /// The port number used by a client or server. Defaults to 5683. final int port; diff --git a/pubspec.yaml b/pubspec.yaml index 4e67b4bb..9c50de55 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,3 +31,9 @@ dependencies: typed_data: ^1.3.2 uri: ^1.0.0 uuid: ^4.2.1 + +dependency_overrides: + coap: + git: + url: https://github.com/namib-project/coap + ref: dtls2-security-level