Blockchain Commons Components TypeScript Library - v1.0.0-alpha.13
    Preparing search index...

    Interface Encrypter

    A trait for types that can encapsulate shared secrets for public key encryption.

    The Encrypter interface defines an interface for encapsulating a shared secret using a public key. This is a key part of hybrid encryption schemes, where a shared symmetric key is encapsulated with a public key, and the recipient uses their private key to recover the symmetric key.

    Types implementing this interface provide the ability to:

    1. Access their encapsulation public key
    2. Generate and encapsulate new shared secrets

    This interface is typically implemented by:

    • Encapsulation public keys
    • Higher-level types that contain or can generate encapsulation public keys
    import { EncapsulationScheme, createEncapsulationKeypair } from '@bcts/components';

    // Generate a recipient keypair
    const [recipientPrivateKey, recipientPublicKey] = createEncapsulationKeypair(EncapsulationScheme.X25519);

    // Encapsulate a new shared secret
    const [sharedSecret, ciphertext] = recipientPublicKey.encapsulateNewSharedSecret();

    Implemented by

    Index

    Methods