⚠️ WARNING: Please be advised that the Affinidi SDK is deprecated and will no longer receive future updates. We have initiated this transition to streamline our development efforts and enhance the efficiency of our systems.
The open-source Affinidi Library provides easy-to-use Typescript packages that enable developers to create and manage true certificate-enabled Digital Identities (DID) on the Affinidi Network.
The Affinidi open source monorepo has the following structure
.
├── common-libs
│ ├── common
│ ├── tiny-lds-ecdsa-secp256k1-2019
│ ├── did-auth-lib
│ ├── internal-api-clients
│ ├── tools-common
│ ├── tools-openapi
│ ├── url-resolver
│ ├── user-management
│ └── vc-common
│
└── platform
│ ├── fetch
│ ├── fetch-native
│ └── fetch-node
│
└── sdk
├── browser
├── core
├── expo
├── issuer-kit
├── node
├── react-native
└── vc-data
The common
folder contains the @affinidi/common
npm package. This package implements DID, VC, and VP utilities that are used throughout Affinidi libraries and services. This package is considered more opinionated because it supports DID methods and VC proofs that Affinidi actively supports.
The main entry point to this package is a class called Affinity
. In this class you will find utilities for handling JSON-LD, DIDs, VCs, VPs, JWTs, and legacy credential types from early MVPs.
This packages is the same as https://github.com/decentralized-identity/lds-ecdsa-secp256k1-2019.js, but uses tiny-secp256k1
for signing.
The did-auth-lib
folder contains the @affinidi/affinidi-did-auth-lib
npm package. This library allows proving that the client/user is the owner of provided DID
. Based on this proof App builders can give the client/user access to the appropriate resources.
The vc-common
folder contains the @affinidi/vc-common
npm package. This package implements VC and VP types and utility functions that help with type-safe credential issuance and verification. It is considered less opinionated because it supports a wider variety of DIDs and VCs as long as they conform to the core data model.
Find more docs here.
The core
folder contins the @affinidi/wallet-core-sdk
npm package. This package implements the common logic for account registration & management, credential issuance & verification and more.
The main entry point is a class called CommonNetworkMember
. This class can be initialized with specific service endpoints, or if left to it's defaults will use Affinidi's staging environment.
The browser
folder contains the @affinidi/wallet-browser-sdk
npm package. This package extends the wallet-core-sdk
logic with client specific implementations for crypto operations. As a result of crypto operations being platform specific, this package implements the logic to communicate with the encrypted data vault for VC storage.
The main entry point is a class called AffinidiWallet
. Similar to CommonNetworkMember
, the class can be initialized with specific service endpoints, or can be left to use Affinidi's staging environment by default.
The expo
folder contains the @affinidi/wallet-expo-sdk
npm package. This package extends the wallet-core-sdk
logic with client specific implementations for crypto operations. As a result of crypto operations being platform specific, this package implements the logic to communicate with the encrypted data vault for VC storage.
The main entry point is a class called AffinidiWallet
. Similar to CommonNetworkMember
, the class can be initialized with specific service endpoints, or can be left to use Affinidi's staging environment by default.
The react-native
folder contains the @affinidi/wallet-react-native-sdk
npm package. This package extends the wallet-core-sdk
logic with client specific implementations for crypto operations. As a result of crypto operations being platform specific, this package implements the logic to communicate with the encrypted data vault for VC storage.
The main entry point is a class called AffinidiWallet
. Similar to CommonNetworkMember
, the class can be initialized with specific service endpoints, or can be left to use Affinidi's staging environment by default.
The vc-data
folder contains the @affinidi/vc-data
npm package. This package contains schema helpers and building blocks to issue JSON-LD credentials. The vc-data
utilities also specify a process through which developers can propose additions or request assistance in schema development.
The issuer-kit
folder contains the @affinidi/issuer-kit
npm package. This package contains a framework for launching microservices to connect to external data providers & issue VCs.
Before we begin, make sure you have the following installed:
- Node.js v16.17.0 or later
- npm v8.15.0 or later
You need to to use an API Key when you initialize the SDK. Here are the steps required to generate and start using the API Key: https://github.com/affinityproject/affinidi-core-sdk/tree/master/sdk/core#create-api-key
The following commands should be supported by all projects in monorepo
build
: should build packagelint
: should run lintcheckLicenses
: should check licensestest:unit
: should run unit tests, if anytest:integration
: should run integration tests, if anytest
: should run all teststest:coverage
: should run all tests with coveragetest:coverage:codeclimate
: should runtest:coverage
and save codeclimate results
Workflow to publish npm packages is:
npm run bootstrap
in order to link and install all dependencies;npm run build
in order to build all projects in this monorepo;npm run lint
,npm run test
,npm run checkLicenses
etc;npm run publish
.
Note that prepare
command is not required as the projects are built on step 2 anyway, and prepare
command is run for all projects during step 1, making it unnecessary long.