@tonomy/tonomy-id-sdk
Advanced tools
Comparing version
{ | ||
"version": "0.3.28", | ||
"version": "0.3.29", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"type": "module", | ||
"source": "src/sdk/index.ts", | ||
"main": "./build/sdk/index.cjs", | ||
"module": "./build/sdk/index.module.js", | ||
"unpkg": "./build/sdk/index.umd.js", | ||
"types": "./build/sdk/index.d.ts", | ||
"umd:main": "./build/sdk/index.umd.js", | ||
"exports": { | ||
".": { | ||
"types": "./build/sdk/index.d.ts", | ||
"require": "./build/sdk/index.cjs", | ||
"import": "./build/sdk/index.module.js" | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"src" | ||
"src", | ||
"build" | ||
], | ||
@@ -14,37 +26,26 @@ "engines": { | ||
"scripts": { | ||
"start": "npx tsdx watch --transpileOnly --noClean", | ||
"build": "npx tsdx build", | ||
"test": "npx tsdx test --config ./test/jest.config.tsdx.js", | ||
"test:integration": "tsdx test --detectOpenHandles --config ./test-integration/jest.config.js", | ||
"bootstrap": "npx ts-node --project ./bootstrap-blockchain/tsconfig.json bootstrap-blockchain/bootstrap.ts", | ||
"start": "microbundle watch", | ||
"build:sdk": "microbundle --compress=false", | ||
"build:cli": "microbundle --compress=false --target=node -f cjs -i ./src/cli/index.ts -o build/cli/index.js", | ||
"build": "npm run build:sdk && npm run build:cli", | ||
"test:unit": "jest --selectProjects \"Unit tests\"", | ||
"test:setup": "./test-integration/build-and-run-services.sh start", | ||
"test:integration": "jest --detectOpenHandles --selectProjects \"Integration tests\"", | ||
"test": "jest --detectOpenHandles", | ||
"cli": "node ./build/cli/index.cjs", | ||
"lint": "eslint src test --ext .ts --resolve-plugins-relative-to .", | ||
"lint:fix": "npm run lint -- --fix", | ||
"prepare": "npx tsdx build --transpileOnly --noClean", | ||
"size": "size-limit", | ||
"analyze": "size-limit --why", | ||
"release": "semantic-release --debug" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "tsdx lint" | ||
} | ||
}, | ||
"name": "@tonomy/tonomy-id-sdk", | ||
"author": "Jack Tanner", | ||
"module": "dist/tonomy-id-sdk.esm.js", | ||
"size-limit": [ | ||
{ | ||
"path": "dist/tonomy-id-sdk.cjs.production.min.js", | ||
"limit": "10 KB" | ||
}, | ||
{ | ||
"path": "dist/tonomy-id-sdk.esm.js", | ||
"limit": "10 KB" | ||
} | ||
], | ||
"devDependencies": { | ||
"@babel/core": "^7.21.4", | ||
"@babel/node": "^7.20.7", | ||
"@babel/preset-env": "^7.21.4", | ||
"@babel/preset-typescript": "^7.21.4", | ||
"@semantic-release/changelog": "^6.0.2", | ||
"@semantic-release/git": "^10.0.1", | ||
"@size-limit/preset-small-lib": "^8.0.0", | ||
"@types/elliptic": "^6.4.14", | ||
"@types/jest": "^29.5.0", | ||
"@types/randombytes": "^2.0.0", | ||
@@ -54,15 +55,14 @@ "@typescript-eslint/eslint-plugin": "^5.40.0", | ||
"address": "^1.2.2", | ||
"argon2": "^0.30.2", | ||
"babel-jest": "^29.5.0", | ||
"eslint": "^8.25.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-jest": "^27.2.1", | ||
"eslint-plugin-prettier": "^3.4.1", | ||
"husky": "^8.0.1", | ||
"jest-environment-jsdom": "^24.9.0", | ||
"jest": "^29.5.0", | ||
"jest-environment-jsdom": "^29.5.0", | ||
"jsdom-url": "^3.0.1", | ||
"microbundle": "^0.15.1", | ||
"prettier": "^2.7.1", | ||
"semantic-release": "^20.1.1", | ||
"size-limit": "^8.0.0", | ||
"ts-jest": "^29.0.5", | ||
"ts-node": "^10.9.1", | ||
"tsdx": "^0.14.1", | ||
"tslib": "^2.4.0", | ||
@@ -80,2 +80,3 @@ "typescript": "^4.7.4" | ||
"@tonomy/did-resolver": "^4.0.4", | ||
"argon2": "^0.30.3", | ||
"cross-fetch": "^3.1.5", | ||
@@ -82,0 +83,0 @@ "elliptic": "^6.5.4", |
# Tonomy ID SDK | ||
This Software Development Kit is used in Tonomy ID to interact and call with the Antelope blockchain and services. It is also used as the public API for integration by applications to do single sign-on, share credentials and sign transactions. | ||
The Software Development Kit is used in the Tonomy ID ecosystems to interact with Tonomy identities and services. | ||
It has four outputs: | ||
- **SDK**: `./src/sdk` The SDK which acts as the business logic in Tonomy ID wallet. This is the main output. | ||
- **API**: `./src/api` The API library used by integrators to interact with Tonomy ID users and to do single sign-on, share credentials and sign transactions. (currently bundled in the SDK package but intended for external bundle later. see <https://github.com/Tonomy-Foundation/Tonomy-ID-SDK/pull/196#issuecomment-1497478858>) | ||
- **Bootstrap CLI**: `./src/cli/bootstrap` A script used to initialize the blockchain with the Tonomy Contracts and starting accounts. | ||
- **Apps CLI**: `./src/cli/apps` A CLI tool to create, update and delete Tonomy Apps. | ||
The SDK is written in typescript with jest to run tests. | ||
@@ -19,3 +26,15 @@ | ||
- [Contracts](https://github.com/Tonomy-Foundation/Tonomy-Contracts) (inside SDK repo) - Smart contracts to run the governance, identity, DAO, token and other ecosystem tools. This is used to run the integration tests | ||
- [Communication](https://github.com/Tonomy-Foundation/Tonomy-Communication) (inside SDK repo) - Service to provide peer-to-peer messaging for Tonomy ID users. This is used to run the integration tests | ||
## Build | ||
`npm run build` | ||
Build notes: | ||
- Build just the sdk `npm run build:sdk` | ||
- Build just the cli `npm run build:cli` | ||
- Cli has dependency of `argon2` package, which is not needed by SDK and should be moved to a devDependency if these softwares are ever separated. | ||
- Cli depends on a few files in the `./test-integration` directory. Ideally `tsconfig.ts` should specify `"rootDir": "src" but this currently fails because of this dependency. | ||
## Run | ||
@@ -27,3 +46,3 @@ | ||
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`. | ||
This builds to `/build` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/build`. | ||
@@ -38,3 +57,3 @@ To do a one-off build, use `npm run build`. | ||
`npm test` | ||
`npm test:unit` | ||
@@ -45,6 +64,22 @@ ### Integration tests | ||
Require another service to be running, such as the blockchain or Tonomy Communication service. | ||
First run the blockchain or Tonomy Communication service locally. | ||
`./test-integration/build-and-run-tests.sh` | ||
`npm run test:setup` | ||
Then run the tests | ||
`npm run test:integration` | ||
### Run all tests in the VS Code debugger | ||
Make sure you install the Jest extension (recommended automatically when you open VS Code) | ||
If you also want to do this with the integration tests then run `npm run test:setup` first | ||
Then go to any test e.g. `test/app.test.ts` and you can click ▶️ or right click and press "Debug test". You can also look at the Jest Test Explorer in the left-side activity bar. | ||
## Command line interface | ||
`npm run cli` | ||
## Linting | ||
@@ -51,0 +86,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1504630
33.68%174
141.67%16414
30.35%2
-33.33%98
55.56%Yes
NaN12
9.09%26
13.04%3
200%7
75%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added