Skip to content

Commit

Permalink
fixup! feat(binding-coap): add support for client certificates
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Oct 17, 2024
1 parent 10f3398 commit 4148ad5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/src/binding_coap/coap_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class _InternalCoapConfig extends CoapConfigDefault {
dtlsVerify = coapConfig.dtlsVerify,
dtlsWithTrustedRoots = coapConfig.dtlsWithTrustedRoots,
rootCertificates = coapConfig.rootCertificates,
clientCertificateFileName = coapConfig.clientCertificateFileName,
clientKeyFileName = coapConfig.clientKeyFileName,
clientCertificate = coapConfig.clientCertificate,
clientPrivateKey = coapConfig.clientPrivateKey,
_verifyPrivateKey = coapConfig.verifyPrivateKey;

@override
Expand All @@ -47,10 +47,10 @@ class _InternalCoapConfig extends CoapConfigDefault {
final List<Uint8List> rootCertificates;

@override
final String? clientCertificateFileName;
final coap.ClientCertificate? clientCertificate;

@override
final String? clientKeyFileName;
final coap.ClientPrivateKey? clientPrivateKey;

final bool _verifyPrivateKey;

Expand Down
9 changes: 5 additions & 4 deletions lib/src/binding_coap/coap_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import "dart:typed_data";

import "package:coap/coap.dart";
import "package:meta/meta.dart";

/// Allows for configuring the behavior of CoAP clients and servers.
Expand All @@ -22,8 +23,8 @@ class CoapConfig {
this.rootCertificates = const [],
this.dtlsWithTrustedRoots = true,
this.dtlsVerify = true,
this.clientKeyFileName,
this.clientCertificateFileName,
this.clientCertificate,
this.clientPrivateKey,
this.verifyPrivateKey = false,
});

Expand Down Expand Up @@ -62,10 +63,10 @@ class CoapConfig {
final Duration multicastDiscoveryTimeout;

/// Name of a file referring to a client certificate used with DTLS PKI mode.
final String? clientCertificateFileName;
final ClientCertificate? clientCertificate;

/// Name of a file referring to a private client key used with DTLS PKI mode.
final String? clientKeyFileName;
final ClientPrivateKey? clientPrivateKey;

/// Whether the private key of the client certificate should be verified when
/// creating the DTLS context.
Expand Down

0 comments on commit 4148ad5

Please sign in to comment.