Skip to content

A standalone client for signing API Gateway requests for Signature Version 4

License

Notifications You must be signed in to change notification settings

AnomalyInnovations/sigV4Client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sigV4Client

A standalone client for signing API Gateway requests for Signature Version 4. For more details, follow the steps from this chapter in the Serverless Stack tutorial.

How to use

You need crypto-js installed.

Copy sigV4Client.js to your project.

Create a new sigV4Client instance.

const signedRequest = sigV4Client
  .newClient({
    accessKey: AWS.config.credentials.accessKeyId,
    secretKey: AWS.config.credentials.secretAccessKey,
    sessionToken: AWS.config.credentials.sessionToken,
    region: YOUR_API_GATEWAY_REGION,
    endpoint: YOUR_API_GATEWAY_URL
  })
  .signRequest({
    method,
    path,
    headers,
    queryParams,
    body
  });

And make the request.

await fetch(signedRequest.url, {
  headers: signedRequest.headers,
  method,
  body
});

About

A standalone client for signing API Gateway requests for Signature Version 4

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published