@did-connect/types
v2.2.4
Published
Type definition and validator for did-connect protocol
Downloads
6,262
Readme
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
npm install @did-connect/types
// or
yarn add @did-connect/types
Usage
Using types:
import type { TProfileRequest } from '@did-connect/types';
const profile: TProfileRequest = {
type: 'profile',
description: 'Request user profile',
items: ['fullName'],
};
Using validators:
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'],
});