createHttpsWebhok static method

Future<Webhook> createHttpsWebhok(
  1. Telegram telegram,
  2. String url,
  3. File certificate,
  4. File privateKey, {
  5. String? ipAddress,
  6. int port = 80,
  7. int? serverPort,
  8. bool uploadCertificate = false,
  9. int maxConnections = 40,
  10. List<String>? allowedUpdates,
  11. bool? dropPendingUpdates,
  12. String? secretToken,
})

Implementation

static Future<Webhook> createHttpsWebhok(
    Telegram telegram, String url, io.File certificate, io.File privateKey,
    {String? ipAddress,
    int port = 80,
    int? serverPort,
    bool uploadCertificate = false,
    int maxConnections = 40,
    List<String>? allowedUpdates,
    bool? dropPendingUpdates,
    String? secretToken}) async {
  var server = await io.HttpServer.bindSecure(
      io.InternetAddress.anyIPv4.address,
      serverPort ?? port,
      io.SecurityContext()
        ..useCertificateChainBytes(certificate.readAsBytesSync())
        ..usePrivateKeyBytes(privateKey.readAsBytesSync()));
  return Webhook(telegram, url, server,
      ipAddress: ipAddress,
      certificate: certificate,
      privateKey: privateKey,
      port: port,
      serverPort: serverPort,
      uploadCertificate: uploadCertificate,
      maxConnections: maxConnections,
      allowedUpdates: allowedUpdates,
      secretToken: secretToken);
}