Skip to main content
Module

x/earthstar_replica_server/deps.ts

An always-online Earthstar peer for your shares.
Latest
import * as earthstarReplicaServer from "https://deno.land/x/earthstar_replica_server@4.0.0-beta.1/deps.ts";

Classes

An attachment driver which persists attachments using the local filesystem. Works with Deno and Node.

An attachment driver which persists attachments in memory. Works everywhere.

A pub won't accept writes

A replica driver which perists to LocalStorage, which stores a maximum of five megabytes per domain. If you're storing multiple shares, this limit will be divided among all their replicas. Works in browsers and Deno.

An in-memory replica driver. Its contents will be lost when it is closed. Works everywhere.

A strorage driver which persists to SQLite. Works in Deno and browsers.

Generic top-level error class that other Earthstar errors inherit from.

A replica holding a share's documents and attachments, used to read, write, and synchronise data to. Should be closed using the close method when no longer being used.

A pub URL is bad or the network is down

Validation failed on a document, share address, author address, etc.

A syncing partner to be used with local instances of IPeer. Works everywhere.

A syncing partner created from an inbound HTTP connection (i.e. a web client).

A syncing partner to be used with replica servers reachable via the internet. Works everywhere.

Holds many shares' replicas and manages their synchronisation with other peers. Recommended as the point of contact between your application and Earthstar shares.

A replica holding a share's documents and attachments, used to read, write, and synchronise data to. Should be closed using the close method when no longer being used.

A cached, synchronous interface to a replica, useful for reactive abstractions. Always returns results from its cache, and proxies the query to the backing replica in case of a cache miss.

An IReplica or IReplicaDriver was used after close() was called on it.

An IReplica or IReplicaDriver was used after close() was called on it.

Syncs the contents of a Peer's replicas with that of another peer's.

Validation failed on a document, share address, author address, etc.

Variables

Lowercase alphabetical characters.

Uppercase alphabetical characters.

All characters allowed in an identity's public address.

All characters allowed in an identity's pub key.

All characters allowed in an identity's short name.

All characters allowed in base32.

Higher-level crypto functions. Not used directly for the most part, but useful for generating new keypairs.

A verison of the ICryptoDriver interface backed by noble/ed25519. The slowest crypto driver available. Works in the browser, Deno, and Node.

A verison of the ICryptoDriver interface backed a WASM wrapper of libsodium. Faster than noble by several magnitudes. Works in deno and the browser.

All digits.

Validator for the 'es.4' format. Checks if documents are spec-compliant before ingesting, and signs them according to spec.

Format for 'es.5' documents. Supports attachments.

All characters permitted in a document's path.

All special characters permitted in a document's path.

All characters allowed in a share's address.

All charaters allowed in a share's key.

All characters allowed in a share's name.

Functions

Put a short name and pub key together into an identity address.

Put a share name and encoded pub key together into a share address.

Encode uint8array bytes to base32 string

Decode base32 string to a uint8array of bytes. Throw a ValidationError if the string is bad.

Check that an identity address is valid.

Check that a share address is valid.

example usage: myArrayOfArrays.sort(arrayCompare)

Convert a keypair (author / share) back into a raw KeypairBytes for use in crypto operations.

Return whether a document is expired or not

Combine a shortname with a raw KeypairBytes to make an AuthorKeypair

Combine a name with a raw KeypairBytes to make an ShareKeypair

Returns a valid share address generated using a given name.

Given an array of format names, and an array of IFormat, returns an array of IFormat restricted to those with matching names.

Returns an object with format names as keys, and corresponding IFormat as values.

Returns the default formats if no formats are given.

Returns the default format if no formats are given.

Check if any value is a subclass of EarthstarError (return true) or not (return false)

Check that a string contains only printable ASCII

Check if any value is a subclass of EarthstarError (return false) or not (return true)

Check that a string only contains character from a string of allowed characters.

Parse an author address into its parts.

Parse a share or author address into its parts

Parse a workspace address into its parts.

Set the crypto driver used for all cryptographic operations.

Returns a promise which is fulfilled after a given number of milliseconds.

Syncs an earthstar replica with a directory on the filesystem, representing Earthstar documents as files and vice versa. Make sure you understand the changes this function could enact upon a given directory before using it, as it can delete files in certain circumstances.

  • Changes from the filesystem which are superseded by writes from the replica will still be synced to the replica as an older version of the document, provided they were authored by different identities.
  • If a document has a certain extension (e.g. .jpg, .mp3), the syncer assumes the contents are base64 encoded when writing data to the filesystem.
  • If a file has a path containing a ! (i.e. an ephemeral path), it will be deleted unless a correspending document is found in the replica.

Interfaces

A keypair used by individual entities to sign documents.

The core properties all documents must implement, regardless of format.

Contains data written and signed by an identity.

Contains data written and signed by an identity.

A partial es.4 doc that is about to get written. The rest of the properties will be computed automatically.

A partial es.5 doc that is about to get written. The rest of the properties will be computed automatically.

Higher-level crypto functions. Not used directly for the most part, but useful for generating new keypairs.

A crypto driver provides low-level access to an implementation providing ed25519 cryptography, e.g. Chloride, noble/ed25519, Node crypto.

Formats are each responsible for one document format such as "es.4". They are used for signing and validating documents, as well as generating new documents from a given input.

Holds many shares' replicas and manages their synchronisation with other peers. Recommended as the point of contact between your application and Earthstar shares.

An attachment driver provides low-level access to a replica's attachments. ReplicaAttachmentDrivers are not meant to be used directly by users; let the Replica talk to it for you.

A document driver provides low-level access to a replica's documents. ReplicaDocDrivers are not meant to be used directly by users; let the Replica talk to it for you.

A replica driver provides low-level access to a replica's documents and attachments. ReplicaDrivers are not meant to be used directly by users; let the Replica talk to it for you.

Provides a syncer with the means to connect the peer being synced with (the partner).

Options for configuring a new replica.

  • validators: Validators for the kinds of documents this replica will replicate, e.g. FormatValidatorEs4.
  • driver: A driver the replica will use to read and persist documents.

Describes a query for fetching documents from a replica.

Filters a query by document attributes.

Options to initialise a Syncer with.

  • peer - The peer to synchronise.
  • partner - Determines who you'll be syncing with (e.g. a remote peer on a server, a local peer)
  • mode - Determines what kind of sync to carry out.
  • formats - An optional array of formats to sync. Defaults to just es.5.

Type Aliases

An identity's public address.

The human-identifiable portion of an identity's public address, e.g. suzy.

An attachment associated with a document.

A short string with a timestamp and hash of the document's path and author.

A document with it's attachment merged onto a new attachment property.

Verifies a given type is of type IFormat

Extracts a IFormat's config type

Extracts a IFormat's document type, e.g. DocEs5

Extracts a IFormat's input type, used to generate a new document.

Extracts a IFormat's name, e.g. es.5

Verifies a given type is an array of IFormat

  • IngestEventSuccess — a new doc was written
  • IngestEventFailure — refused an invalid doc
  • IngestEventNothingHappened — ingested an obsolete or duplicate doc

The path of a document, e.g. /images/teapot.png.

An event representing when a QuerySource has processed all existing documents.

  • ExpireEvent - An ephemeral document has expired
  • IngestEvent — the result of a replica ingesting a document
  • DocAlreadyExists — processing an old doc as you catch up

A mode representing what kind of docs are desired from a query stream.

  • existing - Only pre-existing documents.
  • new - Only documents written after the stream is initiated
  • everything - Both pre-existing and incoming documents.
  • DocAlreadyExists — processing an old doc as you catch up
  • IngestEvent — the result of a replica ingesting a document
  • ExpireEvent - An ephemeral document has expired
  • AttachmentIngestEvent - A new attachment has been ingested
  • AttachmentPruneEvent - An attachment without a corresponding document has been pruned.
  • ReplicaEventWillClose — the replica is about to close
  • ReplicaEventDidClose — the replica has closed

A share's public address.

A keypair used to write to a specific share

The human-identifiable portion of a share's address, e.g. gardening.

An event with an Earthstar document and corresponding ID.

A type of message one SyncAgent can send to another.

An event sent when a SyncAgent doesn't want anything anymore, though it'll still serve HAVE requests.

Options used for initialisng a SyncAgent.

  • replica: The replica to represent.
  • mode: Whether to sync only existing docs or keep the connection open for new docs too.

A special event for the implementation of a PlumTree. Asks the recipient to begin lazily messaging us.

An event to be passed on to a RangeMessenger

The current status of a SyncAgent.

Signals that a SyncAgent wants a document/documents from another SyncAgent

A mode which determines when the syncer will stop syncing.

  • once - The syncer will only attempt to sync existing docs and then stop.
  • live - Indefinite syncing, including existing docs and new ones as they are ingested into the replica.

An event for disclosing which shares a Peer has without actually revealing them. Another peer can use the salt to hash their own shares' addresses and see if they match.

An event a Syncer can send or receive.

A map of sync statuses by the share address they're associated with.

A SyncAgentEvent addressed to a specific share address.

A UNIX timestamp in microseconds.