poggit / libasynql

Asynchronous MySQL access library for PocketMine plugins.
https://poggit.github.io/libasynql
Apache License 2.0
134 stars 44 forks source link

Implement SSL Support #96

Closed sylvrs closed 1 year ago

sylvrs commented 1 year ago

Overview

Before this pull request, libasynql lacked the ability to connect to a MySQL server using an SSL connection (as seen by #80). This pull request aims to resolve that by adding a simple wrapper using an SSL credentials class (MysqlSslCredentials) and matching configuration options. These configuration options can be used like so:

database:
  type: mysql
  mysql:
    # ...
    ssl:
      key: ""
      certificate: ""
      ca-certificate: ""
      ca-path: ""
      cipher-algorithms: ""

Testing

Using two instances, one with SSL and one without SSL, I was able to confirm that the functionality remains the same. Furthermore, errors are properly thrown if an SSL instance is not given the proper credentials.

Backwards Compatibility

Compatibility for the library remains the same as the SSL credentials are nullable and prefilled with a null value for both fromArray and the constructor.