https://github.com/elastos/elastos.connectivity.client.js.sdk
https://github.com/elastos/elastos.connectivity.client.js.sdk
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/elastos/elastos.connectivity.client.js.sdk
- Owner: elastos
- Created: 2021-06-05T08:49:38.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-09-12T13:04:05.000Z (over 1 year ago)
- Last Synced: 2025-02-11T13:31:33.805Z (4 months ago)
- Language: TypeScript
- Size: 151 KB
- Stars: 0
- Watchers: 22
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Elastos Connectivity Client JS SDK
## Installation
```npm i --save @elastosfoundation/elastos-connectivity-sdk-js```
### Angular apps:
Add SDK styles to your main scss file:
```
@import "~@elastosfoundation/elastos-connectivity-sdk-js/dist/bundle.css";
```## Usage example
```
import { connectivity, Hive } from '@elastosfoundation/elastos-connectivity-sdk-js';
import { EssentialsConnector } from '@elastosfoundation/essentials-connector-client-browser';// If willing to let users use Elastos Essentials to handle operations:
connectivity.registerConnector(new EssentialsConnector());let dataSync = new Hive.DataSync.HiveDataSync(userVault);
```## Architecture
This connectivity SDK contains:
- **Access** (DIDAccess, HiveAccess ...) entry points to easily request private identity information from third-party apps, such as DID credentials, hive authentication credentials, payment with wallet, executing smart contracts, etc.
- A mechanism made of **connectors**, in order to dynamically add custom providers for the **access** services.
- By default, only a **Local Identity Connector** is built-in. This connector is required by all dApps in order to let new users easily join the application while they don't have a decentralized identity yet, but also by app store reviewer teams as app stores usually don't accept applications that force users to depend on a third party wallet application to sign in or do major operations. Local identities provide a built-in DID and hive storage environment for a quick start.
- Additional connectors such as the **Elastos Essentials Connector** or any custom connector **can** be added to let end users use their favorite way to use their identity. By adding the Essentials connector, for instance, end users can pick "Essentials" in the list, and all decentralized operations open the external Elastos Essentials application to request user confirmation. Each application decides which connectors it wants to provide to its users.
- **UI interfaces** for **Generic prompts** and **Local identity prompts** are also provided with a built-in default implementation that prompts end-users with default popups for convenience. Though, those interfaces can be overridden by the application in order to build a custom UI.## Development
### Build for distribution
```npm run build```
The generated output is in **dist/**.
### Build for development
```npm run dev```
Runs webpack in watch mode to auto-rebuild the project on every file change.
## How to publish to npmjs.com
### Publishing account (NPM)
- Organization: @elastosfoundation
- Owner: @benjaminpiette### Useful commands
- `npm adduser` (once)
- `npm login` (once)
- Increase version number in package.json
- `npm publish --access=public`