Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zirkelc committed Jan 12, 2025
1 parent 175e38b commit 50f4a1e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

This repository contains two libraries to sign HTTP requests with AWS Signature Version 4 (SigV4):

- `aws-sigv4-fetch` creates a `fetch` function to automatically sign HTTP requests.
- `aws-sigv4-sign` creates a `Request` object with signed headers that can be used with any other HTTP library.
- [`aws-sigv4-fetch`](https://www.npmjs.com/package/aws-sigv4-fetch) creates a `fetch` function to automatically sign HTTP requests.
- [`aws-sigv4-sign`](https://www.npmjs.com/package/aws-sigv4-sign) creates a `Request` object with signed headers that can be used with any other HTTP library.

## What is Signature Version 4?
> Signature Version 4 (SigV4) is the process to add authentication information to AWS API requests sent by HTTP. For security, most requests to AWS must be signed with an access key. The access key consists of an access key ID and secret access key, which are commonly referred to as your security credentials
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-sigv4-fetch/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# aws-sigv4-fetch
A small wrapper around the fetch API to automatically signs HTTP requests with AWS Signature Version 4 (SigV4) authentication, built with the official AWS SDK for JS v3.
A small wrapper around the [`fetch` API](https://developer.mozilla.org/en-US/docs/Web/API/fetch) to automatically sign HTTP requests with AWS Signature Version 4 (SigV4) authentication, built with the official AWS SDK.

> [!TIP]
> If you are using other HTTP libraries like Axios, Ky, Got, or any other HTTP library, consider using the [`aws-sigv4-sign`](https://github.com/zirkelc/aws-sigv4/tree/main/packages/aws-sigv4-sign) package to sign requests.
Expand Down
7 changes: 4 additions & 3 deletions packages/aws-sigv4-sign/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# aws-sigv4-sign
A small library to sign HTTP requests with AWS Signature Version 4 (SigV4) authentication, built with the official AWS SDK for JS v3.
A small library for signing HTTP requests with AWS Signature Version 4 (SigV4) authentication, built with the official AWS SDK.

> [!TIP]
> If you are using the `fetch` API, consider using the [`aws-sigv4-fetch`](https://github.com/zirkelc/aws-sigv4/tree/main/packages/aws-sigv4-fetch) package to automatically sign requests.
> If you are using the [`fetch` API](https://developer.mozilla.org/en-US/docs/Web/API/fetch), consider using the [`aws-sigv4-fetch`](https://github.com/zirkelc/aws-sigv4/tree/main/packages/aws-sigv4-fetch) package to automatically sign requests.
## Install
```sh
Expand Down Expand Up @@ -62,6 +62,7 @@ The returned [`Request` object](https://developer.mozilla.org/en-US/docs/Web/API

```ts
const signedRequest = await signRequest(url, options);

// Fetch the signed request
const response = await fetch(signedRequest);

Expand All @@ -77,7 +78,7 @@ const headers = Object.fromEntries(signedRequest.headers.entries());
console.log(headers.authorization); // AWS4-HMAC-SHA256 Credential=.../20250101/us-east-1/lambda/aws4_request, SignedHeaders=host;x-amz-date;x-amz-content-sha256;x-amz-security-token, Signature=...
```

The `headers` is a [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) object and can be converted to plain object.
The `headers` is a [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) object and can be converted to plain object for use with other HTTP libraries.

### Options

Expand Down

0 comments on commit 50f4a1e

Please sign in to comment.