the_Foundation  1.0
Functions
wisp.h File Reference
#include "block.h"

Functions

void setUrl_Wisp (const char *url)
 
void setCredentials_Wisp (const char *user, const char *password, const iBlock *privateKey)
 
iBlock * newPrivateKey_Wisp (void)
 
iBlock * newPublicKey_Wisp (const iBlock *privateKey)
 

Detailed Description

Wisp relay configuration (WebAssembly).

In web builds, browsers do not allow opening TCP connections. All Socket connections are made through a relay server using the Wisp protocol (version 2) over a WebSocket.

Authors
Copyright (c) 2026 Jaakko Keränen jaakk.nosp@m.o.ke.nosp@m.ranen.nosp@m.@iki.nosp@m..fi
License

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ newPrivateKey_Wisp()

iBlock* newPrivateKey_Wisp ( void  )

Generates a new Ed25519 private key for relay authentication.

Returns
Raw 32-byte private key. Caller gets ownership.

◆ newPublicKey_Wisp()

iBlock* newPublicKey_Wisp ( const iBlock *  privateKey)

Returns the raw 32-byte Ed25519 public key of a private key. The relay identifies clients by the public key. Caller gets ownership. Returns NULL if the key is invalid.

◆ setCredentials_Wisp()

void setCredentials_Wisp ( const char *  user,
const char *  password,
const iBlock *  privateKey 
)

Sets the credentials used when the relay requires authentication. The key and the password are both offered if the relay allows them. An open relay connection is closed if the credentials change.

This function is thread-safe.

Parameters
userUsername (may be NULL).
passwordPassword (may be NULL).
privateKeyRaw 32-byte Ed25519 private key (may be NULL).

◆ setUrl_Wisp()

void setUrl_Wisp ( const char *  url)

Sets the WebSocket URL of the Wisp relay, e.g., "wss://example.com/wisp/". The default is "/wisp/" on the host that served the page. An open relay connection is closed if the URL changes.

This function is thread-safe.