acme_client 2.0.0 copy "acme_client: ^2.0.0" to clipboard
acme_client: ^2.0.0 copied to clipboard

ACME client which allows you to obtain a HTTPS Certificate from any ACME CA such as Lets Encrypt.

example/acme_client_example.dart

// Example code intentionally writes progress to stdout.
// ignore_for_file: avoid_print

import 'dart:io';

import 'package:acme_client/acme_client.dart';

void main(List<String> args) async {
  const persistedCredentialsPath = 'acme-account-credentials.json';
  const connection = AcmeConnection.staging;
  final newCredentials = AcmeAccountCredentials.generate(
    acceptTerms: true,
    contacts: ['mailto:jon@doe.com'],
  );

  // First run: generate fresh account credentials, create an ACME account,
  // and persist the credentials so the same account can be restored later.
  final createdAccount = await Account.create(
    newCredentials,
    connection: connection,
  );
  await File(persistedCredentialsPath).writeAsString(newCredentials.toJson());
  print('Persisted account credentials to $persistedCredentialsPath');
  print('Created account: ${createdAccount.accountURL}');
  print(
    'Use fetch_account_example.dart for a load-or-create credential flow '
    'that stores the key outside the repository.',
  );
}
1
likes
140
points
632
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

ACME client which allows you to obtain a HTTPS Certificate from any ACME CA such as Lets Encrypt.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

basic_utils, dio, jose, json_annotation, meta

More

Packages that depend on acme_client