UNPKG

@tangle-js/anchors

Version:

Anchoring messages to the Tangle. Powered by IOTA Streams

35 lines (34 loc) 1.22 kB
import { Subscriber, StreamsClient } from "@tangle.js/streams-wasm/node/streams.js"; import type { IBindChannelRequest } from "../models/IBindChannelRequest"; /** * Service to interact with IOTA Streams Channels * */ export default class ChannelService { /** * Creates a new Channel * @param client The client to use * @param seed The channel's seed * @param isPrivate Whether the channel is private or not * @param psks Preshared keys for the channel * @returns The address of the channel created and the announce message ID */ static createChannel(client: StreamsClient, seed: string, isPrivate: boolean, psks?: string[]): Promise<{ channelAddress: string; announceMsgID: string; keyLoadMsgID?: string; authorPk: string; }>; /** * Binds to a channel by creating the corresponding IOTA Streams Subscriber and reading * the announce message * * @param request The channel details * @returns IOTA Streams Subscriber object */ static bindToChannel(request: IBindChannelRequest): Promise<{ subscriber: Subscriber; authorPk: string; }>; private static preparePrivateChannel; }