Coder Social home page Coder Social logo

michalpierzchlewicz / filestack-policy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danielgormly/filestack-policy

0.0 1.0 0.0 18 KB

πŸ“‚πŸ₯ž Filestack policy generator

Home Page: https://www.npmjs.com/package/filestack-policy

JavaScript 100.00%

filestack-policy's Introduction

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).

filestack-policy's People

Watchers

MichaΕ‚ Pierzchlewicz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.