Skip to main content

Iota Streams C Bindings API Reference

Author

auth_new(auth, seed, implementation, tsp): err_t

Generates an Author instance

ParamTypeDescription
authauthor_t *Placeholder for resulting Author instance
seedchar const *Unique user seed
implementationuint8_tChannel Type
tsptransport_t *Transport Client Wrapper

Returns: Error code.

auth_recover(auth, seed, announcement, implementation, tsp): err_t

Recover an Author instance using the announcement address link and seed.

ParamTypeDescription
authauthor_t *Placeholder for resulting Author instance
seedchar const *Unique user seed
announcementaddress_t const *Announcement link
implementationuint8_tChannel Type
tsptransport_t *Transport Client Wrapper

Returns: A recovered Author instance for administrating a channel.

auth_drop(author)

Drop an Author instance from memory.

ParamTypeDescription
authorauthor_t *Author instance

auth_import(auth, buffer, password, transport): err_t

Import an Author instance from an encrypted binary array

ParamTypeDescription
authauthor_t *Placeholder for resulting Author instance
bytesbuffer_tBuffer with exported data
passwordchar const *Key to decrypt binary
transporttransport_t *Transport Client Wrapper

Returns: Error code.

auth_export(buf, author, password): err_t

Export an Author instance as an encrypted array using a given password

ParamTypeDescription
bufbuffer_t *Placeholder for resulting buffer stream of encrypted Author instance
authorauthor_t *Author instance
passwordchar const *Key to encrypt

Returns: Error code.

auth_channel_address(addr, author): err_t

Return the channel address of the channel instance.

ParamTypeDescription
addrchannel_address_t const *Placeholder for resulting channel address object
authorauthor_t const *Author instance

Returns: Error Code.

auth_announcement_link(addr, author): err_t

Return the announcement link of the channel instance.

ParamTypeDescription
addraddress_t const *Placeholder for resulting announcement link object
authorauthor_t const *Author instance

Returns: Error code.

auth_is_multi_branching(flag, author): err_t

Check if a channel type is single branching or multi branching.

ParamTypeDescription
flaguint8_t *Placeholder for resulting multi-branching flag: 0=single branch, 1=multi branch
authorauthor_t const *Author instance

Returns: Error code.

auth_get_public_key(pk, author): err_t

Retrieve the Author public key.

ParamTypeDescription
pkpublic_key_t const *Placeholder for resulting Author Public Key
authorauthor_t const *Author instance

Returns: Error code.

auth_send_announce(addr, author): err_t

Send an announcement message, initialising the channel

ParamTypeDescription
addraddress_t const *Placeholder for resulting announcement message address
authorauthor_t *Author instance

Returns: Error code.

Send a keyload message for all subscribed participants in the channel, linked to a previous message (usually the announcement in a multi branch).

ParamTypeDescription
linksmessage_links_t *Placeholder for resulting Message Links wrapper around the keyload message link and sequence link.
authorauthor_t *Author instance
link_toaddress_t const *Address of message being linked to

Returns: Error code.

Send a keyload message for specified subscribers and pre shared keys in the channel, linked to a previous message (usually the announcement in a multi branch).

ParamTypeDescription
linksmessage_links_t *Placeholder for resulting Message Links wrapper around the keyload message link and sequence link.
authorauthor_t *Author instance
link_toaddress_t const *Address of message being linked to
psk_idspsk_ids_t *Array of PskId's for included subscribers
ke_pkske_pks_t *Array of Public Keys for included subscribers

Returns: Error code.

Process a subscription message by its link.

ParamTypeDescription
authorauthor_t *Author instance
linkaddress_t const *Address of subscription message

Returns: Error code.

Process an unsubscription message by its link.

ParamTypeDescription
authorauthor_t *Author instance
linkaddress_t const *Address of unsubscription message

Returns: Error code.

Send a tagged packet message linked to a previous message.

ParamTypeDescription
linksmessage_links_t *Placeholder for resulting Message Links wrapper around the tagged packet link and sequence link.
authorauthor_t *Author instance
link_tomessage_links_tAddress of message being linked to
public_payload_ptruint8_t const *Byte array of public payload pointer
public_payload_sizesize_tLength of public payload byte array
masked_payload_ptruint8_t const *Byte array of masked payload pointer
masked_payload_sizesize_tLength of masked payload byte array

Returns: Error code.

Send a signed packet message linked to a previous message.

ParamTypeDescription
linksmessage_links_t *Placeholder for resulting Message Links wrapper around the signed packet link and sequence link.
authorauthor_t *Author instance
link_tomessage_links_tAddress of message being linked to
public_payload_ptruint8_t const *Byte array of public payload pointer
public_payload_sizesize_tLength of public payload byte array
masked_payload_ptruint8_t const *Byte array of masked payload pointer
masked_payload_sizesize_tLength of masked payload byte array

Returns: Error code.

Receive a tagged packet by its link.

ParamTypeDescription
payloadspacket_payloads_t *Placeholder for resulting Packet Payloads wrapper around the tagged packet message
authorauthor_t *Author instance
linkaddress_t const *Address of tagged packet message

Returns: Error code.

Receive a signed packet by its link.

ParamTypeDescription
payloadspacket_payloads_t *Placeholder for resulting Packet Payloads wrapper around the signed packet message
authorauthor_t *Author instance
linkaddress_t const *Address of signed packet message

Returns: Error code.

Receive a sequence message by its link, and return the address of the sequenced message.

ParamTypeDescription
seqaddress_t const **The address link of the sequenced message.
authorauthor_t *Author instance
linkaddress_t const *Address of sequence message

Returns: Error code.

Receive a message generically without knowing its type.

ParamTypeDescription
umsgunwrapped_message_t const *An Unwrapped Message wrapper around the retrieved message.
authorauthor_t *Author instance
linkaddress_t const *Address of sequence message

Returns: Error code.

Receive a message by its msg number in an anchored single depth channel.

ParamTypeDescription
umsgunwrapped_message_t const *An Unwrapped Message wrapper around the retrieved message.
authorauthor_t *Author instance
anchor_linkaddress_t const *Address of anchor message
msg_numsize_tMessage number

Returns: Error code.

auth_sync_state(author): err_t

Synchronise a publishers state prior to sending another message, to ensure the user state matches all other publishers.

ParamTypeDescription
authorauthor_t *Author instance

Returns: Error code.

auth_fetch_next_msg(umsg, author): err_t

Fetch the next message sent by each publisher (empty array if none are present).

ParamTypeDescription
umsgunwrapped_message_t const *Placeholder for resulting UnwrappedMessage wrapper for the retrieved message. Null if there are no more messages to fetch
authorauthor_t *Author instance

Returns: Error code.

auth_fetch_next_msgs(umsgs, author): err_t

Fetch the next message sent by each publisher (empty array if none are present).

ParamTypeDescription
umsgsunwrapped_messages_t const *Placeholder for resulting UnwrappedMessages wrapper for retrieved publisher messages
authorauthor_t *Author instance

Returns: Error code.

auth_fetch_prev_msg(msg, author, address): err_t

Fetch the previous message sent before the defined message link.

ParamTypeDescription
msgunwrapped_message_t const *Placeholder for resulting UnwrappedMessage wrapper for retrieved message
authorauthor_t *Author instance
addressaddress_t const *Link of message to start retrieval from

Returns: Error code.

auth_fetch_prev_msgs(msgs, author, address, max): err_t

Fetch a defined number of previous messages in a channel.

ParamTypeDescription
msgsunwrapped_messages_t const *Placeholder for resulting UnwrappedMessages wrapper for retrieved messages
authorauthor_t *Author instance
addressaddress_t const *Link of message to start retrieval from
maxsize_tMaximum number of previous messages to retrieve

Returns: Error code.

auth_gen_next_msg_ids(ids, author): err_t

Fetch the next message sent by each publisher (empty array if none are present).

ParamTypeDescription
idsnext_msg_ids_t const *Placeholder for resulting NextMsgIds wrapper for expected publisher messages
authorauthor_t *Author instance

Returns: Error code.

auth_fetch_state(state, author): err_t

Fetch the current user state to see the latest links for each publisher

ParamTypeDescription
stateuser_state_t const *Placeholder for resulting User State wrapper around publisher states within the channel
authorauthor_t *Author instance

Returns: Error code.

auth_reset_state(author): err_t

Reset the mapping of known publisher states for the channel for retrieval of messages from scratch.

ParamTypeDescription
authorauthor_t *Author instance

Returns: Error code.

auth_store_psk(pskid, author, psk): err_t

Stores a given Pre Shared Key (Psk) into the Author instance, returning a Pre Shared Key Id (PskId)

ParamTypeDescription
pskidpskid_t *Placeholder for resulting PskId object representing the Psk in store
authorauthor_t *Author instance
pskchar const *Unique Pre Shared Key

Returns: Error code.

auth_remove_psk(author, pskid): err_t

Removes a Pre Shared Key (Psk) from the Author instance using a Pre Shared Key Id (PskId)

ParamTypeDescription
authorauthor_t *Author instance
pskidpskid_t *PskId object representing the Psk in store

Returns: Error code.

auth_store_new_subscriber(author, pk): err_t

Store the ed25519 Public Key identifier of a predefined subscriber into the Author instance

ParamTypeDescription
authorauthor_t *Author instance
pkpublic_key_t *Unique Public Key of Subscriber

Returns: Error code.

auth_remove_subscriber(author, pk): err_t

Removes a Subscriber from the Author instance using their ed25519 Public Key

ParamTypeDescription
authorauthor_t *Author instance
pkpublic_key_t *Public Key of Subscriber

Returns: Error code.

Subscriber

sub_new(sub, seed, transport): err_t

Generates a new Subscriber instance

ParamTypeDescription
subsubscriber_t *Placeholder for resulting Subscriber instance
seedchar const *Unique user seed
transporttransport_t *Transport Client Wrapper

Returns: Error code.

sub_drop(subscriber)

Drop a Subscriber instance from memory.

ParamTypeDescription
subscribersubscriber_t *Subscriber instance

sub_import(sub, buffer, password, transport): err_t

Import a Subscriber instance from an encrypted binary array

ParamTypeDescription
subsubscriber_t *Placeholder for resulting Subscriber instance
bufferbuffer_tBuffer with exported data
passwordchar const *Key to decrypt binary
transporttransport_t *Transport Client Wrapper

Returns: Error code.

sub_export(buf, subscriber, password): err_t

Export a Subscriber instance as an encrypted array using a given password

ParamTypeDescription
bufbuffer_t *Placeholder for resulting buffer stream of encrypted Subscriber instance
subscribersubscriber_t const *Subscriber instance
passwordchar const *Key to encrypt

Returns: Error code.

sub_channel_address(addr, subscriber): err_t

Return the channel address of the channel instance.

ParamTypeDescription
addrchannel_address_t const *Placeholder for resulting channel address object
subscribersubscriber_t const *Subscriber instance

Returns: Error code.

sub_announcement_link(addr, subscriber): err_t

Return the announcement link of the channel instance.

ParamTypeDescription
addraddress_t const *Placeholder for resulting announcement link object
subscribersubscriber_t const *Subscriber instance

Returns: Error code.

sub_is_multi_branching(flag, subscriber): err_t

Check if a channel type is single branching or multi branching.

ParamTypeDescription
flaguint8_t *Placeholder for resulting multi-branching flag: 0=single branch, 1=multi branch
subscribersubscriber_t const *Subscriber instance

Returns: Error code.

sub_get_public_key(pk, subscriber): err_t

Retrieve the Subscriber public key.

ParamTypeDescription
pkpublic_key_t const *Placeholder for resulting Author Public Key
subscribersubscriber_t const *Subscriber instance

Returns: Error code.

sub_author_public_key(pk, subscriber): err_t

Retrieve the Author public key. Errors if no channel is registered.

ParamTypeDescription
pkpublic_key_t const *Placeholder for resulting Author Public Key
subscribersubscriber_t const *Subscriber instance

Returns: Error code.

sub_is_registered(subscriber): uint8_t

Check if subscriber has processed an announcement message.

ParamTypeDescription
subscribersubscriber_t const *Subscriber instance

Returns: Uint8 representing if the Subscriber has processed an announcement: 0=false, 1=true.

sub_unregister(subscriber)

Unregister the subscriber from a channel.

ParamTypeDescription
subscribersubscriber_t *Subscriber instance

sub_receive_announcement(subscriber, address): err_t

Process an announcement message by its link.

ParamTypeDescription
subscribersubscriber_t *Subscriber instance
addressaddress_t const *Address of announcement message

Returns: Error code.

Send a subscription message, initialising connection to the channel. Should be attached to announcement link.

ParamTypeDescription
linkaddress_t const **The address of the subscription message.
subscribersubscriber_t *Subscriber instance
announcement_linkaddress_t const *Announcement link

Returns: Error code.

Send an unsubscription message, informing the Author that the subscription to the channel can be removed. Attached to subscription message.

ParamTypeDescription
linkaddress_t const **The address of the subscription message.
subscribersubscriber_t *Subscriber instance
subscription_linkaddress_t const *Subscription link

Returns: Error code.

Send a tagged packet message linked to a previous message.

ParamTypeDescription
linksmessage_links_t *Placeholder for resulting Message Links wrapper around the tagged packet link and sequence link.
subscribersubscriber_t *Subscriber instance
link_tomessage_links_tAddress of message being linked to
public_payload_ptruint8_t const *Byte array of public payload pointer
public_payload_sizesize_tLength of public payload byte array
masked_payload_ptruint8_t const *Byte array of masked payload pointer
masked_payload_sizesize_tLength of masked payload byte array

Returns: Error code.

Send a signed packet message linked to a previous message.

ParamTypeDescription
linksmessage_links_t *Placeholder for resulting Message Links wrapper around the signed packet link and sequence link.
subscribersubscriber_t *Subscriber instance
link_tomessage_links_tAddress of message being linked to
public_payload_ptruint8_t const *Byte array of public payload pointer
public_payload_sizesize_tLength of public payload byte array
masked_payload_ptruint8_t const *Byte array of masked payload pointer
masked_payload_sizesize_tLength of masked payload byte array

Returns: Error code.

sub_receive_keyload(subscriber, address): err_t

Receive a keyload packet by its link.

ParamTypeDescription
subscribersubscriber_t *Subscriber instance
addressaddress_t const *Address of keyload message

Returns: Error code.

Receive a keyload packet by a set of next msg ids.

ParamTypeDescription
linksmessage_links_t *Placeholder for resulting Message Links wrapper around the keyload message link and sequence link.
subscribersubscriber_t *Subscriber instance
next_msg_idsnext_msg_ids_t const *Address of keyload message

Returns: Error code.

sub_receive_tagged_packet(payloads, subscriber, address): err_t

Receive a tagged packet by its link.

ParamTypeDescription
payloadspacket_payloads_t *Placeholder for resulting Packet Payloads wrapper around the tagged packet message
subscribersubscriber_t *Subscriber instance
addressaddress_t const *Address of tagged packet message

Returns: Error code.

sub_receive_signed_packet(payloads, subscriber, address): err_t

Receive a signed packet by its link.

ParamTypeDescription
payloadspacket_payloads_t *Placeholder for resulting Packet Payloads wrapper around the signed packet message
subscribersubscriber_t *Subscriber instance
addressaddress_t const *Address of signed packet message

Returns: Error code.

sub_receive_sequence(address, subscriber, seq_address): err_t

Receive a sequence message by its link, and return the address of the sequenced message.

ParamTypeDescription
addressaddress_t const **The address link of the sequenced message.
subscribersubscriber_t *Subscriber instance
seq_addressaddress_t const *Address of sequence message

Returns: Error code.

sub_receive_msg(umsg, subscriber, address): err_t

Receive a message generically without knowing its type.

ParamTypeDescription
umsgunwrapped_message_t const *An Unwrapped Message wrapper around the retrieved message.
subscribersubscriber_t *Subscriber instance
addressaddress_t const *Address of the message

Returns: Error code.

Receive a message by its msg number in an anchored single depth channel.

ParamTypeDescription
umsgunwrapped_message_t const *An Unwrapped Message wrapper around the retrieved message.
subscribersubscriber_t *Subscriber instance
anchor_linkaddress_t const *Address of anchor message
msg_numsize_tMessage number

Returns: Error code.

sub_sync_state(subscriber): err_t

Synchronise a publishers state prior to sending another message to ensure the subscriber state matches all other publishers.

ParamTypeDescription
subscribersubscriber_t *Subscriber instance

Returns: Error code.

sub_fetch_next_msg(umsg, author): err_t

Fetch the next message sent by each publisher (null if there are no more messages to fetch).

ParamTypeDescription
umsgunwrapped_message_t const *Placeholder for resulting UnwrappedMessage wrapper for the retrieved message. Null if there are no more messages to fetch
subscribersubscriber_t *Subscriber instance

Returns: Error code.

sub_fetch_next_msgs(umsgs, subscriber): err_t

Fetch the next messages sent by other publishers (empty array if none are present).

ParamTypeDescription
umsgsunwrapped_messages_t const **An Array of UnwrappedMessage wrappers around the retrieved messages.
subscribersubscriber_t *Subscriber instance

Returns: Error code.

sub_fetch_prev_msg(msg, subscriber, address): err_t

Fetch the previous message sent before the defined message link.

ParamTypeDescription
msgunwrapped_message_t const *Placeholder for resulting UnwrappedMessage wrapper for retrieved message
subscribersubscriber_t *Subscriber instance
addressaddress_t const *Link of message to start retrieval from

Returns: Error code.

sub_fetch_prev_msgs(msgs, subscriber, address, max): err_t

Fetch a defined number of previous messages in a channel.

ParamTypeDescription
msgsunwrapped_messages_t const *Placeholder for resulting UnwrappedMessages wrapper for retrieved messages
subscribersubscriber_t *Subscriber instance
addressaddress_t const *Link of message to start retrieval from
maxsize_tMaximum number of previous messages to retrieve

Returns: Error code.

sub_gen_next_msg_ids(ids, subscriber): err_t

Fetch the next message sent by each publisher (empty array if none are present).

ParamTypeDescription
subscribersubscriber_t *Subscriber instance

Returns: Error code.

sub_fetch_state(state, subscriber): err_t

Fetch the current subscriber state to see the latest links for each publisher

ParamTypeDescription
stateuser_state_t const *Placeholder for resulting User State wrapper around publisher states within the channel
subscribersubscriber_t *Subscriber instance

Returns: Error code.

sub_reset_state(subscriber): err_t

Reset the mapping of known publisher states for the channel for retrieval of messages from scratch.

ParamTypeDescription
subscribersubscriber_t *Subscriber instance

Returns: Error code.

sub_store_psk(pskid, subscriber, psk): err_t

Stores a given Pre Shared Key (Psk) into the Subscriber instance, returning a Pre Shared Key Id (PskId)

ParamTypeDescription
pskidpskid_t *Placeholder for resulting PskId object representing the Psk in store
subscribersubscriber_t *Subscriber instance
pskchar const *Unique Pre Shared Key

Returns: Error code.

sub_remove_psk(subscriber, pskid): err_t

Removes a Pre Shared Key (Psk) from the Subscriber instance using a Pre Shared Key Id (PskId)

ParamTypeDescription
subscribersubscriber_t *Subscriber instance
pskidpskid_t *PskId object representing the Psk in store

Returns: Error code.

Types

Err

Error code

ValueDescription
ERR_OKSuccess, no errors
ERR_NULL_ARGUMENTNull-pointer argument
ERR_BAD_ARGUMENTAn invalid argument was given as input
ERR_OPERATION_FAILEDTransport, wrap/unwrap operation failed

TransportDetails

TransportWrap

transport_new(): transport_t *

Generate a default transport client object (best for testing purposes)

ParamTypeDescription

Returns: A generic transport client wrap

transport_drop(tsp)

Drop transport client from memory

ParamTypeDescription
tsptransport_t *Transport Client

transport_client_new_from_url(url): transport_t *

Generate a transport client object with a given node url

ParamTypeDescription
urlchar const *Node Url

Returns: A transport client wrapper to communicate with a node

Retrieved message details for a given message link

ParamTypeDescription
detailstransport_details_t *Placeholder for resulting message details
transporttransport_t *Transport Client
linkaddress_t const *Address link of message

Returns: Error code

Address

address_from_string(addr_str): address_t *

Create an address object form a string

ParamTypeDescription
addr_strchar const *A string representation of link

Returns: An Address link

get_address_inst_str(address): char const *

Get the string representation of the Address Application Instance

ParamTypeDescription
addressaddress_t const *Address link of message

Returns: A string representation of the Address Application Instance

get_address_id_str(address): char const *

Get the string representation of the Address Message Identifier

ParamTypeDescription
addressaddress_t const *Address link of message

Returns: A string representation of the Address Message Identifier

get_address_index_str(address): char const *

Get the string representation of the streams message Tangle Index

ParamTypeDescription
addressaddress_t const *Address link of message

Returns: A string representation of the message Tangle Index

drop_address(address)

Drop an Address wrapper from memory

ParamTypeDescription
addressaddress_t const *Address link of message

ChannelAddress

get_channel_address_str(appinst): char const *

Get the string representation of the Channel Address

ParamTypeDescription
appinstchannel_address_t const *Channel Application Instance

Returns: A string representation of the Channel Address

Wrapper for Message containing the message link, and the sequence link (if you are using multi branching) | Param | Type | Description | | --------------- | ----------------------------- | ----------------------------------- | | msg_link | address_t const * | Message link address | | seq_link | address_t const * | Sequence link address |

Drop a MessageLinks wrapper from memory

ParamTypeDescription
msg_linksmessage_links_tMessage Links Wrapper

UnwrappedMessage

A wrapper around a retrieved message

get_payload(message): packet_payloads_t

Fetch the payload from an Unwrapped Message wrapper

ParamTypeDescription
messageunwrapped_message_t const *Unwrapped Message Wrapper

Returns: The PacketPayloads wrapper of the message

drop_unwrapped_message(message)

Drop an Unwrapped Message wrapper from memory

ParamTypeDescription
messageunwrapped_message_t const *Unwrapped Message Wrapper

UnwrappedMessages

An array of UnwrappedMessage's

get_indexed_payload(messages, index): packet_payloads_t

Fetch the payload of the provided index of the Unwrapped Messages wrapper.

ParamTypeDescription
messagesunwrapped_messages_t const *Unwrapped Message Wrapper
indexsize_tIndex of message in array

Returns: The PacketPayloads wrapper of the indexed message

drop_unwrapped_messages(messages)

Drop an Unwrapped Messages wrapper from memory

ParamTypeDescription
messagesunwrapped_messages_t const *Unwrapped Messages Wrapper

PacketPayloads

Contains a public_payload byte array and a masked_payload byte array for a streams message

drop_payloads(payloads)

Drop a PacketPayloads wrapper from memory

ParamTypeDescription
payloadspacket_payloads_tPacket Payloads Wrapper

PublicKey

An Ed25519 Public Key

public_key_to_string(pubkey): char const *

Get a hex string representation of an Ed25519 Public Key

ParamTypeDescription
pubkeypublic_key_t *Ed25519 Public Key

Returns: Hex string representation of an Ed25519 Public Key

NextMsgIds

A wrapper for a list mapping Public Key strings, and a state cursors for expected next message ids.

drop_next_msg_ids(m)

Drop a NextMsgIds wrapper from memory

ParamTypeDescription
statenext_msg_ids_t const *A NextMsgId wrapper

UserState

A wrapper for a list mapping Public Key strings and a state cursor.

Get the latest link of a specific user by their Ed25519 Public Key

ParamTypeDescription
stateuser_state_t const *User State Wrapper
pubkeypublic_key_t const *Ed25519 Public Key

Returns: Latest address link of the provided user key

drop_user_state(state)

Drop a User State wrapper from memory

ParamTypeDescription
stateuser_state_t const *A User State wrapper

strings

drop_str(string)

Drop a rust allocated string from memory

ParamTypeDescription
stringchar const *A string object

PublicKeys

An array of PublicKey's

Psk

A 32 Byte Pre Shared Key

PskId

Array of 16 bytes representing the identifier of a 32 byte Psk

pskid_as_str(pskid)

Drop a rust allocated string from memory

ParamTypeDescription
pskidpskid_t const *A Pre Shared Key Identifier

Returns: String representation of the PskId object

PskIds

An array of PskId's