Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
BarnabyShearer authored Nov 11, 2024
1 parent 741ce53 commit dacf348
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1 @@
# aws-signature-v4-subtle

Sign requests to AWS with their Version 4 Signature algorithm. Uses only `crypto.subtle`.

# Usage

## To retrieve a Secret from Secrets Manager:

```typescript
const response = await fetch(
...(await AwsToFetch(
{
AWS_REGION: 'us-west-1',
AWS_ACCESS_KEY_ID: '<Access Key ID>',
AWS_SECRET_ACCESS_KEY: '<Access Key Secret>',
},
'secretsmanager',
'POST',
{
'content-type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'secretsmanager.GetSecretValue',
},
JSON.stringify({
SecretId: `SLACK_SIGNING_SECRET_${accountId}`,
}),
)),
);
if (!response.ok) throw new Error('Error talking to AWS');
const secret = (await response.json<{ SecretString: string }>()).SecretString;
```
Use <https://www.npmjs.com/package/aws4fetch>

0 comments on commit dacf348

Please sign in to comment.