# @stacks/profile

> Library for Stacks profiles

Latest version **7.6.0** (published 2026-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @stacks/profile
pnpm add @stacks/profile
yarn add @stacks/profile
bun add @stacks/profile
```

## 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 | 7.6.0 |
| Published | 2026-07-29 |
| First published | 2020-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 1.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 975 |
| Author | Hiro Systems PBC |
| Maintainers | blockstack-devops, stacks-foundation, jannik-stacks, rafa-stacks |
| Keywords | blockstack, profiles, stacks |

## Links

- npm: https://www.npmjs.com/package/@stacks/profile
- Repository: https://github.com/stx-labs/stacks.js
- Homepage: https://hiro.so/stacks-js
- Issues: https://github.com/blockstack/blockstack.js/issues
- npm.io page: https://npm.io/package/@stacks/profile

## Dependencies (6)

- [zone-file](https://npm.io/package/zone-file.md) ^2.0.0-beta.3
- [jsontokens](https://npm.io/package/jsontokens.md) ^4.0.1
- [@stacks/common](https://npm.io/package/@stacks/common.md) ^7.6.0
- [@stacks/network](https://npm.io/package/@stacks/network.md) ^7.6.0
- [schema-inspector](https://npm.io/package/schema-inspector.md) ^2.0.2
- [@stacks/transactions](https://npm.io/package/@stacks/transactions.md) ^7.6.0

## Recent versions

- 7.6.0 (latest) — 2026-07-29
- 7.6.1-pr.1880.0 (pr) — 2026-09-16
- 7.4.1-beta.3 (beta) — 2026-05-22
- 7.0.0-next.89 (next) — 2024-10-25
- 6.12.2-nakamoto.0 (nakamoto) — 2024-03-21
- 4.4.0-stacks2.1-alpha.0 (alpha) — 2022-08-23
- 7.5.1-pr.1854.0 — 2026-07-13
- 7.5.0 — 2026-06-23
- 7.4.1-pr.1854.5 — 2026-06-21
- 7.4.1-pr.1854.4 — 2026-06-12
- 7.4.1-pr.1854.3 — 2026-06-02
- 7.4.1-pr.1854.2 — 2026-05-28
- 7.4.1-pr.1854.1 — 2026-05-27
- 7.4.1-pr.1854.0 — 2026-05-27
- 7.4.1-beta.2 — 2026-05-22
- … 697 more at https://npm.io/package/@stacks/profile/versions

## README

# @stacks/profile

Functions for manipulating user profiles.

## Installation

```
npm install @stacks/profile
```

### Get profile from token

```typescript
import { extractProfile } from '@stacks/profile';

// Token received after signin in browser using auth or connect package
const token = '<insert profile token here>';

const profile = extractProfile(token);
// profile
```

### Verify profile token

```typescript
import { verifyProfileToken } from '@stacks/profile';

// Token received after signin in browser using auth or connect package
const token = '<insert profile token here>';
const publicKey = '<insert public key>';

const decodedToken = verifyProfileToken(token, publicKey);
// decodedToken if verified successfully
// Otherwise throws an error if token verification fails
```

### Make zonefile

```typescript
import { makeProfileZoneFile } from '@stacks/profile';

const fileUrl = 'https://_example_.s3.amazonaws.com/naval.id/profile.json';
const origin = 'naval.id';
const zoneFile = makeProfileZoneFile(origin, fileUrl);
// zoneFile contents
```

### Profile to token

```typescript
import { signProfileToken, verifyProfileToken, extractProfile } from '@stacks/profile';

// Token received after signin in browser using auth or connect
const token = '<insert profile token here>';
const profile = extractProfile(token);
// warning: Do not expose your private key by hard coding in code. Use env variables to load private keys.
const privateKey = '<private key>'; // process.env.privateKey
const publicKey = '<public key>';

const signedToken = signProfileToken(profile, privateKey);
const decodedToken = verifyProfileToken(signedToken, publicKey);
// decodedToken if verified successfully
// Otherwise throws an error if token verification fails
```

### Profile Validation

```typescript
import { extractProfile, Profile } from '@stacks/profile';

// Token received after signin in browser using auth or connect
const token = '<insert profile token here>';
// warning: Do not expose your private key by hard coding in code. Use env variables to load private keys.
const privateKey = '<private key>'; // process.env.privateKey
const publicKey = '<public key>';

const profile = extractProfile(token);

const profileObject = new Profile(profile);
console.log(profileObject);

const validationResults = Profile.validateSchema(profile);
console.log(validationResults.valid);

const profileJson = profileObject.toJSON();
console.log(profileJson);

const tokenRecords = profileObject.toToken(privateKey);
console.log(tokenRecords);

const profileFromToken = Profile.fromToken(tokenRecords, publicKey);
console.log(profileFromToken);
```

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