sinkab/secret-server

This is a server that store some secret, and it publish those at an unique URL

dev-master 2017-07-17 15:53 UTC

This package is not auto-updated.

Last update: 2024-05-03 18:40:55 UTC


README

Installation

$ composer require sinkab/secret-server "dev-master"

Create an index.php file into your web folder

Copy this code and actualize that

<?php
require __DIR__.'/vendor/autoload.php';
//setting up your database parameters
$config['db'] = [
    'host' => 'localhost',
    'user' => 'dbuser',
    'password' => 'dbuserpassword',
    'database_name' => 'secret_server'
];

$secret = new \Sinkab\SecretServer($config);

Copy .htaccess file into your web folder

Basic Usage

This API contain two feathure

1. add a secret: yourdomain/v1/xml | json/secret use POST method

Params:

    secret - This is the secret text (string /required)
    expireAfterViews - How many times the secret can be viewed (integer, > 0, require)
    expireAfter - The secret cannot be reached after this time (integer, 0 - it does not expire, expire time in mintues, require)

The params send in the "application/x-www-form-urlencoded" format, e.g.

secret=big%20%secret&expireAfterViews=10&expireAfter=10

2. get a secret: yourdomain/v1/xml | json/secret/secret_hash_code use GET method

The type of answer is depending of the URL's part xml | json

Test page

testpage