0.7.2 • Published 8 years ago
@sepior/s3 v0.7.2
Sepior node-s3
This is the Sepior S3 Library. This can be used on Node to handle Sepior encrypted files on Amazon S3.
Building the SDK
Make sure you have node installed (version 6 or later). Then do
npm installUsage
First you need to initialise AWS and Sepior clients:
const AWS = require('aws-sdk')
const {SepiorServicesClient} = require('@sepior/sdk')
const {SepiorServicesS3} = require('@sepior/s3')
const awsS3Client = new AWS.S3()
awsS3Client.config.update({accessKeyId: 'accessKeyId', secretAccessKey: 'secretAccessKey'})
const sepiorClient = SepiorServicesClient.createPasswordBasedClient(['ks1.example.com', 'ks2.example.com', 'ks3.example.com'], 'someAppId', {'username': 'username', 'password': 'password'})
const seps3 = SepiorServicesS3.fetchClient(sepiorClient, awsS3Client)Encrypting and uploading a file is done like this:
const fs = require('fs')
const inStream = fs.createReadStream('./foo.txt')
seps3.uploadData(s3Bucket, s3Key, inStream)
.then(data => {
console.log('Done')
})You can also encrypt and upload a buffer by passing a buffer to uploadData instead of a stream.
Downloading and decrypting is very similar:
seps3.downloadData(s3Bucket, s3Key)
.then(stream => {
const outStream = fs.createWriteStream('./foo.txt')
stream.pipe(outStream)
})Tests
To run the tests you must first set the proper credentials in environment variables (see test/test.json) and then run:
npm testContributing
When contributing changes remember to update the CHANGELOG.md.
Releasing
When releasing a new version (x.x.x) do the following:
- Update the change log by creating a new section (headed x.x.x) containing the content of the unreleased section
- Correct the package version in
package.json - Commit these changes with the message:
chore: Release x.x.xNotice: This commit should only contain the changes topackage.jsonandCHANGELOG.md - Tag this commit
git tag -a x.x.x -m "Release x.x.x" - Push commit and merge to master.
- Push tags.