Download the PHP package legalthings/lto-api without Composer
On this page you can find all versions of the php package legalthings/lto-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package lto-api
LTO Network client for PHP
Signing and addresses work both for the (private) event chain as for the public chain.
Installation
composer require lto/api
Accounts
Creation
Create an account from seed
Create an account from sign key
Create an account from full info
Properties that are specified will be verified. Properties that are omitted will be generated where possible.
Signing (ED25519)
Sign a message
Verify a signature
Encryption (X25519)
Encrypt a message for another account
You can use $account->encryptFor($account, $message);
to encrypt a message for yourself.
Decrypt a message received from another account
You can use $account->decryptFrom($account, $message);
to decrypt a message from yourself.
Public layer
Private layer
Event chain
Create a new event chain
Note: You need to add an identity as first event on the chain. This is not done automatically.
Create and sign an event and add it to an existing event chain
You need the chain id and the hash of the last event to use an existing chain.
HTTP Authentication
Signing HTTP Messages is described IETF draft draft-cavage-http-signatures-10.
The HTTP Authentication library can be used to sign and verify PSR-7 requests.
This library can be used in conjunction with the HTTP authentication library. The keyId
should be the base58 encoded
public key.
For POST
and PUT
requests, it's recommended to create an HTTP Digest
(RFC 3230). This is a hash of the body, which manages to indirectly include the
body in the signature. See the HTTP Digest library.
Creating the HTTP Authentication service
Server middleware
Create server middleware to verify incoming requests.
The LTO\Account\ServerMiddleware
can be used to set the account
attribute for a server request that contains a
signature_key_id
attribute.
The server middleware implements the PSR-15 MiddlewareInterface
for single pass support and returns a callback for
double pass with the asDoublePass()
method.
Client middleware
Create client middleware to sign outgoing requests.
Commandline scripts
Generate account from seed
Get the seed from stdin
to generate account info.
By default a mainnet (L
) address is generated. Pass T
as argument to create a testnet address.
Account info
Show account info from the secret key. The secret key should be base58 encoded.
By default a mainnet (L
) address is generated. Pass T
as third argument to create a testnet address.
Sign message
Sign a message (from stdin
). The secret key should be base58 encoded. Outputs the signature and hash (base58
encoded).
All versions of lto-api with dependencies
ext-json Version *
ext-sodium Version *
legalthings/base58-compat Version ^0.1.0
psr/http-message Version ^1.0
psr/http-server-middleware Version ^1.0