Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getToken = (method: string = 'get', path: string, iss: string, sharedSecret: string): Promise => {
const iat = Math.floor(Date.now() / 1000);
const exp = iat + 180;
const req: Request = fromMethodAndUrl(method, path);
const tokenData = {
iss,
iat,
exp,
qsh: createQueryStringHash(req),
};
const token = encode(tokenData, sharedSecret);
return token;
};