New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-aws4

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-aws4

Signs and prepares requests using AWS Signature Version 4 in React Native Apps

latest
Source
npmnpm
Version
1.2.1
Version published
Maintainers
1
Created
Source

AWS4 React Native

GitHub Logo

NOTE: This package is a stabe fork of aws4 and aws4-react-native modified to work with React Native apps. With the most important change - fix Buffer dependencies. The core Node JS module querystring has been replaced by querystring-browser, and crypto has been replaced by a standalone javascript file crypto.js generated using browserify.

What follows is the a slighly modified README from aws4.

Example

import aws4 from 'react-native-aws4';

// given an options object you could pass to http.request
const opts = {
  host: 'sqs.us-east-1.amazonaws.com',
  path: '/?Action=ListQueues'
};

// alternatively (as aws4 can infer the host):
opts = {
  service: 'sqs', 
  region: 'us-east-1', 
  path: '/?Action=ListQueues'
}

// alternatively (as us-east-1 is default):
opts = {
  service: 'sqs', 
  path: '/?Action=ListQueues'
}

aws4.sign(opts) // assumes AWS credentials are available in process.env

console.log(opts)
/*
{
  host: 'sqs.us-east-1.amazonaws.com',
  path: '/?Action=ListQueues',
  headers: {
    Host: 'sqs.us-east-1.amazonaws.com',
    'X-Amz-Date': '20121226T061030Z',
    Authorization: 'AWS4-HMAC-SHA256 Credential=ABCDEF/20121226/us-east-1/sqs/aws4_request, ...'
  }
}
*/

// we can now use this to query AWS using the standard React Native API
const url = "https://" + signedOptions.host + signedOptions.path;
fetch(url, signedOptions)
  .then(body => body.json())
  .then(json => console.log(json));
// The above code is equivalent to the following Node JS request:
// http.request(opts, function(res) { res.pipe(process.stdout) }).end()
/*
*/

Keywords

amazon

FAQs

Package last updated on 21 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts