From 614b77f8883dcd930d19fb53222a821e77717e14 Mon Sep 17 00:00:00 2001 From: Milos Dzepina Date: Wed, 15 Mar 2023 14:28:40 +0100 Subject: [PATCH] docs: Update README - initial version (#19) --- README.md | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ readme.md | 27 --------------- 2 files changed, 101 insertions(+), 27 deletions(-) create mode 100644 README.md delete mode 100644 readme.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..98a6bd710 --- /dev/null +++ b/README.md @@ -0,0 +1,101 @@ +# Welcome to Atala PRISM TypeScript SDK + +Atala PRISM TypeScript SDK provides a library and documentation for developers to build +TypeScript-based SSI applications with Atala PRISM. It provides a set of +utilities for building SSI Edge Agents speaking DIDComm V2 protocols. + +## Basic considerations + +### Atala PRISM + +Atala PRISM is a self-sovereign identity (SSI) platform and service suite for +verifiable data and digital identity. Built on Cardano, it offers core +infrastructure for issuing DIDs (Decentralized identifiers) and verifiable +credentials, alongside tools and frameworks to help expand your ecosystem. +The complete platform is separated in multiple repositories: + +* [atala-prism-wallet-sdk-swift](https://github.com/input-output-hk/atala-prism-wallet-sdk-swift) - Repo that implements Atala PRISM for Apple platforms in Swift. +* [atala-prism-wallet-sdk-ts](https://github.com/input-output-hk/atala-prism-wallet-sdk-ts) - Repo that implements Atala PRISM for Browser and NodeJS platforms in TypeScript. +* [atala-prism-building-blocks](https://github.com/input-output-hk/atala-prism-building-blocks) - Repo that contains the platform Building Blocks. + +### Modules / APIs + +Atala PRISM TypeScript SDK provides the following building blocks: + +* **Apollo**: Provides a suite of necessary cryptographic operations. +* **Castor**: Provides a suite of operations to create, manage and resolve decentralized identifiers. +* **Pollux**: Provides a suite of operations for handling verifiable credentials. +* **Mercury**: Provides a suite of operations for handling DIDComm V2 messages. +* **Pluto**: Provides an interface for storage operations in a portable, storage-agnostic manner. +* **PrismAgent**: PrismAgent, a component using all other building blocks, provides a basic edge agent capabilities, including implementation of DIDComm V2 protocols. + +## DIDComm Protocol Support + +| Protocol | Supported | Notes | +| --- | :--: | -- | +| [Mediator Coordinator](https://didcomm.org/mediator-coordination/2.0/) | :white_check_mark: | -- | +| Connection | :white_check_mark: | Atala PRISM proprietary | +| [DIDComm V2 Issue Credential](https://github.com/decentralized-identity/waci-didcomm/tree/main/issue_credential) | :white_check_mark: | -- | +| [DIDComm V2 Present Proof](https://github.com/decentralized-identity/waci-didcomm/blob/main/present_proof/present-proof-v3.md) | :white_check_mark: | -- | + +## Getting Started + +### Supported platforms + +| Platform | Supported | Notes | +| --- | :--: | -- | +| Browser | :white_check_mark: | -- | +| Browser Extension | :white_check_mark: | -- | +| Node.js | :white_check_mark: | -- | +| React Native | :x: | -- | + +### Installing +Install the SDK using `npm` or `yarn`: + +`npm install @input-output-hk/atala-prism-wallet-sdk` + +`yarn add @input-output-hk/atala-prism-wallet-sdk` + +### Usage +Once `@input-output-hk/atala-prism-wallet-sdk` is installed as a dependency, +package could be imported using both ES modules and CommonJS syntax. + +`import * as prismSDK from '@input-output-hk/atala-prism-wallet-sdk';` + +or + +`const prismSDK = require('@input-output-hk/atala-prism-wallet-sdk');` + +Then, provided modules could be used to set up an SSI Edge Agent: + +```ts +const apollo = new prismSDK.Apollo(); +const api = new prismSDK.ApiImpl(); +const castor = new prismSDK.Castor(apollo); +const pluto = new prismSDK.Pluto({ + type: "sql", +}); +const didcommWrapper = new prismSDK.DIDCommWrapper(apollo, castor, pluto); +const mercury = new prismSDK.Mercury(castor, didcommWrapper, api); +const mediatorDID = prismSDK.Domain.DID.fromString( + "did:peer:2.Ez6LSms555YhFthn1WV8ciDBpZm86hK9tp83WojJUmxPGk1hZ.Vz6MkmdBjMyB4TS5UbbQw54szm8yvMMf1ftGV2sQVYAxaeWhE.SeyJpZCI6Im5ldy1pZCIsInQiOiJkbSIsInMiOiJodHRwczovL21lZGlhdG9yLnJvb3RzaWQuY2xvdWQiLCJhIjpbImRpZGNvbW0vdjIiXX0" +); +const mediatorStore = new prismSDK.PublicMediatorStore(pluto); +const mediatorHandler = new prismSDK.BasicMediatorHandler(mediatorDID, mercury, mediatorStore); +const connectionsManager = new prismSDK.ConnectionsManager(castor, mercury, pluto, mediatorHandler); + +const seedWords = apollo.createRandomSeed(); + +const agent = new prismSDK.Agent( + apollo, + castor, + pluto, + mercury, + mediatorHandler, + connectionsManager, + seedWords.seed + ); + +await agent.start(); +``` + diff --git a/readme.md b/readme.md deleted file mode 100644 index ed052742c..000000000 --- a/readme.md +++ /dev/null @@ -1,27 +0,0 @@ -# AtalaPrism - Typescript SDK - -## Getting started - using SDK in browser - -* To follow `exports` in `package.json`, set `moduleResolution` to either -`node16` or `nodenext` in app's `tsconfig`. -* Install `assert` and `util` packages: `npm install assert util` - * `antlr4ts` uses some Node.js standard library modules, which are not available - in browser. To use SDK in browser, you need to provide polyfills. Detailed - instructions how to polyfill could be found [here](https://sanchit3b.medium.com/how-to-polyfill-node-core-modules-in-webpack-5-905c1f5504a0). -* Vite specific setup - * Vite does not support `process.env`, which is needed in order to use this SDK. - * To fix this, you need to add `define` option to `vite.config`: - ```js - export default defineConfig({ - define: { - 'process.env': { - NODE_ENV: process.env.NODE_ENV, - NODE_DEBUG: process.env.NODE_DEBUG, - } - } - }) - ``` -* Install SDK: `npm install @input-output-hk/atala-prism-wallet-sdk` -* Import/require one of: - * `@input-output-hk/atala-prism-wallet-sdk/node` - * `@input-output-hk/atala-prism-wallet-sdk/browser`