Skip to content

Commit

Permalink
fix: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
elribonazo committed Apr 25, 2024
1 parent 64572a5 commit b3a0b07
Show file tree
Hide file tree
Showing 280 changed files with 10,350 additions and 3,610 deletions.
67 changes: 67 additions & 0 deletions docs/examples/SDKVerification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Cross-Platform Edge SDK Verification
## Requirements
1. A working Identus Mediator and an Identus Cloud Agent.
2. A holder which already has a JWT Credential issued by a known issuer (prism:did) [Holder A]
3. A holder which does not have credential but aims to start the Verification [Holder B (verifier)]
4. Holder A shares its peerDID with holder B.
5. Holder B will initiate a presentation request

> NOTE:
>
> Please follow the [Quick started guide](../../docs/quick-start) to complete steps 1, 2, 3
## Specification
> NOTE:
> It follows the [Identity Foundation Presentation-exchange V2 protocol](https://identity.foundation/presentation-exchange/spec/v2.0.0/#input-descriptor)
>
> Claims can be
> ```javascript
> export type PredicateType = string | number
> export type InputFieldFilter = {
> type: string,
> pattern?: string,
> enum?: PredicateType[],
> const?: PredicateType[],
> value?: PredicateType
> }
> export type Claims = {
> [name: string]: InputFieldFilter
> }
> ```
## Flow
1. Holder B Initiates the Presentation Request: creating a PresentationDefinitionRequest with specified requirements.
2. Holder A, will then create a Presentation Submission which contains the requested credential together with a randomised challenge.
3. Holder B, will receive the Presentation Submission and verify the following
* Holder A signed the JWT presentation with the correct signatures.
* Holder A signed the random challenge that we required him with the correct keys.
* Holder A is including his credential and not somebody else's.
* Holder A is including a credential with valid signatures, matching the issuer through the specified DID.
* (optional) Holder A has included a credential that has been issued by the requested issuer.
* (optional) Holder A has included a credential that satisfies the requested claims.
4. Holder B, can then verify at any point in time that presentation request and show feedback in UI.

## Code Reference
* toDID is the peer did of holder A which has the credential that we aim to verify
* claims contains an object with all the claims that we aim to validate, setting claims is internally used to help the Holder A to choose the right credential and to verify the fields correctly when Holder B receives the presentation.
Example
```javascript
const claims: Claims = {
email: {
type: 'string', pattern:'email@email.com'
}
}
const options:PresentationClaims = {
issuer: Domain.DID.fromString("did:peer:12345"),
claims: claims
}

agent.initiatePresentationRequest(
Domain.CredentialType.JWT,
toDID,
options
);
```



11 changes: 11 additions & 0 deletions docs/examples/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Identus Edge SDK TS Examples

Here you can find basic implementations and tutorials for the Identus Edge Agent JS SDK, but most things run cross platform with minor differences.

## Tutorials

### Cross platform DK Verification

Start a verification flow from an Edge Agent (holder wallet) and another holder to request (a did) to send you a credenital proof for a specific issuer and specific claims.

[Start tutorial](./SDKVerification.md)
49 changes: 24 additions & 25 deletions docs/sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
@input-output-hk/atala-prism-wallet-sdk / [Exports](modules.md)
@atala/prism-wallet-sdk / [Exports](modules.md)

# Atala PRISM TypeScript SDK

[![Coverage Status](https://coveralls.io/repos/github/input-output-hk/atala-prism-wallet-sdk-ts/badge.svg?branch=master)](https://coveralls.io/github/input-output-hk/atala-prism-wallet-sdk-ts?branch=master)

<p align="center">
<img src="atala-logo.png" alt="Atala logo" width="300"/>
</p>

---

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
Expand All @@ -18,7 +26,7 @@ The complete platform is separated into multiple repositories:

- 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](https://github.com/input-output-hk/atala-prism-docs/blob/main/documentation/docs/concepts/glossary.md#verifiable-credentials).
- Pollux: Provides a suite of operations for handling [verifiable credentials](https://github.com/input-output-hk/atala-prism-docs/blob/master/documentation/docs/concepts/glossary.md#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 basic edge agent capabilities, including implementing DIDComm V2 protocols.
Expand All @@ -40,10 +48,6 @@ or with yarn
yarn add @atala/prism-wallet-sdk
```

> **Note for Webpack:**
>
> The application builds code with wasm files for DIDComm and Anoncreds for both browsers and nodejs. When webpack builds public website the wasm files need to be copied manually into the public folder. See examples
### Running a demo project

#### Building from source
Expand All @@ -66,44 +70,39 @@ npm i
npm run build
```

### For NodeJS CJS

After building `prism-wallet-sdk`, cd into `{path}/demos/node-cjs` or use visual studio debugger "CJS DEMO":
### Running the sample applications
We have enabled sample implementations for browser (react or nextjs) and nodejs.
In order to run each demo, make sure the whole SDK is built from source, then cd into the demo.

Nodejs CommonJS
```bash
cd demos/node-cjs
npm i
npm run start
```

> **Note:**
>
> The installation in the `{path}/demos/node-cjs` directory requires the `build` folder from the wallet-sdk to be available.
### For NodeJS ESM

After building `prism-wallet-sdk`, cd into `{path}/demos/node-esm` or use visual studio debugger "ESM DEMO":

Nodejs Module
```bash
cd demos/node-esm
npm i
npm run start
```

> **Note:**
>
> The installation in the `{path}/demos/node-esm` directory requires the `build` folder from the wallet-sdk to be available.
### For browser

After building `prism-wallet-sdk`, cd into the demo directory `{path}/demos/browser`

Browser React
```bash
cd demos/browser
npm i
npm run start
```

Browser NextJS
```bash
cd demos/next
npm i
npm run build # becuase Error: ENOENT: no such file or directory, open '/.../atala-prism-wallet-sdk-ts/demos/next/.next/BUILD_ID']
npm run start
```

### Implementing storage for the SDK
This SDK exposes Pluto, a storage interface that should be implemented by the user, in the most appropriate way for a particular use case.

Expand Down

0 comments on commit b3a0b07

Please sign in to comment.