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

    Class SymmetricKey

    Symmetric key for ChaCha20-Poly1305 AEAD encryption (32 bytes)

    A symmetric encryption key used for both encryption and decryption.

    SymmetricKey is a 32-byte cryptographic key used with ChaCha20-Poly1305 AEAD (Authenticated Encryption with Associated Data) encryption. This implementation follows the IETF ChaCha20-Poly1305 specification as defined in RFC-8439.

    Symmetric encryption uses the same key for both encryption and decryption, unlike asymmetric encryption where different keys are used for each operation.

    CBOR Serialization

    SymmetricKey is serialized to CBOR with tag 40023.

    Implements

    • ToCbor
    Index
    SYMMETRIC_KEY_SIZE: number = SYMMETRIC_KEY_SIZE

    The byte length of a SymmetricKey.

    • The first four bytes of reference() in hex, the reference's ref_hex_short.

      Returns string

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

      Parameters

      • plaintext: Uint8Array
      • __namedParameters: { aad?: Uint8Array<ArrayBufferLike>; nonce?: Nonce } = {}

      Returns EncryptedMessage