Skip to content

Commit

Permalink
fixup! feat: add dedicated certificate classes
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Dec 11, 2024
1 parent e962ac8 commit 31cf0c9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/src/certificate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@
import "dart:convert";
import "dart:typed_data";

import "package:meta/meta.dart";

/// Base class for certificates usable with OpenSSL.
@immutable
sealed class Certificate {
const Certificate();

/// The certificate in serialized form.
Uint8List get bytes;
}

/// A certificate in PEM format.
final class PemCertificate extends Certificate {
/// Creates a new [PemCertificate] from a [_certificateString].
PemCertificate(this._certificateString);
const PemCertificate(this._certificateString);

final String _certificateString;

Expand All @@ -24,7 +29,7 @@ final class PemCertificate extends Certificate {
/// A certificate in DER format.
final class DerCertificate extends Certificate {
/// Creates a new [DerCertificate] from a list of [_bytes].
DerCertificate(this._bytes);
const DerCertificate(this._bytes);

final Uint8List _bytes;

Expand Down

0 comments on commit 31cf0c9

Please sign in to comment.