Compare commits

...

4 Commits

Author SHA1 Message Date
balzack
1a8e99aeae fixing error from cleanup 2025-03-03 14:55:38 -08:00
balzack
d64353e238 updated publish number 2025-03-03 14:30:27 -08:00
Pierre Balzack
35e13c30bb
Update README.md 2025-03-03 14:27:39 -08:00
balzack
dd4e26eb1c updated doc 2025-03-03 14:19:10 -08:00
4 changed files with 35 additions and 13 deletions

View File

@ -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>

View File

@ -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",

View File

@ -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;

View File

@ -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);