push
github
472 of 472 branches covered (100.0%)
Branch coverage included in aggregate %.
5358 of 5358 relevant lines covered (100.0%)
28.82 hits per line
1 |
import { createHmac } from "node:crypto";
|
4✔ |
2 |
|
4✔ |
3 |
export interface SignRequestOptions {
|
4✔ |
4 |
key: string; |
4✔ |
5 |
secret: string; |
4✔ |
6 |
body: string; |
4✔ |
7 |
} |
4✔ |
8 |
|
4✔ |
9 |
export interface SignedRequest {
|
4✔ |
10 |
key: string; |
4✔ |
11 |
sign: string; |
4✔ |
12 |
} |
4✔ |
13 |
|
4✔ |
14 |
export function SignRequest({
|
|
15 |
key, |
224✔ |
16 |
secret, |
224✔ |
17 |
body, |
224✔ |
18 |
}: SignRequestOptions): SignedRequest { |
224✔ |
19 |
return { key, sign: createHmac("sha512", secret).update(body).digest("hex") }; |
224✔ |
20 |
} |
224✔ |