Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as aws4 from "aws4";
let requestSigner = new aws4.RequestSigner({}, {});
requestSigner.matchHost("");
requestSigner.isSingleRegion();
requestSigner.createHost();
requestSigner.prepareRequest();
requestSigner.sign();
requestSigner.getDateTime();
requestSigner.getDate();
requestSigner.authHeader();
requestSigner.signature();
requestSigner.stringToSign();
requestSigner.canonicalString();
requestSigner.canonicalHeaders();
requestSigner.signedHeaders();
requestSigner.credentialString();
requestSigner.defaultCredentials();
requestSigner.parsePath();
fetch(opts: RequestOptions, credentials: Credentials) {
let signer = new RequestSigner(opts, credentials);
signer.request.protocol = 'https:';
signer.sign();
const req = signer.request;
let url = `${req.protocol}//${req.hostname}${req.path}`
console.debug("AWS S3 requesting URL:", url)
return fetch(url, { method: req.method, headers: req.headers });
},
sign
function writeGitParameters(options) {
let username = credentials.accessKeyId;
if (credentials.sessionToken) {
username += `%${credentials.sessionToken}`;
}
options.service = SERVICE;
options.method = METHOD;
const signer = new aws4.RequestSigner(options, credentials);
const password = `${signer.getDateTime()}Z${signer.signature()}`
console.log(`username=${username}`);
console.log(`password=${password}`);
}