Skip to content

Commit 69dde8e

Browse files
elribonazocurtis-h
andcommitted
fix: Integrate rust auto-generated code through submodules. (#136)
Co-authored-by: Curtis <[email protected]> Signed-off-by: Francisco Javier Ribó Labrador <[email protected]>
1 parent 474e7ec commit 69dde8e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+28465
-17986
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
build/*
2+
build/**/*
23
/**/*.d.ts
34
integration-tests
5+
externals
6+
generated

.github/workflows/ci.yml

+12
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,24 @@ jobs:
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@v4
23+
with:
24+
submodules: 'true'
2325

2426
- name: Setup Node.js
2527
uses: actions/setup-node@v3
2628
with:
2729
node-version: "lts/*"
2830

31+
- name: Install Rust toolchain
32+
uses: actions-rs/toolchain@v1
33+
with:
34+
toolchain: stable
35+
override: true
36+
37+
- name: Install wasm-pack
38+
run: |
39+
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
40+
2941
- name: Install
3042
run: npm install
3143

.github/workflows/e2e-tests.yml

+11
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
with:
5454
ref: ${{ github.event.pull_request.head.ref }}
5555
fetch-depth: 0
56+
submodules: 'true'
5657

5758
- name: Setup Node.js for @input-output-hk
5859
uses: actions/setup-node@v3
@@ -63,6 +64,16 @@ jobs:
6364
registry-url: https://npm.pkg.github.com/
6465
scope: "@input-output-hk"
6566

67+
- name: Install Rust toolchain
68+
uses: actions-rs/toolchain@v1
69+
with:
70+
toolchain: stable
71+
override: true
72+
73+
- name: Install wasm-pack
74+
run: |
75+
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
76+
6677
- name: Setup Node.js for @hyperledger-labs
6778
uses: actions/setup-node@v3
6879
env:

.github/workflows/release-docs.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,22 @@ jobs:
1919
steps:
2020
- name: Checkout Code
2121
uses: actions/checkout@v4
22-
22+
submodules: 'true'
2323
- name: Setup Node.js
2424
uses: actions/setup-node@v3
2525
with:
2626
node-version: "lts/*"
2727

28+
- name: Install Rust toolchain
29+
uses: actions-rs/toolchain@v1
30+
with:
31+
toolchain: stable
32+
override: true
33+
34+
- name: Install wasm-pack
35+
run: |
36+
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
37+
2838
- name: Install dependencies
2939
run: npm install
3040

.github/workflows/release.yml

+11
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,24 @@ jobs:
99
steps:
1010
- name: Checkout Code
1111
uses: actions/checkout@v4
12+
submodules: 'true'
1213

1314
- name: Setup Node.js
1415
uses: actions/setup-node@v3
1516
with:
1617
node-version: "lts/*"
1718
registry-url: 'https://registry.npmjs.org/'
19+
20+
- name: Install Rust toolchain
21+
uses: actions-rs/toolchain@v1
22+
with:
23+
toolchain: stable
24+
override: true
1825

26+
- name: Install wasm-pack
27+
run: |
28+
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
29+
1930
- name: Install dependencies
2031
run: npm install
2132

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
node_modules
55
/.pnp
66
.pnp.js
7-
7+
generated
88
# testing
99
/coverage
1010
.nyc_output
@@ -23,4 +23,5 @@ yarn-debug.log*
2323
yarn-error.log*
2424
*.db
2525
didcomm-pkg
26-
generated-docs
26+
generated-docs
27+
*.commit

.gitmodules

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[submodule "externals/anoncreds"]
2+
path = externals/anoncreds
3+
url = [email protected]:curtis-h/anoncreds-rs.git
4+
branch = wasm-prism
5+
[submodule "externals/didcomm"]
6+
path = externals/didcomm
7+
url = [email protected]:sicpa-dlab/didcomm-rust.git

.vscode/launch.json

+22-9
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,38 @@
22
"version": "0.2.0",
33
"configurations": [
44
{
5-
"name": "NODE DEMO",
6-
"type": "node",
5+
"name": "CJS DEMO",
6+
"program": "${workspaceRoot}/demos/node-cjs/src/index.js",
7+
"request": "launch",
8+
"skipFiles": [
9+
"<node_internals>/**"
10+
],
11+
"type": "node"
12+
},
13+
{
14+
"name": "ESM DEMO",
15+
"program": "${workspaceRoot}/demos/node-esm/src/index.js",
716
"request": "launch",
8-
"runtimeExecutable": "${workspaceRoot}/demos/node/node_modules/.bin/ts-node",
9-
"runtimeArgs": ["--transpile-only"],
10-
"program": "${workspaceRoot}/demos/node/src/index.ts",
11-
"skipFiles": ["<node_internals>/**"],
12-
"cwd": "${workspaceRoot}"
17+
"skipFiles": [
18+
"<node_internals>/**"
19+
],
20+
"type": "node"
1321
},
1422
{
1523
"name": "TESTS",
1624
"type": "node",
1725
"request": "launch",
1826
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
19-
"args": ["--colors", "--workerThreads", "--maxWorkers", "1"],
27+
"args": [
28+
"--colors",
29+
"--workerThreads",
30+
"--maxWorkers",
31+
"1"
32+
],
2033
"skipFiles": [
2134
"${workspaceRoot}/../../node_modules/**/*",
2235
"<node_internals>/**/*"
2336
]
2437
}
2538
]
26-
}
39+
}

README.md

+64-35
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
# Welcome to Atala PRISM TypeScript SDK
2-
3-
Atala PRISM TypeScript SDK provides a library and documentation for developers to build
4-
TypeScript-based SSI applications with Atala PRISM. It provides a set of
5-
utilities for building SSI Edge Agents speaking DIDComm V2 protocols.
6-
7-
## Basic considerations
8-
9-
### Atala PRISM
1+
# Atala PRISM TypeScript SDK
102

113
Atala PRISM is a self-sovereign identity (SSI) platform and service suite for
124
verifiable data and digital identity. Built on Cardano, it offers core
@@ -20,7 +12,7 @@ The complete platform is separated into multiple repositories:
2012
- [atala-prism-building-blocks](https://github.com/hyperledger-labs/open-enterprise-agent) - Repo that contains the servers Building Blocks.
2113
- [atala-prism-mediator](https://github.com/input-output-hk/atala-prism-mediator) - Repo for DIDComm V2 Mediator
2214

23-
### SDK Overview
15+
## SDK Overview
2416

2517
- Apollo: Provides a suite of necessary cryptographic operations.
2618
- Castor: Provides a suite of operations to create, manage and resolve decentralized identifiers.
@@ -29,61 +21,98 @@ The complete platform is separated into multiple repositories:
2921
- Pluto: Provides an interface for storage operations in a portable, storage-agnostic manner.
3022
- PrismAgent: PrismAgent, a component using all other building blocks, provides basic edge agent capabilities, including implementing DIDComm V2 protocols.
3123

32-
### Getting started
24+
## Getting started
3325

34-
This repository includes a browser and a Node.js demo application, and also a step-by-step documented process to run it.
26+
This repository includes a browser and a Node.js demo application, and also a step-by-step documented process on [how to run it](#running-a-demo-project).
3527

36-
#### Running a demo project
28+
### Use in your project
29+
You can install and use this library in browsers and nodejs.
3730

38-
To be able to run the demos, we have to build `prism-wallet-sdk-ts`.
31+
```bash
32+
npm i @atala/prism-wallet-sdk --save
33+
```
3934

40-
From the repository root run:
35+
or with yarn
36+
37+
```bash
38+
yarn add @atala/prism-wallet-sdk
39+
```
4140

41+
> **Note for Webpack:**
42+
>
43+
> 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
44+
45+
46+
47+
48+
### Running a demo project
49+
50+
#### Building from source
51+
This repository contains compiles typescript code and some rust dependencies for DIDComm and AnonCreds, so in order to build the code from source you will need the following:
52+
53+
* Bash
54+
* Have Rust (cargo) and wasm-pack installed.
55+
* Node JS Version (20/LTS Recommended)
56+
57+
Clone the repository
58+
```
59+
git clone [email protected]:input-output-hk/atala-prism-wallet-sdk-ts.git
60+
```
61+
62+
To be able to run the demos, we have to build `prism-wallet-sdk`.
63+
From the repository root run:
4264

4365
```bash
4466
npm i
4567
npm run build
4668
```
4769

48-
#### For NodeJS
70+
### For NodeJS CJS
4971

50-
After building `prism-wallet-sdk-ts`, cd into `{path}/prism-wallet-sdk-ts/demos/node`:
72+
After building `prism-wallet-sdk`, cd into `{path}/demos/node-cjs` or use visual studio debugger "CJS DEMO":
5173

5274
```bash
75+
cd demos/node-cjs
5376
npm i
54-
node index.js
77+
npm run start
5578
```
5679

57-
:::note
58-
The installation in the `demos/node` directory requires the `build` folder from the wallet-sdk to be available.
59-
:::
80+
> **Note:**
81+
>
82+
> The installation in the `{path}/demos/node-cjs` directory requires the `build` folder from the wallet-sdk to be available.
6083
61-
#### For browser
84+
### For NodeJS ESM
6285

63-
After building `prism-wallet-sdk-ts`, cd into the demo directory "demos/browser"
86+
After building `prism-wallet-sdk`, cd into `{path}/demos/node-esm` or use visual studio debugger "ESM DEMO":
6487

6588
```bash
66-
cd demos/browser
89+
cd demos/node-esm
6790
npm i
6891
npm run start
6992
```
7093

71-
#### Implementing storage for the SDK
72-
This SDK exposes Pluto, a storage interface that should be implemented by the user, in the most appropriate way for a particular use case.
94+
> **Note:**
95+
>
96+
> The installation in the `{path}/demos/node-esm` directory requires the `build` folder from the wallet-sdk to be available.
7397
74-
We don't provide a default implementation out of the box at the moment, but we do provide a couple of demo implementations that can be used to get started with demos and testing.
7598

76-
Provided demo implementations are intentionally oversimplified and SHOULD NOT be used in production.
99+
### For browser
77100

78-
#### Use in your project
79-
In order to use this SDK in your project you now just need to install the package as follows
101+
After building `prism-wallet-sdk`, cd into the demo directory `{path}/demos/browser`
80102

81103
```bash
82-
npm @atala/prism-wallet-sdk --save
104+
cd demos/browser
105+
npm i
106+
npm run start
83107
```
84108

85-
or with yarn
86109

87-
```bash
88-
yarn add @atala/prism-wallet-sdk
89-
```
110+
111+
112+
### Implementing storage for the SDK
113+
This SDK exposes Pluto, a storage interface that should be implemented by the user, in the most appropriate way for a particular use case.
114+
115+
We don't provide a default implementation out of the box at the moment, but we do provide a couple of demo implementations that can be used to get started with demos and testing.
116+
117+
Provided demo implementations are intentionally oversimplified and SHOULD NOT be used in production.
118+

0 commit comments

Comments
 (0)