
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
aws4-react
Advanced tools
AWS4 React Library is used to get AWS Signature.
This library is to create a signed AWS API request in react or any js project.
Use the package manager npm to install aws4-react.
npm i aws4-react
or
yarn add aws4-react
import { AWSSigner } from 'aws4-react';
let params = {
data: JSON.stringify(body),
method: 'GET',
url:
'https://z7hgc1k4qb.execute-api.us-east-1.amazonaws.com/master/batches',
};
let cred = {
secret_key: 'kdjaskdjaksd',
access_key: 'dkasndkjasjdkas',
session_token: '',
};
console.log(cred);
const serviceInfo = {
region: 'us-east-1',
service: 'execute-api',
};
const headers = AWSSigner.sign(params, cred, serviceInfo);
/* It returns
{
data?: string;
metho?: string;
url?: string;
headers?: {
host?: string;
'x-amz-date': string;
Authorization: string;
};
}
*/
Now you can send the Authorization in the header as follows
const signedHeaders = AWSSigner.sign(params, cred, serviceInfo);
fetchBaseQuery({
baseUrl: "example.com",
prepareHeaders: (headers) => {
const authHeader = signedHeaders.headers
for (let key in authHeader) {
headers.set(key, authHeader[key]);
}
return headers;
},
});
const signedHeaders = AWSSigner.sign(params, cred, serviceInfo);
const authHeader = signedHeaders.headers
axios.post('url', {"body":data}, {
headers: {
'Authorization': authHeader.Authorization
}
}
)
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
FAQs
AWS4 React Library is used to get AWS Signature.
The npm package aws4-react receives a total of 11 weekly downloads. As such, aws4-react popularity was classified as not popular.
We found that aws4-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.