Using SPF in web2
This section covers using Sunscreen’s Secure Processing Framework (SPF) in web2 applications via the TypeScript client library.
The @sunscreen/spf-client package provides a comprehensive API for interacting with SPF. The client handles FHE encryption, program execution, threshold decryption, and access control management through a straightforward TypeScript interface.
What the TypeScript client provides
The SPF client library enables:
- Program management: Upload and download compiled FHE programs
- Encryption: Client-side encryption of values and arrays
- Ciphertext management: Upload, download, and manage encrypted data
- Program execution: Submit FHE computations with encrypted inputs
- Threshold decryption: Request collaborative decryption from the threshold network
- Re-encryption: Use one-time pads for instant local decryption
- Access control: Manage permissions for running programs and decrypting results
Architecture overview
The TypeScript client communicates with SPF via REST API endpoints. All sensitive operations require authentication using ECDSA signatures (via PrivateKeySigner or ethers.js signers). Encryption and decryption operations use WebAssembly modules for performance.
The library works in both Node.js and browser environments with identical APIs.
Getting started
See the Installation and initialization page to begin using the SPF TypeScript client.