# @bitgo/sdk-hmac

> HMAC module for the BitGo SDK

Latest version **1.10.1** (published 2026-11-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @bitgo/sdk-hmac
pnpm add @bitgo/sdk-hmac
yarn add @bitgo/sdk-hmac
bun add @bitgo/sdk-hmac
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.10.1 |
| Published | 2026-11-17 |
| First published | 2025-01-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 145.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 396 |
| Author | BitGo SDK Team |
| Maintainers | louib-bitgo, bitgobot |

## Links

- npm: https://www.npmjs.com/package/@bitgo/sdk-hmac
- Repository: https://github.com/BitGo/BitGoJS
- Homepage: https://github.com/BitGo/BitGoJS#readme
- Issues: https://github.com/BitGo/BitGoJS/issues
- npm.io page: https://npm.io/package/@bitgo/sdk-hmac

## Recent versions

- 1.10.1 (latest) — 2026-11-17
- 1.10.0 — 2026-11-12
- 1.9.2 — 2026-09-29
- 1.9.1 — 2026-08-06
- 1.9.0 — 2026-03-27
- 1.8.0 — 2026-02-12
- 1.7.0 — 2025-12-04
- 1.6.0 — 2025-11-06
- 1.5.0 — 2025-10-24
- 1.4.0 — 2025-10-21
- 1.3.0 — 2025-10-09
- 1.2.0 — 2025-08-22
- 1.1.0 — 2025-01-09

## README

# @bitgo/sdk-sdk-hmac

Isolated module for performing hash-based message authentication (HMAC) on API requests.

## Installation

```shell
npm i @bitgo/sdk-hmac
```

```javascript
import { calculateRequestHeaders, verifyResponse } from '@bitgo/sdk-hmac';

const bearerToken = 'v2x123...';
const url = '/api/v2/wallets';

const { hmac, timestamp, tokenHash } = calculateRequestHeaders({
  url,
  token: bearerToken,
  timestamp: new Date().valueOf().toString(),
  // if making a POST/PUT request with a body, pass as text
  // text: JSON.stringify(request.body)
  // optional, can pass 2 or 3 for auth-version
  // authVersion: 3
});

const response = await fetch(url, {
  method: 'GET',
  headers: {
    authorization: `Bearer ${tokenHash}`,
    hmac,
    'bitgo-auth-version': '2.0',
    'auth-timestamp': timestamp,
  },
});

const verifiedResponse = verifyResponse({
  url,
  hmac: response.headers.get('hmac'),
  statusCode: response.status,
  text: response.text,
  timestamp: response.headers.get('timestamp'),
  token: bearerToken,
  method: 'get',
});

if (!verifiedResponse.isValid) {
  throw new Error('dont trust this response, possible MITM attack');
}
```

---
_Source: https://npm.io/package/@bitgo/sdk-hmac · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
