Skip to content

Sign URLs with expiration date to transfer data between projects.

Notifications You must be signed in to change notification settings

ozanhazer/safelink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SafeLink

Unit Tests

Framework-agnostic, lightweight URL signer. You can use SafeLink to transfer data between projects.

Sign the url in project 1:

use Alfatron\SafeLink;

$safelink = new SafeLink('my-not-short-private-key');
$safelink->redirect('https://second-project/path', ['user' => '[email protected]', 'action' => 'feed the cat'])

Retrieve it in project 2:

use Alfatron\SafeLink;

$safelink = new SafeLink('my-not-short-private-key');
$data = $safeLink->verify();
assert($data['user'], '[email protected]');

Features

  • Uses built-in php serializer to serialize the data to be transferred.
  • Can transfer any php type that can be serialized: object, array, string, integer.
  • Supports php 7.0+.
  • Has a default timeout of 10sec.s (customizable).
  • Uses openssl extension to encrypt the data (AES-256 CBC)

Installation

Run composer require ozanhazer/safe-link and you're good to go!

Options

Timeout is 10sec.s by default to avoid replay attacks. You can change it like:

use Alfatron\SafeLink;

$safeLink = new SafeLink($privateKey, ['timeout' => 2]);

About

Sign URLs with expiration date to transfer data between projects.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages