Conversion to SHA1

We have an api in which we have to pass the authorization as the SHA1 hash so can we convert the string to SHA1 in the function

Please try
let string = “Original string”

let authSecret = "authSecret"
const hash = ymLib.crypto.createHash('sha1').update(authSecret).digest('hex');

or

const hash = ymLib.crypto.createHmac('sha1', authSecret).update(string).digest("hex");