@massalabs/gossip-sdk 0.0.2-dev.20260212071538 → 0.0.2-dev.20260212083011

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export { restMessageProtocol, RestMessageProtocol, type EncryptedMessage, } from './messageProtocol';
@@ -0,0 +1 @@
1
+ export { restMessageProtocol, RestMessageProtocol, } from './messageProtocol';
@@ -4,16 +4,14 @@
4
4
  * Factory functions and exports for message protocol implementations.
5
5
  */
6
6
  export type { EncryptedMessage, IMessageProtocol, MessageProtocolResponse, BulletinItem, } from './types';
7
- export { RestMessageProtocol } from './rest';
8
- export { MessageProtocol } from './mock';
9
7
  import type { IMessageProtocol } from './types';
10
- import { type MessageProtocolType } from '../../config/protocol';
11
8
  /**
12
9
  * Factory function to create message protocol instances
13
10
  */
14
- export declare function createMessageProtocol(type?: MessageProtocolType, config?: Partial<{
11
+ export declare function createMessageProtocol(config?: Partial<{
15
12
  baseUrl: string;
16
13
  timeout: number;
17
14
  retryAttempts: number;
18
15
  }>): IMessageProtocol;
19
16
  export declare const restMessageProtocol: IMessageProtocol;
17
+ export { RestMessageProtocol } from './rest';
@@ -3,24 +3,13 @@
3
3
  *
4
4
  * Factory functions and exports for message protocol implementations.
5
5
  */
6
- export { RestMessageProtocol } from './rest';
7
- export { MessageProtocol } from './mock';
8
- import { defaultMessageProtocol, protocolConfig, } from '../../config/protocol';
6
+ import { protocolConfig } from '../../config/protocol';
9
7
  import { RestMessageProtocol } from './rest';
10
- import { MessageProtocol } from './mock';
11
8
  /**
12
9
  * Factory function to create message protocol instances
13
10
  */
14
- export function createMessageProtocol(type = defaultMessageProtocol, config) {
15
- switch (type) {
16
- case 'rest': {
17
- return new RestMessageProtocol(config?.baseUrl || protocolConfig.baseUrl, config?.timeout || 10000, config?.retryAttempts || 3);
18
- }
19
- case 'mock': {
20
- return new MessageProtocol(config?.baseUrl || protocolConfig.baseUrl, config?.timeout || 10000, config?.retryAttempts || 3);
21
- }
22
- default:
23
- throw new Error(`Unsupported message protocol type: ${type}`);
24
- }
11
+ export function createMessageProtocol(config) {
12
+ return new RestMessageProtocol(config?.baseUrl ?? protocolConfig.baseUrl, config?.timeout ?? protocolConfig.timeout, config?.retryAttempts ?? protocolConfig.retryAttempts);
25
13
  }
26
14
  export const restMessageProtocol = createMessageProtocol();
15
+ export { RestMessageProtocol } from './rest';
@@ -0,0 +1,2 @@
1
+ export * from './bip39';
2
+ export * from './encryption';
@@ -0,0 +1,2 @@
1
+ export * from './bip39';
2
+ export * from './encryption';
@@ -60,9 +60,6 @@ import { SessionManagerWrapper, } from './wasm/bindings';
60
60
  import { SdkEventEmitter, SdkEventType, } from './core/SdkEventEmitter';
61
61
  import { SdkPolling } from './core/SdkPolling';
62
62
  export { SdkEventType };
63
- // ─────────────────────────────────────────────────────────────────────────────
64
- // Types
65
- // ─────────────────────────────────────────────────────────────────────────────
66
63
  export var SdkStatus;
67
64
  (function (SdkStatus) {
68
65
  SdkStatus["UNINITIALIZED"] = "uninitialized";
package/dist/index.d.ts CHANGED
@@ -12,21 +12,9 @@
12
12
  *
13
13
  * @packageDocumentation
14
14
  */
15
- export { createGossipSdk, GossipSdk, SdkEventType } from './gossipSdk';
16
- export type { GossipSdkInitOptions, OpenSessionOptions, SdkEventHandlers, } from './gossipSdk';
15
+ export * from './api';
16
+ export * from './crypto';
17
17
  export * from './db';
18
- export * from './utils/userId';
19
- export * from './utils/base64';
20
- export * from './utils/validation';
21
- export * from './utils/announcementPayload';
22
- export * from './utils/discussions';
23
- export * from './utils/contacts';
24
- export type { Result } from './utils/type';
25
- export * from './crypto/bip39';
26
- export * from './crypto/encryption';
27
- export * from './wasm/encryption';
28
- export * from './wasm/userKeys';
29
- export { SessionStatus, UserPublicKeys, UserSecretKeys, SendMessageOutput, ReceiveMessageOutput, AnnouncementResult, } from './wasm/bindings';
30
- export { restMessageProtocol, RestMessageProtocol, } from './api/messageProtocol';
31
- export type { EncryptedMessage } from './api/messageProtocol';
32
- export type { PublicKeyResult } from './services/auth';
18
+ export * from './gossip';
19
+ export * from './utils';
20
+ export * from './wasm';
package/dist/index.js CHANGED
@@ -12,35 +12,9 @@
12
12
  *
13
13
  * @packageDocumentation
14
14
  */
15
- // ─────────────────────────────────────────────────────────────────────────────
16
- // SDK Primary API
17
- // ─────────────────────────────────────────────────────────────────────────────
18
- export { createGossipSdk, GossipSdk, SdkEventType } from './gossipSdk';
19
- // ─────────────────────────────────────────────────────────────────────────────
20
- // Database — entity types, enums, database class
21
- // ─────────────────────────────────────────────────────────────────────────────
15
+ export * from './api';
16
+ export * from './crypto';
22
17
  export * from './db';
23
- // ─────────────────────────────────────────────────────────────────────────────
24
- // Utilities — export entire modules (safe: pure functions / types)
25
- // ─────────────────────────────────────────────────────────────────────────────
26
- export * from './utils/userId';
27
- export * from './utils/base64';
28
- export * from './utils/validation';
29
- export * from './utils/announcementPayload';
30
- export * from './utils/discussions';
31
- export * from './utils/contacts';
32
- // ─────────────────────────────────────────────────────────────────────────────
33
- // Crypto — key generation, encryption, mnemonic
34
- // ─────────────────────────────────────────────────────────────────────────────
35
- export * from './crypto/bip39';
36
- export * from './crypto/encryption';
37
- export * from './wasm/encryption';
38
- export * from './wasm/userKeys';
39
- // ─────────────────────────────────────────────────────────────────────────────
40
- // WASM bindings — session status, public keys, protocol outputs
41
- // ─────────────────────────────────────────────────────────────────────────────
42
- export { SessionStatus, UserPublicKeys, UserSecretKeys, SendMessageOutput, ReceiveMessageOutput, AnnouncementResult, } from './wasm/bindings';
43
- // ─────────────────────────────────────────────────────────────────────────────
44
- // Protocol
45
- // ─────────────────────────────────────────────────────────────────────────────
46
- export { restMessageProtocol, RestMessageProtocol, } from './api/messageProtocol';
18
+ export * from './gossip';
19
+ export * from './utils';
20
+ export * from './wasm';
@@ -6,13 +6,6 @@
6
6
  import { UserPublicKeys } from '../wasm/bindings';
7
7
  import { IMessageProtocol } from '../api/messageProtocol/types';
8
8
  import { type GossipDatabase } from '../db';
9
- export type PublicKeyResult = {
10
- publicKey: UserPublicKeys;
11
- error?: never;
12
- } | {
13
- publicKey?: never;
14
- error: string;
15
- };
16
9
  export declare class AuthService {
17
10
  private db;
18
11
  messageProtocol: IMessageProtocol;
@@ -21,7 +14,7 @@ export declare class AuthService {
21
14
  * Fetch public key by userId
22
15
  * @param userId - Bech32-encoded userId (e.g., "gossip1...")
23
16
  */
24
- fetchPublicKeyByUserId(userId: string): Promise<PublicKeyResult>;
17
+ fetchPublicKeyByUserId(userId: string): Promise<UserPublicKeys>;
25
18
  /**
26
19
  * Ensure public key is published (check first, then publish if needed).
27
20
  * If no user profile exists, the key is still published so the gossip ID is discoverable.
@@ -28,14 +28,10 @@ export class AuthService {
28
28
  async fetchPublicKeyByUserId(userId) {
29
29
  try {
30
30
  const base64PublicKey = await this.messageProtocol.fetchPublicKeyByUserId(decodeUserId(userId));
31
- return {
32
- publicKey: UserPublicKeys.from_bytes(decodeFromBase64(base64PublicKey)),
33
- };
31
+ return UserPublicKeys.from_bytes(decodeFromBase64(base64PublicKey));
34
32
  }
35
33
  catch (err) {
36
- return {
37
- error: getPublicKeyErrorMessage(err),
38
- };
34
+ throw new Error(getPublicKeyErrorMessage(err));
39
35
  }
40
36
  }
41
37
  /**
@@ -0,0 +1,8 @@
1
+ export * from './announcementPayload';
2
+ export * from './base64';
3
+ export * from './contacts';
4
+ export * from './discussions';
5
+ export * from './queue';
6
+ export * from './type';
7
+ export * from './userId';
8
+ export * from './validation';
@@ -0,0 +1,8 @@
1
+ export * from './announcementPayload';
2
+ export * from './base64';
3
+ export * from './contacts';
4
+ export * from './discussions';
5
+ export * from './queue';
6
+ export * from './type';
7
+ export * from './userId';
8
+ export * from './validation';
@@ -8,3 +8,4 @@ export { SessionModule, sessionStatusToString } from './session';
8
8
  export { initializeWasm, ensureWasmInitialized, startWasmInitialization, } from './loader';
9
9
  export * from './encryption';
10
10
  export * from './userKeys';
11
+ export { SessionStatus, UserPublicKeys, UserSecretKeys, SendMessageOutput, ReceiveMessageOutput, AnnouncementResult, } from './bindings';
@@ -11,3 +11,4 @@ export { initializeWasm, ensureWasmInitialized, startWasmInitialization, } from
11
11
  // Export specialized WASM functionality
12
12
  export * from './encryption';
13
13
  export * from './userKeys';
14
+ export { SessionStatus, UserPublicKeys, UserSecretKeys, SendMessageOutput, ReceiveMessageOutput, AnnouncementResult, } from './bindings';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massalabs/gossip-sdk",
3
- "version": "0.0.2-dev.20260212071538",
3
+ "version": "0.0.2-dev.20260212083011",
4
4
  "description": "Gossip SDK for automation, chatbot, and integration use cases",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
File without changes