Skip to main content

Module portable

Module portable 

Source
Expand description

Portable objects (FEP-ef61): verifying them, and signing them.

A portable object is authentic when an FEP-8b32 integrity proof on it was made with a key under the DID of its id, and by nothing else: not where it was fetched from, and not the HTTP signature it arrived under. docs/guide/portable.md explains it.

did:key is resolved here, since the DID is the key. Any other method needs a DidResolver from the application.

Structs§

ApUri
A portable object’s identifier.
Ed25519Signer
An Ed25519 key held in memory, signing as its did:key.
Hashlink
A SHA-256 digest as a hashlink names it and digestMultibase writes it: a multihash, in base58btc.
Media
A resource a portable object refers to, as a gateway serves it.

Enums§

PortableError
Why a portable document is not authentic.

Constants§

GATEWAY_PATH
The well-known path a gateway serves portable objects under.
MAX_GATEWAYS
The most gateways asked for one object, or tried for one delivery. The hints in an ap URI are its writer’s to choose, and so are an actor’s gateways: unbounded, one reference could send a server to any number of hosts of someone else’s choosing.

Traits§

DidResolver
Resolves the DID URLs of methods other than did:key to keys.
ProofSigner
Where a proof comes from: a key the server holds, or one it reaches through a signing service or the user’s device. What is signed is a whole document, and what comes back is that document with its proof.

Functions§

did_of
The DID a DID URL is under: did:method:id, without path, query or fragment. None when it is not a DID URL.
gateways
The gateways an actor document lists, in order, as origins: without the / of an empty path, which some gateways refuse. What is not a gateway is left out; verify refuses an actor that lists one.
is_gateway
Whether gateway is what FEP-ef61 allows as one: an http or https URI with a host and no path, query or fragment, https://server.example, or with the one / of an empty path.
is_portable
Whether iri, in any spelling, identifies a portable object.
resolve
The key did_url names: a did:key’s own, or what resolver says.
same_object
Whether two identifiers name the same portable object, however each is spelled.
verify
Verify a portable document: its id is an ap URI, a proof by the id’s DID verifies, and an actor lists at least one gateway and nothing else. Returns the id.
verify_by
Verify that document carries a proof made with a key under did: any of its proofs, tried in order.

Type Aliases§

Error
An error from the application’s resolver or signer.