filestack-policy

0.2.1 • Public • Published

filestack-policy

NPM version Build status Dependency Status License Downloads lmao

Filestack policy generator for Filestack.com. As described in the creating policies document.

Requirements

  • Tested on Node v6+

Install

npm i filestack-policy

Example

const { FilestackPolicy } = require('filestack-policy');
 
const policy = new FilestackPolicy({
    expiry: Date.now() + 3600 // default = 24hrs from present time
    path: '/path/to', // default === undefined e.g. *
    container: 's3bucket-name' // default === undefined e.g. *
    call: ['store', 'pick']: // default === [''] (no permissions granted)
    secret: 'YOUR_SECRET', // Required, no default. Alternatively import setDefaultSecret().
});
 
const json = policy.toJSON() // Returns URL Safe policy string
const signature = policy.sign() // Return URL safe policy signature

API

module.FilestackPolicy(options: obj): Constructor Creates new FilestackPolicy object with parameters in single object.

module.setDefaultSecret(secret: string): Function Applies default secret for FilestackPolicy constructor to use. Later I will make this setDefaultOpts.

FilestackPolicy.prototype.toURLEncoded() Function Returns URL safe policy.

FilestackPolicy.prototype.toJSON() Function Returns policy JSON.

FilestackPolicy.prototype.sign() Function Returns URL-safe signature (hashed with secret).

Readme

Keywords

none

Package Sidebar

Install

npm i filestack-policy

Weekly Downloads

0

Version

0.2.1

License

MIT

Unpacked Size

5.93 kB

Total Files

5

Last publish

Collaborators

  • danielgormly