Skip to main content
If you are here to see how auth context is consumed here, jump to Decrypt.

Prerequisites

  • authContext is required. This is the result from the authentication flow.

Installation

Example Walkthrough

πŸ” Encrypt & Decrypt Flow Alice can encrypt without authentication, Bob must authenticate to decrypt.
  • Alice: Encrypts β†’ No AuthContext needed
  • Bob: Decrypts β†’ Requires AuthContext

πŸ‘©πŸΌ Alice

Alice encrypts data without needing authentication

Create Alice’s Account

Generate Alice’s account using a random private key. Alice only needs an account for encryption - no authentication required.

πŸ§”πŸ»β€β™‚οΈ Bob

Bob needs authentication to decrypt data

Create Bob’s Account

Generate Bob’s account using a random private key. Bob will need this account for authentication to decrypt data.

πŸ‘©πŸΌ Alice Defines Access Rules

Alice decides who can decrypt her encrypted data
See the Access Control Conditions Builder Reference API for more details on how to build access control conditions.

Build Access Control Conditions

Alice defines who can decrypt the encrypted data using official access control conditions builder. These conditions reference Bob’s wallet address and will be checked during decryption.

πŸ§”πŸ»β€β™‚οΈ Bob

Prepares for Decryption

Bob creates authentication context to prove he meets access conditions

πŸ‘©πŸΌ Alice

Prepares Data

Alice configures and encrypts the data with access control conditions

πŸ§”πŸ»β€β™‚οΈ Bob

Decrypts Data

Bob uses his authentication context to decrypt Alice’s data