fix(auth-oauth1): use the signing key as the PLAINTEXT signature (#605)

This commit is contained in:
Ngo Quoc Viet
2026-08-24 21:13:57 -07:00
committed by GitHub
parent aa76d501f0
commit 9a7bcf73bb
3 changed files with 48 additions and 2 deletions
+4 -1
View File
@@ -202,7 +202,10 @@ function hashFunction(signatureMethod: SigMethod) {
return (base: string, privateKey: string) =>
crypto.createSign("RSA-SHA512").update(base).sign(privateKey, "base64");
case signatures.PLAINTEXT:
return (base: string) => base;
// RFC 5849 3.4.4: the PLAINTEXT signature IS the signing key,
// `encoded(consumer secret)&encoded(token secret)`. Returning the base
// string put the whole percent-encoded request into oauth_signature.
return (_base: string, key: string) => key;
default:
return (base: string, key: string) =>
crypto.createHmac("sha1", key).update(base).digest("base64");