protocol0 0.1 e6aeb8 GitHub Get started
DocumentationThe code reference

Documentation  /  Reference  /  The code reference

The code reference

This page lists every name that protocol0 exports with 1 line on what it does and apps and tests use only these names.

Functions, classes and constants

These names exist when the program runs and an app can call or read them.

  • ready

    It loads the sealing library and an app calls it once before any other function.

  • newKeyPair

    It makes a new key pair for 1 computer or 1 app.

  • keyPairFromSeed

    It makes the same key pair again from a 32 byte seed that is written in hex.

  • randomKey

    It makes a random secret key for sealing and writes it in hex.

  • publicOf

    It returns the public half of a key pair and that half is safe to hand to others.

  • shortCode

    It turns a key or an entry code into 6 characters that a person can read.

  • canonical

    It writes a value as JSON with sorted keys and equal values give equal bytes.

  • EntryStore

    It holds the entries of 1 copy and keeps them in the fixed order of the record.

  • entryCode

    It returns the code of an entry and that code is the hash of the whole entry.

  • signEntry

    It signs an unsigned entry with a secret signing key and returns the signed entry.

  • checkEntryShape

    It checks the shape and the signature of an entry and returns the reason when the check fails.

  • Copy

    A copy holds the record of 1 community on 1 computer and offers every call that writes or reads it.

  • ProtocolError

    A protocol error is what protocol0 throws when a call would break a rule.

  • TestClock

    A test clock is a clock that a test moves by hand so no test waits for real days.

  • systemClock

    It returns a clock that follows the time of the computer.

  • DAY

    It is the number of milliseconds in 1 day.

  • MemoryKeyStore

    It keeps keys in memory and they are gone when the program ends.

  • FileKeyStore

    It keeps keys in 1 plain JSON file and belongs in tests and made-up members only.

  • MemoryHub

    It is a relay that lives inside 1 process and tests use it.

  • HttpRelay

    It reaches a relay program over HTTP such as the one in the relay folder.

  • FolderStore

    It passes entries through 1 shared folder that all protocol0 apps of a user read.

  • sync

    It sends the new entries of a copy to every transport, takes theirs and skips a silent transport.

  • syncDirect

    It passes entries both ways between copies in 1 process until they hold the same entries.

  • needed

    It returns how many signatures a body of a given size needs under a threshold.

  • isAllowedThreshold

    It tells whether a threshold is more than half for every size of body.

  • MORE_THAN_HALF

    This threshold needs more than half of the members and is the default of a new community.

  • TWO_OF_THREE

    This threshold needs at least 2 of every 3 members.

  • EVERYONE

    This threshold needs every member of the body to sign.

  • PROTOCOL

    It holds the version of protocol0 and its code and the first entry of a record names both.

  • RULE_NAMES

    It lists the 18 rules of protocol0 in order, and the code of the version is made from this list.

  • memberId

    It turns the first signing key of a member into the id of that member.

Types

These names exist only for TypeScript and are gone when the program runs.

  • KeyPair

    A key pair holds the signing key and the box key of 1 computer or app with their secret halves.

  • PublicKey

    A public key holds the 2 public halves that name the key of a member to others.

  • Entry

    An entry is 1 signed step of the record that names the entries it builds on.

  • UnsignedEntry

    An unsigned entry is an entry before its signature is added.

  • Share

    A share is a sealed key for 1 recipient that travels next to an entry.

  • AddResult

    An add result tells whether a store took an entry and gives the reason when it did not.

  • WireItem

    A wire item is an entry with its code and its deletable words as copies pass it on.

  • Clock

    A clock is any object with a now function that returns the time in milliseconds.

  • Threshold

    A threshold states how many members of a body must sign as a fraction of the body.

  • ProtocolVersion

    A protocol version holds the version of protocol0 and its code of 6 characters.

  • Settings

    Settings hold the numbers and choices of a constitution such as the relays and the life of a proposal.

  • Person

    A person holds a name and no entry of the record holds an email.

  • Founder

    A founder is a person with a public key who is a member from the first entry on.

  • BodyRef

    A body reference names where a decision is taken and that is the group, a team or the community.

  • TeamPower

    A team power is 1 of the 3 powers that a team can hold and these are keep-pages, hide-post and pause-member.

  • TeamSeed

    A team seed describes a team with its members, its pages and its powers when a decision makes it.

  • Change

    A change names what a proposal changes such as a page, the member list or the constitution.

  • ProposalStatus

    A proposal status is open, decided, closed, stopped, undone, out-of-date or replaced.

  • MemberView

    A member view shows 1 member as a copy reads it with the keys, the status and the group.

  • GuestView

    A guest view shows 1 guest with the member who invited the guest and whether a member let the guest in.

  • TeamView

    A team view shows 1 team together with the decision that made it and the version of its member list.

  • PageVersion

    A page version holds the content of 1 version of a page and the decision that made it.

  • PageView

    A page view shows a page with its keeper, its versions and its current content.

  • SubchatView

    A sub chat view shows 1 sub chat, its parent and whether guests can read it.

  • PostView

    A post view shows 1 post with its writer, its words and whether it is hidden.

  • ProposalView

    A proposal view shows 1 proposal with its signatures, its number and its status.

  • Proof

    A proof lists the entries that show that a member signed 2 versions of the same proposal.

  • Refusal

    A refusal names an entry that a copy refused and gives the reason.

  • EntryView

    An entry view describes 1 entry in plain words and says whether the copy accepted it.

  • PauseView

    A pause view shows a member whose posting is paused with the end date and the decision.

  • GroupInfo

    A group info holds the id, the name and the members of 1 group of a community.

  • GroupView

    A group view holds everything a copy shows about a group such as members, pages, teams, posts and proposals.

  • ReceiveReport

    A receive report lists the entries that a copy added, the ones it refused and the ones that wait.

  • Transport

    A transport is anything that passes entries between copies with a push and a pull call.

  • SyncReport

    A sync report lists the transports that answered, the ones that stayed silent and the entries received.

  • StartOptions

    Start options hold everything that Copy.start takes such as the key, the founders and the pages.

  • LoadOptions

    Load options hold the key and the entries that Copy.load takes.

  • ForceOptions

    Force options let a test write an entry that breaks a rule on purpose.

  • KeyStore

    A key store is anything that can get, put and list keys by name.

Something wrong on this page