Skip to main content
Module

x/earthstar/mod.browser.ts>ClientSettings

Earthstar is a tool for private, undiscoverable, offline-first networks.
Go to Latest
class ClientSettings
import { ClientSettings } from "https://deno.land/x/earthstar@v10.0.0-beta.8/mod.browser.ts";

Constructors

new
ClientSettings(opts?: ClientSettingsOpts)

Properties

private
authorChangedCbs: Set<(keypair: AuthorKeypair | null) => void>
private
namespace: string | undefined
private
serversChangedCbs: Set<(shares: string[]) => void>
private
sharesChangedCbs: Set<(shares: ShareAddress[]) => void>
private
shareSecretsChangedCbs: Set<(secrets: Record<ShareAddress, string>) => void>
private
storage
author: AuthorKeypair | null
readonly
servers: string[]
readonly
shares: ShareAddress[]
readonly
shareSecrets

Methods

addSecret(shareAddress: ShareAddress, secret: string)
addServer(address: string): string[] | ValidationError
getPeer(unnamed 0: { sync: "once" | "continuous" | false; onCreateReplica: (addr: ShareAddress, secret?: string) => Replica; }): { peer: Peer; unsubscribeFromSettings: () => void; }

Get a new Peer preconfigured with shares, secrets, and syncers derived from these settings.

When settings are updated, the peer's replicas and syncers will be updated too.

onAuthorChanged(cb: (keypair: AuthorKeypair | null) => void)
onServersChanged(cb: (shares: string[]) => void)
onSharesChanged(cb: (shares: ShareAddress[]) => void)
onShareSecretsChanged(cb: (secrets: Record<ShareAddress, string>) => void)
removeSecret(shareAddress: ShareAddress)
removeServer(addressToRemove: string)
removeShare(addressToRemove: string)