https://github.com/paragonie/quill
Library for quickly and easily writing data to a Chronicle instance
https://github.com/paragonie/quill
Last synced: 11 months ago
JSON representation
Library for quickly and easily writing data to a Chronicle instance
- Host: GitHub
- URL: https://github.com/paragonie/quill
- Owner: paragonie
- License: other
- Created: 2017-12-12T03:08:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-05-08T17:16:03.000Z (about 2 years ago)
- Last Synced: 2024-08-10T10:38:17.995Z (almost 2 years ago)
- Language: PHP
- Size: 24.4 KB
- Stars: 21
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Quill
[](https://github.com/quill/actions)
[](https://packagist.org/packages/paragonie/quill)
[](https://packagist.org/packages/paragonie/quill)
[](https://packagist.org/packages/paragonie/quill)
[](https://packagist.org/packages/paragonie/quill)
Quill is a library for publishing data to a [Chronicle](https://github.com/paragonie/chronicle) instance.
**Requires PHP 7.1 or newer. PHP 7.2+ is recommended.**
A [monolog handler](https://github.com/paragonie/monolog-quill) is also available.
## Installing
```sh
composer require paragonie/quill
```
## Usage
```php
setChronicleURL('https://chronicle-public-test.paragonie.com/chronicle')
->setServerPublicKey(
new SigningPublicKey(
Base64UrlSafe::decode('3BK4hOYTWJbLV5QdqS-DFKEYOMKd-G5M9BvfbqG1ICI=')
)
)
->setClientID('**Your Client ID provided by the Chronicle here**')
->setClientSecretKey(
new SigningSecretKey('/* Loaded from the filesystem or something. */')
);
$quill->write("Important security notice goes here.");
```
### Writing Data (Unencrypted)
There are two main API methods that do the same thing but differ in their return
values:
* `write(string $input): ResponseInterface`
* Returns the PSR-7 Response object, or throws an exception
* `blindWrite(string $input): bool`
* Returns `TRUE` or `FALSE`
### Writing Data (Symmetric Encryption)
If you want to encrypt your messages using a [shared encryption key](https://github.com/paragonie/sapient/blob/master/docs/Internals/CryptographyKey.md):
* `writeEncrypted(string $input, SharedEncryptionKey $key): ResponseInterface`
* Returns the PSR-7 Response object, or throws an exception
* `blindWriteEncrypted(string $input, SharedEncryptionKey $key): bool`
* Returns `TRUE` or `FALSE`
### Writing Data (Asymmetric Encryption)
If you want to encrypt your messages using a [public-key cryptography](https://github.com/paragonie/sapient/blob/master/docs/Internals/CryptographyKey.md):
* `writeSealed(string $input, SealingPublicKey $key): ResponseInterface`
* Returns the PSR-7 Response object, or throws an exception
* `blindWriteSealed(string $input, SealingPublicKey $key): bool`
* Returns `TRUE` or `FALSE`