Gordian Envelope TypeScript Library - v1.0.0-alpha.20
    Preparing search index...

    Class PublicKeyBase

    Represents a public key for key encapsulation.

    Use this to encapsulate a shared secret for a recipient.

    Implements

    • ReferenceProvider
    • CborTaggedEncodable
    • CborTaggedDecodable<PublicKeyBase>
    • UREncodable
    Index

    Methods

    • Create an EncapsulationPublicKey from an X25519PublicKey.

      Parameters

      • publicKey: X25519PublicKey

      Returns PublicKeyBase

    • Create an EncapsulationPublicKey from raw X25519 public key bytes.

      Parameters

      • data: Uint8Array

      Returns PublicKeyBase

    • Create an EncapsulationPublicKey from an MLKEMPublicKey.

      Parameters

      • publicKey: MLKEMPublicKey

      Returns PublicKeyBase

    • Create an EncapsulationPublicKey from raw MLKEM public key bytes.

      Parameters

      • level: MLKEMLevel
      • data: Uint8Array

      Returns PublicKeyBase

    • Returns the encapsulation scheme.

      Returns EncapsulationScheme

    • Returns true if this is an X25519 public key.

      Returns boolean

    • Returns true if this is an MLKEM public key.

      Returns boolean

    • Returns the X25519 public key if this is an X25519 encapsulation key.

      Returns X25519PublicKey

      Error if this is not an X25519 key

    • Returns the MLKEM public key if this is an MLKEM encapsulation key.

      Returns MLKEMPublicKey

      Error if this is not an MLKEM key

    • Returns the X25519 public key if available, or null.

      Returns X25519PublicKey | null

    • Returns the MLKEM public key if available, or null.

      Returns MLKEMPublicKey | null

    • Returns the raw public key data.

      Returns Uint8Array

    • Returns this object as an EncapsulationPublicKey.

      This method allows EncapsulationPublicKey to implement the Encrypter interface. Since this class is itself an encapsulation public key, it returns this.

      Returns PublicKeyBase

      This encapsulation public key

    • Encapsulate a new shared secret for this public key.

      This generates a random shared secret and encapsulates it so that only the holder of the corresponding private key can recover it.

      Returns [SymmetricKey, EncapsulationCiphertext]

      A tuple of [sharedSecret, ciphertext]

    • Compare with another EncapsulationPublicKey.

      Parameters

      Returns boolean

    • Get string representation.

      Returns string

    • Returns a unique reference to this EncapsulationPublicKey instance.

      The reference is derived from the SHA-256 hash of the tagged CBOR representation, providing a unique, content-addressable identifier.

      Returns Reference

    • Returns the CBOR tags associated with this public key.

      Returns Tag[]

    • Returns the untagged CBOR encoding.

      Returns Cbor

    • Returns the tagged CBOR encoding.

      Returns Cbor

    • Returns the tagged value in CBOR binary representation.

      Returns Uint8Array

    • Creates an EncapsulationPublicKey by decoding it from untagged CBOR. Note: Without tags, we assume X25519 scheme.

      Parameters

      • cborValue: Cbor

      Returns PublicKeyBase

    • Creates an EncapsulationPublicKey by decoding it from tagged CBOR.

      Parameters

      • cborValue: Cbor

      Returns PublicKeyBase

    • Static method to decode from tagged CBOR.

      Parameters

      • cborValue: Cbor

      Returns PublicKeyBase

    • Static method to decode from tagged CBOR binary data.

      Parameters

      • data: Uint8Array

      Returns PublicKeyBase

    • Static method to decode from untagged CBOR binary data.

      Parameters

      • data: Uint8Array

      Returns PublicKeyBase

    • Returns the UR representation.

      Returns UR

    • Returns the UR string representation.

      Returns string

    • Creates an EncapsulationPublicKey from a UR.

      Parameters

      • ur: UR

      Returns PublicKeyBase

    • Creates an EncapsulationPublicKey from a UR string.

      Parameters

      • urString: string

      Returns PublicKeyBase