Socket
Socket
Sign inDemoInstall

s3-post-policy

Package Overview
Dependencies
8
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 2.0.0

32

lib/index.js
var aws4_sign = require("aws4-signature");
var clone = require("clone");
var Joi = require("joi");
var url_template = require("url-template");
var s3_host = url_template.parse("https://{bucket}.s3.amazonaws.com");
var s3_regions = [
"ap-northeast-1",
"ap-southeast-1",
"ap-southeast-2",
"eu-central-1",
"eu-west-1",
"sa-east-1",
"us-east-1",
"us-west-1",
"us-west-2"
];
var valid_options = Joi.object().keys({
id: Joi.string(),
secret: Joi.string(),
date: Joi.date(),
region: Joi.string().valid(s3_regions),
bucket: Joi.string(),
policy: Joi.object().keys({
expiration: Joi.date(),
conditions: Joi.array()
})
});
module.exports = function policy_gen(options) {
// Validation options passed in
var valid = Joi.validate(options, valid_options, {
presence: "required"
});
if (valid.error) {
throw valid.error;
}
// Convert the date to the format that AWS uses

@@ -9,0 +41,0 @@ var date_time = new Date(options.date).toISOString().replace(/[:\-]|\.\d{3}/g, "");

3

package.json
{
"name": "s3-post-policy",
"version": "1.0.0",
"version": "2.0.0",
"description": "A POST policy generator for S3 using AWS Signature Version 4",

@@ -12,2 +12,3 @@ "main": "lib/index.js",

"clone": "^0.2.0",
"joi": "^5.1.0",
"url-template": "^2.0.4"

@@ -14,0 +15,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc