filestack-policy
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 = ; const policy = expiry: Date + 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 // Returns URL Safe policy stringconst signature = policy // 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).