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

    Class SymmetricKey

    Implements

    Index

    Properties

    SYMMETRIC_KEY_SIZE: 32
    UR_TYPE: "crypto-key"

    Get the UR type for symmetric keys.

    Methods

    • Create a new symmetric key from data.

      Parameters

      • data: Uint8Array

      Returns SymmetricKey

    • Create a new symmetric key from data (validates length).

      Parameters

      • data: Uint8Array

      Returns SymmetricKey

    • Create a SymmetricKey from raw bytes (legacy alias).

      Parameters

      • data: Uint8Array

      Returns SymmetricKey

    • Create a SymmetricKey from hex string.

      Parameters

      • hex: string

      Returns SymmetricKey

    • Generate a random symmetric key using provided RNG.

      Parameters

      • rng: SecureRandomNumberGenerator

      Returns SymmetricKey

    • Get the data of the symmetric key.

      Returns Uint8Array

    • Get the data of the symmetric key as a byte slice.

      Returns Uint8Array

    • Get a copy of the raw key bytes.

      Returns Uint8Array

    • Get hex string representation.

      Returns string

    • Get hex string representation (alias for hex()).

      Returns string

    • Get base64 representation.

      Returns string

    • Compare with another SymmetricKey.

      Parameters

      Returns boolean

    • Get string representation.

      Returns string

    • Encrypt the given plaintext with this key, and the given additional authenticated data and nonce.

      Parameters

      • plaintext: Uint8Array
      • Optionalaad: Uint8Array<ArrayBufferLike>
      • Optionalnonce: Nonce

      Returns EncryptedMessage

    • Decrypt the given encrypted message with this key.

      Parameters

      • message: EncryptedMessage

      Returns Uint8Array

    • Returns the CBOR tags associated with SymmetricKey.

      Returns Tag[]

    • Returns the untagged CBOR encoding (as a byte string).

      Returns Cbor

    • Returns the tagged CBOR encoding.

      Returns Cbor

    • Returns the tagged value in CBOR binary representation.

      Returns Uint8Array

    • Creates a SymmetricKey by decoding it from untagged CBOR.

      Parameters

      • cbor: Cbor

      Returns SymmetricKey

    • Creates a SymmetricKey by decoding it from tagged CBOR.

      Parameters

      • cbor: Cbor

      Returns SymmetricKey

    • Static method to decode from tagged CBOR.

      Parameters

      • cbor: Cbor

      Returns SymmetricKey

    • Static method to decode from tagged CBOR binary data.

      Parameters

      • data: Uint8Array

      Returns SymmetricKey

    • Static method to decode from untagged CBOR binary data.

      Parameters

      • data: Uint8Array

      Returns SymmetricKey

    • Returns the UR representation of the symmetric key.

      Returns UR

    • Returns the UR string representation of the symmetric key.

      Returns string

    • Creates a SymmetricKey from a UR.

      Parameters

      • ur: UR

      Returns SymmetricKey

    • Creates a SymmetricKey from a UR string.

      Parameters

      • urString: string

      Returns SymmetricKey

    • Alias for fromURString for Rust API compatibility.

      Parameters

      • urString: string

      Returns SymmetricKey