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

    Function encryptBlobWithSignedKey

    • Encrypts data using a signed key generated from the user's wallet signature.

      Parameters

      • data: string | Blob

        The data to encrypt (string or Blob)

      • key: string

        The signed key from generateEncryptionKey - MUST be a wallet signature

      • platformAdapter: VanaPlatformAdapter

        The platform adapter for crypto operations

      Returns Promise<Blob>

      The encrypted data as Blob

      This is a pure cryptographic primitive that encrypts data using the Vana protocol's standard encryption method. The key parameter must be a signature generated by the generateEncryptionKey utility - this ensures deterministic key generation from the user's wallet, enabling the same key to be regenerated for decryption.

      This function uses password-based encryption with the signature as the password, providing symmetric encryption that can be decrypted with the same signature.

      When encryption fails

      // Generate the encryption key from wallet signature
      const encryptionKey = await generateEncryptionKey(walletClient);

      // Encrypt data with the signed key
      const encryptedBlob = await encryptBlobWithSignedKey(
      "My sensitive data",
      encryptionKey,
      platformAdapter
      );

      // Later, decrypt with the same key
      const decryptedBlob = await decryptBlobWithSignedKey(
      encryptedBlob,
      encryptionKey,
      platformAdapter
      );