# @did-connect/types

> Type definition and validator for did-connect protocol

Latest version **2.2.8** (published 2025-05-12) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @did-connect/types
pnpm add @did-connect/types
yarn add @did-connect/types
bun add @did-connect/types
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.2.8 |
| Published | 2025-05-12 |
| First published | 2022-07-12 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 35.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | wangshijun |
| Maintainers | wangshijun |
| Keywords | did, web3 |

## Links

- npm: https://www.npmjs.com/package/@did-connect/types
- Repository: https://github.com/ArcBlock/did-connect
- Issues: https://github.com/ArcBlock/did-connect/issues
- npm.io page: https://npm.io/package/@did-connect/types

## Dependencies (3)

- [joi](https://npm.io/package/joi.md) ^17.12.3
- [@ocap/mcrypto](https://npm.io/package/@ocap/mcrypto.md) ^1.20.8
- [@arcblock/validator](https://npm.io/package/@arcblock/validator.md) ^1.20.8

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.2.8 (latest) — 2025-05-12
- 2.2.7 — 2025-01-25
- 2.2.6 — 2025-01-25
- 2.2.5 — 2025-01-24
- 2.2.4 — 2024-04-12
- 2.2.3 — 2024-04-09
- 2.2.2 — 2024-04-08
- 2.2.1 — 2023-11-07
- 2.2.0 — 2023-07-10
- 2.1.59 — 2023-05-23
- 2.1.58 — 2023-05-19
- 2.1.57 — 2023-05-16
- 2.1.54 — 2023-05-04
- 2.1.53 — 2023-04-27
- 2.1.52 — 2023-04-23
- … 66 more at https://npm.io/package/@did-connect/types/versions

## README

[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![docs](https://img.shields.io/badge/powered%20by-arcblock-green.svg)](https://docs.arcblock.io)
[![Gitter](https://badges.gitter.im/ArcBlock/community.svg)](https://gitter.im/ArcBlock/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

## Overview

This package exist for 2 purposes:

- Define core data structures and validators for DID Connect Protocol
- Provide a set of utilities that are widely used in ArcBlock implementation of DID Connect Protocol

Core data structures includes:

- DID Connect Request: a request to be fulfilled by DID Wallet
  - AgreementRequest
  - AssetRequest
  - AuthPrincipalRequest
  - PrepareTxRequest
  - ProfileRequest
  - SignatureRequest
  - VerifiableCredentialRequest;
- DID Connect Response: a response sent from DID Wallet to fulfill a request
  - TAgreementResponse
  - TAssetResponse
  - TAuthPrincipalResponse
  - TPrepareTxResponse
  - TProfileResponse
  - TSignatureResponse
  - TVerifiableCredentialResponse;
- DID Connect Session: the object that holds a running DID Connect session
- DID Connect Context: the object that holds the context of a running DID Connect session

Other utilities includes:

- AppInfo
- ChainInfo
- WalletInfo

## Install

```sh
npm install @did-connect/types
// or
yarn add @did-connect/types
```

## Usage

Using types:

```js
import type { TProfileRequest } from '@did-connect/types';
const profile: TProfileRequest = {
  type: 'profile',
  description: 'Request user profile',
  items: ['fullName'],
};
```

Using validators:

```js
import type { TProfileRequest } from '@did-connect/types';
import { ProfileRequest } from '@did-connect/types';

const { error, value } = ProfileRequest.validate({
  type: 'profile',
  description: 'Request user profile',
  items: ['fullName'],
});
```

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