0.0.2 • Published 5 years ago

@nutshelllab/aws4-signer v0.0.2

Weekly downloads
1
License
GNU GENERAL PUBLI...
Repository
github
Last release
5 years ago

node-aws-signer

Just a nodejs wrapper over AWS4 signer

Install

$ yarn add @nutshelllab/node-aws-signer

Usage

import sign from '@nutshelllab/node-aws-signer'

(async () => {
  const method = 'POST'
  const url = 'https://api.behindawsgateway.com/resources'
  const headers = { from: 'my-super-app' }
  const body = { name: 'MyResource' }
  
  const signedRequest = await sign(method, url, headers, body)
  return fetch(signedRequest.url, signedRequest)
})

API

sign(method, url, headers, body)

method

Type: string

HTTP method (GET, POST, PUT, PATCH, DELETE, ...).

url

Type: string

Request endpoint.

headers

Type: Object

Headers to be added to the request.

body

Type: Object

Request JSON payload.

License

MIT © Nutshell