Skip to main content
Module

x/earthstar_replica_server/deps.ts>Earthstar.ClientSettings

An always-online Earthstar peer for your shares.
Latest
class Earthstar.ClientSettings
import { Earthstar } from "https://deno.land/x/earthstar_replica_server@4.0.0-beta.1/deps.ts";
const { ClientSettings } = Earthstar;

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)