(consumerSecret: string, accessTokenSecret: string)
| 6 | } |
| 7 | |
| 8 | async function buildHmacKey(consumerSecret: string, accessTokenSecret: string): Promise<CryptoKey> { |
| 9 | const string = percentEncode(consumerSecret) + '&' + percentEncode(accessTokenSecret); |
| 10 | const buffer = new TextEncoder().encode(string).buffer; |
| 11 | return crypto.subtle.importKey('raw', buffer, {name: 'HMAC', hash: 'SHA-1'}, false, ['sign']); |
| 12 | } |
| 13 | |
| 14 | async function makeSignature(hmacKey: CryptoKey, oauthParams: Record<string, string>, method: string, url: string|URL, params: URLSearchParams|null): Promise<string> { |
| 15 | const paramBits = []; |
no test coverage detected