Makeen plugin that provides files storage functionality.
Under the hood it uses hapi-auth-hawk for providing a holder-of-key authentication model this way to can share self-expiring pre-authenticated links to non-autneticated users without worring too much about security or password/credential leaks.
- Node v6 or higher
npm install makeen-storage
When registering the plugin you need to pass it uploadDir
- the path where files will be stored and bewitCredentials
- an object with key
and algorithm
(default is sha256) fields.
Once loaded the plugin will expose 4 REST endpoints for uploading, downloading, deleting and signing files:
DELETE /files/{fileId} Delete a file
GET /files/{fileId}/download Download a file
POST /files/sign-url Sign a file download
POST /files/upload Upload a file
On the backend the server also exposes the File and FileRepository octobus service containers. FileRepository service will export the CRUD database functionality while the File service container will provide the storage functionality for upload, download, signing and deleting files.
Because Makeen is a collection of plugins you will need a Hapi.js server to load and run them. To speed things up Makeen is providing the server component in the shape of a boilerplate which you can clone and install.