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

    Class Key

    A key of a XID document: public keys, optionally private keys (in the clear or password-locked), a nickname, endpoints and permissions.

    Implements

    Index
    • get publicKeys(): PublicKeys

      The public keys.

      Returns PublicKeys

    • get privateKeys(): PrivateKeys | undefined

      The private keys when held in the clear.

      Returns PrivateKeys | undefined

    • get hasPrivateKeys(): boolean

      Whether the private keys are held in the clear.

      Returns boolean

    • get hasEncryptedPrivateKeys(): boolean

      Whether the private keys are held locked (parsed without the password).

      Returns boolean

    • get privateKeySalt(): Salt | undefined

      The salt the 'privateKey' assertion carries.

      Returns Salt | undefined

    • get reference(): Reference

      The reference of the public keys.

      Returns Reference

    • get signingPublicKey(): SigningPublicKey

      The signing public key.

      Returns SigningPublicKey

    • get endpoints(): ReadonlySet<URI>

      The endpoints (a copy).

      Returns ReadonlySet<URI>

    • get nickname(): string

      The nickname; empty when there is none.

      Returns string

    • A key from its public keys; no permissions unless private keys or permissions are given. A null privateKeys is a TypeError: absent private keys are undefined.

      Parameters

      • publicKeys: PublicKeys
      • __namedParameters: KeyInput = {}

      Returns Key

    • A public key allowed All.

      Parameters

      • publicKeys: PublicKeys

      Returns Key

    • The Schnorr and X25519 keys of a base, private keys included, allowed All.

      Parameters

      • privateKeyBase: PrivateKeyBase

      Returns Key

    • The encapsulation public key.

      Returns EncapsulationPublicKey

    • Whether signature is the public keys' signature of message.

      Parameters

      • signature: Signature
      • message: Uint8Array

      Returns boolean

    • Adds an endpoint, as a URI or its text (a components error for text that is not a URI).

      Parameters

      • endpoint: string | URI

      Returns void

    • Removes an endpoint; whether it was there.

      Parameters

      • endpoint: string | URI

      Returns boolean

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

      Parameters

      • name: string

      Returns void

    • Sets the nickname once: Duplicate when set, EmptyValue when empty.

      Parameters

      • name: string

      Returns void

    • addAllow under the reference's Key::add_permission name.

      Parameters

      Returns void

    • The public keys as the subject, the private keys per privateKeys (a locked key stays locked), then 'nickname', 'endpoint's and the permissions. An unknown option is a TypeError.

      Parameters

      Returns Envelope

    • A key from its envelope. A locked 'privateKey' is unlocked with the password when one is given and it fits; otherwise it is kept locked. Every failure is an XIDError: a subject or leaf of the wrong type is Cbor; a missing or repeated 'salt', a second 'nickname' or one that is not text are EnvelopeParsing; a permission that is not a known value is EnvelopeParsing, one that names no privilege is UnknownPrivilege.

      Parameters

      Returns Key

    • The private keys as an envelope: in the clear when held so, unlocked with the password when locked (an InvalidPassword error when it does not fit), or the locked envelope itself without a password.

      Parameters

      Returns Envelope | undefined

    • Same public keys, private material (in the clear or locked, with its salt), nickname, endpoints and permissions — as the reference's equality; a key parsed from an envelope that omitted its private keys is not equal to the original.

      Parameters

      Returns boolean

    • A copy: the private material shared, the endpoints and permissions copied.

      Returns Key