Package Exports
- @did-connect/types
- @did-connect/types/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@did-connect/types) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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'],
});