webtessera/note

Signed notes, signers and verifiers.

It ports the Go package golang.org/x/mod/sumdb/note. Its source is src/vendor/note/note.ts.

Functions

checkEd25519PublicKey
checkEd25519PublicKey throws errVerifierSmallOrderKey or errVerifierNonCanonicalKey if the 32-byte Ed25519 public key pub is a small-order point or a non-canonical encoding of a point.
generateKey
generateKey generates a signer and verifier key pair for a named server.
newEd25519VerifierKey
newEd25519VerifierKey returns an encoded verifier key using the given name and Ed25519 public key.
newSigner
newSigner constructs a new Signer from an encoded signer key.
newVerifier
newVerifier construct a new Verifier from an encoded verifier key.
open
open opens and parses the message msg, checking signatures from the known verifiers.
sign
sign signs the note with the given signers and returns the encoded message.
signAsync
signAsync is sign for signers that may be asynchronous: it signs the note with the given signers, each an AsyncSigner or a Signer, and resolves to the encoded message.
verifierList
verifierList returns a Verifiers implementation that uses the given list of verifiers.
verifyEd25519
verifyEd25519 reports whether sig is a valid signature of msg by the Ed25519 public key pubkey, accepting exactly the signatures Go's crypto/ed25519.Verify accepts — the function sumdb/note and formats/note verify with.

Classes

ambiguousVerifierError
An ambiguousVerifierError indicates that the given name and hash match multiple keys passed to verifierList.
InvalidSignatureError
An InvalidSignatureError indicates that the given key was known and the associated Verifier rejected the signature.
UnknownVerifierError
An UnknownVerifierError indicates that the given key is not known.
UnverifiedNoteError
An UnverifiedNoteError indicates that the note successfully parsed but had no verifiable signatures.

Interfaces

AsyncSigner
An AsyncSigner signs messages using a specific key, like a Signer, but its sign method resolves asynchronously.
Note
A Note is a text and signatures.
Signature
A Signature is a single signature found in a note.
Signer
A Signer signs messages using a specific key.
Verifier
A Verifier verifies messages signed with a specific key.
Verifiers
A Verifiers is a collection of known verifier keys.

Constants and variables

errInvalidSigner
errInvalidSigner reports a Signer whose name is not a valid server name.
errMalformedNote
errMalformedNote reports a note that does not parse as a signed note.
errMismatchedVerifier
errMismatchedVerifier reports a Verifiers that answered with the wrong verifier.
errSignerAlg
errSignerAlg reports a signer key naming an algorithm this package cannot use.
errSignerHash
errSignerHash reports a signer key whose stated hash is not the public key's hash.
errSignerID
errSignerID reports a signer key that is not well-formed.
errVerifierAlg
errVerifierAlg reports a verifier key naming an algorithm this package cannot use.
errVerifierHash
errVerifierHash reports a verifier key whose stated hash is not the key's hash.
errVerifierID
errVerifierID reports a verifier key that is not well-formed.
errVerifierNonCanonicalKey
errVerifierNonCanonicalKey reports an Ed25519 verifier key whose public key is not the canonical encoding of its point, so that the same point would have several key encodings, key hashes and key IDs.
errVerifierSmallOrderKey
errVerifierSmallOrderKey reports an Ed25519 verifier key whose public key is a point of small order.