@blockchaincommons/components - v1.0.0-beta.4
    Preparing search index...

    Class MemorySshAgent

    An SshAgent whose identities are private keys held in memory, the analogue of the reference's test MockSSHAgent.

    Identities are keyed by comment: adding a key whose comment is already present replaces that identity in place. listIdentities returns the public keys in insertion order, so with an empty id a lock or unlock uses the first key added.

    sign signs data the way the reference's mock does: an sshsig signature in the namespace test_namespace over the SHA-256 digest of data, of which the inner raw signature bytes are returned. A real agent signs data itself, so a key locked with this agent cannot be unlocked with a real agent holding the same key, and vice versa.

    Implements

    Index
    • An agent holding identities (none by default). With refuseToSign every sign call fails, the way an agent that declines a request does.

      Parameters

      • __namedParameters: { identities?: Iterable<SSHPrivateKey, any, any>; refuseToSign?: boolean } = {}

      Returns MemorySshAgent

    • The raw signature bytes of the sshsig signature (namespace test_namespace, SHA-256) over data by the private key whose comment is identity's.

      Parameters

      Returns Promise<Uint8Array<ArrayBufferLike>>

      SshAgent Identity not found when no identity has that comment; SshAgent Refused to sign when the agent was built with refuseToSign.