Download the PHP package barseghyanartur/ska without Composer

On this page you can find all versions of the php package barseghyanartur/ska. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ska

ska

Lets you easily sign data, using symmetric-key algorithm encryption. Allows you to validate signed data and identify possible validation errors. Uses sha/hmac for signature encryption. Comes with shortcut functions for signing (and validating) dictionaries (associative arrays).

Packagist version Supported PHP versions Build Status License

Key concepts

Hosts, that communicate with each other, share the Secret Key, which is used to sign data (requests). Secret key is never sent around.

One of the cases is signing of HTTP requests. Each (HTTP) request is signed on the sender side using the shared Secret Key and as an outcome produces the triple (signature, auth_user, valid_until) which are used to sign the requests.

On the recipient side, (HTTP request) data is validated using the shared Secret Key. It's being checked whether signature is valid and not expired.

Features

Prerequisites

Eco-system

Need ska for other languages? Check the following affiliated projects:

Generated signatures are intercompatible between Python, NodeJS and PHP implementations.

Installation

Latest stable version from composer registry:

Usage examples

Usage example are present.

Basic usage

Sender side

Signing dictionaries is as simple as follows.

Required imports.
Sign data

Sample usage:

Sample output:

Adding of additional data to the signature works in the same way:

Sample output:

Options and defaults:

The signatureToDict function accepts an optional $options argument.

Default value for the validUntil in the $options is 10 minutes from now. If you want it to be different, set validUntil in the $options of the signatureToDict function.

Default lifetime of a signature is 10 minutes (600 seconds). If you want it to be different, set lifetime in the $options of the signatureToDict function.

Default name of the (GET) param holding the generated signature value is signature. If you want it to be different, set the signatureParam in the $options of the signatureToDict function.

Default name of the (GET) param holding the authUser value is auth_user. If you want it to be different, set authUserParam in the $options of the signatureToDict function.

Default name of the (GET) param holding the validUntil value is valid_until. If you want it to be different, set the validUntilParam in the $options of the signatureToDict function.

Default name of the (GET) param holding the extra value is extra. If you want it to be different, set the extraParam in the $options of the signatureToDict function.

Sample output:

Recipient side

Validating the signed request data is as simple as follows.

Validate signed requests

Validating the signed request data. Note, that $data value is expected to be a dictionary; $request->GET is given as an example.

Options and defaults:

Similarly to signatureToDict function, the validateSignedRequestData also accepts a number of optional arguments (which have been described above):

With some customizations, it would look as follows:

Testing

Simply type:

Code style

The Prettier is used.

License

MIT

Support

For any issues contact me at the e-mail given in the Author section.

Author

Artur Barseghyan [email protected]


All versions of ska with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ~8.0.0
ext-json Version *
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package barseghyanartur/ska contains the following files

Loading the files please wait ....