MCPcopy Create free account
hub / github.com/Treeki/BirdBridge / buildHmacKey

Function buildHmacKey

utils/oauth.ts:8–12  ·  view source on GitHub ↗
(consumerSecret: string, accessTokenSecret: string)

Source from the content-addressed store, hash-verified

6}
7
8async 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
14async function makeSignature(hmacKey: CryptoKey, oauthParams: Record<string, string>, method: string, url: string|URL, params: URLSearchParams|null): Promise<string> {
15 const paramBits = [];

Callers 1

requestMethod · 0.85

Calls 1

percentEncodeFunction · 0.85

Tested by

no test coverage detected