deamwork/trustoceanphp

PHP composer package for TrustOcean API call.

v0.1.3 2018-12-25 17:00 UTC

This package is auto-updated.

Last update: 2024-04-26 05:02:13 UTC


README

Composer package implementation for TrustOcean API.

Raw document provided by TrustOcean can be found in here, as well as their product definition.

Product list will update once TrustOcean updated it first.

Feel free to fork and open pull request to this package. Contributes are welcome.

Install

composer require deamwork/trustoceanphp

Usage

Make a json config file.

vi config.json

Config example

level can be partner or developer, will uses different API base uri and product definitions.

You can always set your own base API uri, fill it to api_base.

Don't forget to fill your TrustOcean username and password. It won't store and it only send to TrustOcean API. Details can be found in security section.

{
  "account": {
    "level": "developer",
    "username": "",
    "password": ""
  },
  "trustocean": {
    "api_base": null
  }
}

then, reference use TrustOcean\Core\Actions as TOAPI in your workflow.

Flow

Create new order

$flow = new TOAPI('/path/to/your/config.json');
$order = $flow->createOrder('TrustOcean Encryption365 SSL', 'quarterly', 3);
$order_id = $order['order_id'];

Add more SANs

$flow->addSANs($order_id, 3);

Upload CSR

$flow->uploadCSR($order_id, "CSR TEXT GOES HERE");

Set domain(s)

$flow->addDomains($order_id, [
    'a.domain.tld', 'b.domain.tld', 'c.domain.tld',
    'd.domain.tld', 'e.domain.tld', 'f.domain.tld',
]);

Remove domain(s)

$flow->removeDomain($order_id, [
    'd.domain.tld', 'e.domain.tld', 'f.domain.tld',
]);

Get order detail(s)

$flow->getOrderDetails($order_id);

Change verification method

$flow->changeDCVMethod($order_id, [
    'a.domain.tld' => 'admin@domain.tld',
    'b.domain.tld' => 'CSR_CNAME_HASH',
    'c.domain.tld' => 'HTTP_CSR_HASH',
]);

Call CA to verify your domain

$flow->reDoDCVCheck($order_id);
$flow->resendDCVEmail($order_id);

... or ...

$flow->resendDCVEmailReDoDCVCheck($order_id);

After verification, get your certs

$cert = $flow->getCertDetails($order_id);
print_r($cert['cert_code'], true); // get your certificate
print_r($cert['ca_code'], true);   // get CA certificate

Wants reissue?

$flow->setCertReissue($order_id);

Then redo the flow.

Testing

right in the todo list.

Contributing

See CONTRIBUTING for more information.

Security

This library only talks to the TrustOcean API, it will not store nor send your any information to any third party.

In fact? This library won't store anything

If you discover any security related issues, feel free to open a new issue and I will mark it as "Security" ASAP.

License

This project is open-sourced under MIT license.

This demand is required by TrustOcean, which to be honest, I prefer to choose BSD-3...