mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 00:50:03 +00:00
Compare commits
4 Commits
df4013f884
...
1a8e99aeae
Author | SHA1 | Date | |
---|---|---|---|
|
1a8e99aeae | ||
|
d64353e238 | ||
|
35e13c30bb | ||
|
dd4e26eb1c |
@ -1,8 +1,6 @@
|
||||
!!! still a work in progress !!!
|
||||
DatabagClientSDK provides a typescript interface for communication over the decentralized Databag network.
|
||||
|
||||
DatabagClientSDK provides a typescript interface for communication over the decentralized databag network. The SDK has minimal dependencies and contains reference applications for react-js, react-native, and node.
|
||||
|
||||
The API is provided through a set of interfaces; each interface groups methods by their functionality and are only allocated as needed. The platform specific implementations of storage and cryptography are defined externally and are also provided to the SDK through interfaces.
|
||||
The API is provided through a set of interfaces; each interface groups methods by their functionality and only need to be allocated as needed. The platform specific implementations of storage and cryptography are defined externally and are also provided to the SDK through interfaces.
|
||||
|
||||
## Initialization
|
||||
|
||||
@ -13,7 +11,7 @@ The API is provided through a set of interfaces; each interface groups methods b
|
||||
|
||||
The [Params](https://github.com/balzack/databag/blob/sdk/app/sdk/src/types.ts) argument specifies the data to syncrhonize. The crypto, staging and log arguments are provided by implementing the [Crypto](https://github.com/balzack/databag/blob/sdk/app/sdk/src/crypto.ts), [Staging](https://github.com/balzack/databag/blob/sdk/app/sdk/src/staging.ts) and [Logging](https://github.com/balzack/databag/blob/sdk/app/sdk/src/logging.ts) interface respectively.
|
||||
|
||||
```DatabagClientSDK(params: Params, crypto?: Crypto, staging?: Staging, log?: Logging)```
|
||||
```new DatabagClientSDK(params: Params, crypto?: Crypto, staging?: Staging, log?: Logging)```
|
||||
</ul>
|
||||
<br>
|
||||
|
||||
@ -383,6 +381,18 @@ Configure allocates the Service interface for the server
|
||||
```Ring::addRingingListener(ev: (calls: { cardId: string, callId: string }[]) => void): void```
|
||||
```Ring::removeRingingListener(ev: (calls: { cardId: string, callId: string }[]) => void): void```
|
||||
|
||||
Accept an incoming link request with accept
|
||||
|
||||
```Link::accept(cardId: string, callId: string, contactNode: string): Promise<Link>```
|
||||
|
||||
Decline an incoming link notifying requestor
|
||||
|
||||
```Link::decline(cardId: string, callId: string, contactNode: string): Promise<void>```
|
||||
|
||||
Ignore an incoming link request without notifying requestor
|
||||
|
||||
```Link::ignore(cardId: string, callId: string): Promise<void>```
|
||||
|
||||
</ul>
|
||||
|
||||
<br>
|
||||
@ -390,7 +400,7 @@ Configure allocates the Service interface for the server
|
||||
|
||||
|
||||
<details>
|
||||
<summary>Link interface module provides a manages a link between contacts</summary><br>
|
||||
<summary>Link interface module manages a proxied link between contacts</summary><br>
|
||||
|
||||
<ul>
|
||||
|
||||
@ -399,6 +409,22 @@ Configure allocates the Service interface for the server
|
||||
```Link::setStatusListener(ev: (status: string) => Promise<void>): void```
|
||||
```Link::clearStatusListener(): void```
|
||||
|
||||
The messages are received through through a listener
|
||||
|
||||
```Link::setMessageListener(ev: (message: any) => Promise<void>): void```
|
||||
```Link::clearMessageListener(): void```
|
||||
|
||||
Messages are sent to contact through sendMessage
|
||||
|
||||
```Link::sendMessage(message: any): Promise<void>```
|
||||
|
||||
WebRTC ICE params are provided through a dedicated method
|
||||
|
||||
```Link::getIce(): { urls: string; username: string; credential: string }[]```
|
||||
|
||||
Close is called to close the connection
|
||||
|
||||
```Link::close(): Promise<void>```
|
||||
|
||||
</ul>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "databag-client-sdk",
|
||||
"version": "0.0.25",
|
||||
"version": "0.0.28",
|
||||
"description": "an SDK for developing Databag applications",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
|
@ -49,7 +49,6 @@ export class ContactModule implements Contact {
|
||||
private secure: boolean;
|
||||
private loaded: boolean;
|
||||
private emitter: EventEmitter;
|
||||
private articleTypes: string[];
|
||||
private channelTypes: string[];
|
||||
private seal: { privateKey: string; publicKey: string } | null;
|
||||
private unsealAll: boolean;
|
||||
@ -84,7 +83,7 @@ export class ContactModule implements Contact {
|
||||
// view of channels
|
||||
private channelEntries: Map<string, Map<string, { item: ChannelItem; channel: Channel }>>;
|
||||
|
||||
constructor(log: Logging, store: Store, crypto: Crypto | null, staging: Staging | null, guid: string, token: string, node: string, secure: boolean, articleTypes: string[], channelTypes: string[]) {
|
||||
constructor(log: Logging, store: Store, crypto: Crypto | null, staging: Staging | null, guid: string, token: string, node: string, secure: boolean, channelTypes: string[]) {
|
||||
this.guid = guid;
|
||||
this.token = token;
|
||||
this.node = node;
|
||||
@ -94,7 +93,6 @@ export class ContactModule implements Contact {
|
||||
this.crypto = crypto;
|
||||
this.staging = staging;
|
||||
this.emitter = new EventEmitter();
|
||||
this.articleTypes = articleTypes;
|
||||
this.channelTypes = channelTypes;
|
||||
this.unsealAll = false;
|
||||
this.loaded = false;
|
||||
|
@ -42,7 +42,6 @@ export class SessionModule implements Session {
|
||||
private ring: RingModule;
|
||||
private connection: Connection;
|
||||
private channelTypes: string[];
|
||||
private articleTypes: string[];
|
||||
|
||||
constructor(store: Store, crypto: Crypto | null, log: Logging, staging: Staging | null, guid: string, token: string, node: string, secure: boolean, loginTimestamp: number, channelTypes: string[]) {
|
||||
log.info('new databag session');
|
||||
@ -56,14 +55,13 @@ export class SessionModule implements Session {
|
||||
this.node = node;
|
||||
this.secure = secure;
|
||||
this.channelTypes = channelTypes;
|
||||
this.articleTypes = [];
|
||||
this.loginTimestamp = loginTimestamp;
|
||||
this.status = 'connecting';
|
||||
this.emitter = new EventEmitter();
|
||||
|
||||
this.identity = new IdentityModule(log, this.store, guid, token, node, secure);
|
||||
this.settings = new SettingsModule(log, this.store, this.crypto, guid, token, node, secure);
|
||||
this.contact = new ContactModule(log, this.store, this.crypto, this.staging, guid, token, node, secure, articleTypes, channelTypes);
|
||||
this.contact = new ContactModule(log, this.store, this.crypto, this.staging, guid, token, node, secure, channelTypes);
|
||||
this.alias = new AliasModule(log, this.settings, this.store, guid, token, node, secure);
|
||||
this.attribute = new AttributeModule(log, this.settings, this.store, guid, token, node, secure);
|
||||
this.stream = new StreamModule(log, this.store, this.crypto, this.staging, guid, token, node, secure, channelTypes);
|
||||
|
Loading…
Reference in New Issue
Block a user