diff --git a/README.md b/README.md index 029f7834..f99b9683 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,10 @@ Using `iam-client-lib`, Switchboard allows users to: - Define hierarchical, role-based structures for [organizations](./docs/guides/organization.md), [applications](./docs/guides/application.md) and [assets](./docs/guides/asset.md) that participate in grid activities - Request and issue Verifiable Credentials that are required to take on roles within an organization or application that is registered on Switchboard +## Documentation +For documentation on `iam-client-lib` modules and API: +- [ReadTheDocs](https://energy-web-foundation-iam-client-lib.readthedocs-hosted.com/) + ## Development The following is for installing and building `iam-client-lib` directly. For guidance on how to integrate the library into an application, see [**Getting Started**](#getting-started) below. @@ -135,10 +139,6 @@ const { const { didRegistry, claimsService } = await connectToDidRegistry(); ``` -## Documentation -For further documentation on `iam-client-lib` modules and API: -- [ReadTheDocs](https://energy-web-foundation-iam-client-lib.readthedocs-hosted.com/) - ## Contributing Guidelines Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us. diff --git a/docs/Quick_start.md b/docs/Quick_start.md deleted file mode 100644 index ae3150d8..00000000 --- a/docs/Quick_start.md +++ /dev/null @@ -1,86 +0,0 @@ -# Quick start - -For development purposes, please follow below steps to integrate the library with your dApps. - -## Prerequisites - -`iam-client-lib` is written in TypeScript. Make sure to have Node.js (>= v10) installed. Create a folder named **_iam-client-lib_** and clone this GIT project. - -Also note that having a DID document with a public key is a prerequisite for using iam-client-lib and during initialization the library with attempt to add a public key to the DID document if one doesn't exist. This addition of the public key requires the account to be funded. - -`iam-client-lib` has a WebAssembly dependency. Some bundlers/frameworks doesn't support it out of the box, so some action are required. Here is a list of known problems: - -- **Angular** - you'll have to add following in you `package.json` - -``` -"browser": { - "fs": false, - "os": false, - "path": false - } -``` - -- **React** - you'll have to add a `wasm-loader` for the files with `.wasm` extension to your Webpack configuration. To edit Webpack config you can use [@craco/craco](https://www.npmjs.com/package/@craco/craco) or [react-app-rewired](https://www.npmjs.com/package/react-app-rewired). - -## Install - -Latest stable version - -```sh -npm i iam-client-lib -``` - -Prerelease version - -```sh -npm i iam-client-lib@canary -``` - -Some library dependencies require Node.js built-ins. Therefore when library is used in browser make sure they are polyfilled. If application is bundled with Webpack dependencies can be polyfilled with [node-polyfill-webpack-plugin](https://www.npmjs.com/package/node-polyfill-webpack-plugin) - -## Initialization - -Because of dependencies between modules they should be initialized in right order. This is achieved by accessing module initializer from initialization function of required module. - -1. Initializing signer service. It will initialize staking and messaging services and allow to connect to cache server - -```js -const { signerService, messagingService, connectToCacheServer } = - await initWithPrivateKeySigner(privateKey, rpcUrl); -``` - -2. Connecting to cache server. Depending on signer type signature might be requested - -```js -// IAM has builtin default settings for VOLTA CHAIN, which can overriden -// 1111 is an example of another ChainID (https://chainlist.org/) -setChainConfig(1111, { - didContractAddress: '0x3e2fb24edc3536d655720280b427c91bcb55f3d6', - ensRegistryAddress: '0xa372d665f83197a63bbe633ebe19c7bfd4943003', - ensResolverAddress: '0xe878bdcf5148307378043bfd2b584909aa48a227', - rpcUrl: 'http://some-rpc.com', -}); - -setMessagingConfig(1111, { - messagingMethod: MessagingMethod.Nats, - natsServerUrl: 'https://some-exchange-server.com', -}); - -setCacheConfig(1111, { - url: 'https://some-cache-server.com/', - cacheServerSupportsAuth: true, -}); - -const { - cacheClient, - domainsService, - connectToDidRegistry, - verifiableCredentialsService, -} = await connectToCacheServer(); -``` - -3. Connecting to DID registry. - -```js -const { didRegistry, claimsService } = await connectToDidRegistry(); -``` diff --git a/docs/api/README.md b/docs/api/README.md index 6537b484..6a76cbf1 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -21,6 +21,10 @@ Using `iam-client-lib`, Switchboard allows users to: - Define hierarchical, role-based structures for [organizations](./docs/guides/organization.md), [applications](./docs/guides/application.md) and [assets](./docs/guides/asset.md) that participate in grid activities - Request and issue Verifiable Credentials that are required to take on roles within an organization or application that is registered on Switchboard +## Documentation +For documentation on `iam-client-lib` modules and API: +- [ReadTheDocs](https://energy-web-foundation-iam-client-lib.readthedocs-hosted.com/) + ## Development The following is for installing and building `iam-client-lib` directly. For guidance on how to integrate the library into an application, see [**Getting Started**](#getting-started) below. @@ -134,10 +138,6 @@ const { const { didRegistry, claimsService } = await connectToDidRegistry(); ``` -## Documentation -For further documentation on `iam-client-lib` modules and API: -- [ReadTheDocs](https://energy-web-foundation-iam-client-lib.readthedocs-hosted.com/) - ## Contributing Guidelines Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us. diff --git a/docs/api/classes/modules_verifiable_credentials.VerifiableCredentialsServiceBase.md b/docs/api/classes/modules_verifiable_credentials.VerifiableCredentialsServiceBase.md index 78b55937..c1a85528 100644 --- a/docs/api/classes/modules_verifiable_credentials.VerifiableCredentialsServiceBase.md +++ b/docs/api/classes/modules_verifiable_credentials.VerifiableCredentialsServiceBase.md @@ -42,7 +42,7 @@ verifiableCredentialsService.createRoleVC(...); ### continueExchange -▸ **continueExchange**(`__namedParameters`): `Promise`<`undefined` \| `VpRequest` \| `VerifiablePresentation`\> +▸ **continueExchange**(`__namedParameters`): `Promise`<`undefined` \| `VerifiablePresentation` \| `VpRequest`\> **`description`** Sends credentials requested by issuer and returns either issued credentials or next credentials request @@ -54,7 +54,7 @@ verifiableCredentialsService.createRoleVC(...); #### Returns -`Promise`<`undefined` \| `VpRequest` \| `VerifiablePresentation`\> +`Promise`<`undefined` \| `VerifiablePresentation` \| `VpRequest`\> issued credentials or request of additional credentials diff --git a/package.json b/package.json index e84c9456..a4f12ae6 100644 --- a/package.json +++ b/package.json @@ -150,7 +150,7 @@ }, "husky": { "hooks": { - "pre-commit": "lint-staged && rm -rf docs/api && typedoc --plugin typedoc-plugin-markdown --hideBreadcrumbs true && git add -A docs/api/" + "pre-commit": "lint-staged && rm -rf docs/api && cp README.md docs/index.md && typedoc --plugin typedoc-plugin-markdown --hideBreadcrumbs true && git add -A docs/api/" } }, "lint-staged": {