Vana SDK - v0.1.0
    Preparing search index...

    Interface VanaCryptoAdapter

    Encryption operations that require different implementations per platform

    interface VanaCryptoAdapter {
        encryptWithPublicKey(data: string, publicKey: string): Promise<string>;
        decryptWithPrivateKey(
            encryptedData: string,
            privateKey: string,
        ): Promise<string>;
        generateKeyPair(): Promise<{ publicKey: string; privateKey: string }>;
        encryptWithWalletPublicKey(
            data: string,
            publicKey: string,
        ): Promise<string>;
        decryptWithWalletPrivateKey(
            encryptedData: string,
            privateKey: string,
        ): Promise<string>;
        encryptWithPassword(
            data: Uint8Array,
            password: string,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        decryptWithPassword(
            encryptedData: Uint8Array,
            password: string,
        ): Promise<Uint8Array<ArrayBufferLike>>;
    }
    Index

    Methods

    • Encrypt data with a public key using asymmetric cryptography

      Parameters

      • data: string

        The data to encrypt

      • publicKey: string

        The public key for encryption

      Returns Promise<string>

      Promise resolving to encrypted data

    • Decrypt data with a private key using asymmetric cryptography

      Parameters

      • encryptedData: string

        The encrypted data

      • privateKey: string

        The private key for decryption

      Returns Promise<string>

      Promise resolving to decrypted data

    • Generate a new key pair for asymmetric cryptography

      Returns Promise<{ publicKey: string; privateKey: string }>

      Promise resolving to public and private key pair

    • Encrypt data with a wallet's public key using ECDH cryptography Uses platform-appropriate ECDH implementation (eccrypto vs eccrypto-js)

      Parameters

      • data: string

        The data to encrypt (string)

      • publicKey: string

        The wallet's public key (secp256k1)

      Returns Promise<string>

      Promise resolving to encrypted data as hex string

    • Decrypt data with a wallet's private key using ECDH cryptography Uses platform-appropriate ECDH implementation (eccrypto vs eccrypto-js)

      Parameters

      • encryptedData: string

        The encrypted data as hex string

      • privateKey: string

        The wallet's private key (secp256k1)

      Returns Promise<string>

      Promise resolving to decrypted data as string

    • Encrypt data with a password using PGP password-based encryption Uses platform-appropriate OpenPGP implementation with consistent format

      Parameters

      • data: Uint8Array

        The data to encrypt as Uint8Array

      • password: string

        The password for encryption (typically wallet signature)

      Returns Promise<Uint8Array<ArrayBufferLike>>

      Promise resolving to encrypted data as Uint8Array

    • Decrypt data with a password using PGP password-based decryption Uses platform-appropriate OpenPGP implementation with consistent format

      Parameters

      • encryptedData: Uint8Array

        The encrypted data as Uint8Array

      • password: string

        The password for decryption (typically wallet signature)

      Returns Promise<Uint8Array<ArrayBufferLike>>

      Promise resolving to decrypted data as Uint8Array