@blockchaincommons/xid - v1.0.0-beta.3
    Preparing search index...

    Class Service

    A service of a XID document: a URI, key and delegate references, a capability, a name and permissions. On the wire only 'allow' permissions round-trip: the parser rejects 'deny' as the reference's does.

    Implements

    Index
    • get capability(): string

      The capability; empty when there is none.

      Returns string

    • get keyReferences(): ReadonlySet<Reference>

      The key references (a copy).

      Returns ReadonlySet<Reference>

    • get delegateReferences(): ReadonlySet<Reference>

      The delegate references (a copy).

      Returns ReadonlySet<Reference>

    • get name(): string

      The name; empty when there is none.

      Returns string

    • A service at a URI (a components error for text that is not a URI); references and permissions can be added later.

      Parameters

      Returns Service

    • Sets (or clears, with "") the capability.

      Parameters

      • capability: string

      Returns void

    • Sets the capability once; Duplicate when set, EmptyValue when empty.

      Parameters

      • capability: string

      Returns void

    • Whether the service references this key.

      Parameters

      • reference: Reference

      Returns boolean

    • Adds a key reference; Duplicate when it is already there.

      Parameters

      • keyReference: Reference

      Returns void

    • Removes a key reference; whether it was there.

      Parameters

      • reference: Reference

      Returns boolean

    • References the key's public keys.

      Parameters

      • key: { publicKeys: PublicKeys }

      Returns void

    • Whether the service references this delegate.

      Parameters

      • reference: Reference

      Returns boolean

    • Adds a delegate reference; Duplicate when it is already there.

      Parameters

      • delegateReference: Reference

      Returns void

    • Removes a delegate reference; whether it was there.

      Parameters

      • reference: Reference

      Returns boolean

    • References the delegate's (or document's) XID.

      Parameters

      • delegate: { xid: XID }

      Returns void

    • Sets the name once; Duplicate when set, EmptyValue when empty.

      Parameters

      • name: string

      Returns void

    • The URI as the subject; 'key', 'delegate', 'capability', 'name' and the permissions.

      Returns Envelope

    • A service from its envelope. Rejects nested assertions (UnexpectedNestedAssertions) and any predicate but 'key', 'delegate', 'capability', 'name' and 'allow' (UnexpectedPredicate; a predicate that is not a known value is EnvelopeParsing); a subject or object of the wrong type is Cbor.

      Parameters

      • envelope: Envelope

      Returns Service

    • Same URI, references, permissions, capability and name — as the reference's equality.

      Parameters

      Returns boolean