Integration (SDK & API)
Gateway provides an SDK and gRPC API to interact with Transform Encryption.
Key generation (e.g. keypairs, transformation keys) and encryption should be performed on the client.
SDK
Language | Library |
---|---|
Rust | https://github.com/GatewayLabs/gtw-recrypt |
Typescript / Javascript | https://github.com/GatewayLabs/recrypt-wasm-binding |
Some operations require a signing_keypair
to provide computation provenance.
For example; Who performed what operation
1. Generate Key Pair
Generate a new encryption (private & public) keypair. This will follow standard KPI practices where the public key encrypts data and the corresponding private key decrypts the ciphertext.
2. Encrypt Data
Encrypt data using a public key.
3. Generate Transform Key
Generate a transform key for re-encryption using the sender’s private key and the recipient’s public key.
The transformation key is a unique primitive that does not expose either crypto artifact in plaintext.
4. Transform Ciphertext
Transforms (re-encrypts) a ciphertext using a transform key.
Public API (Quickstart)
Node Endpoints
API Requests
1. Generate Key Pair
Generates a new public-private key pair for encryption.
Avoid using this gRPC endpoint in production environments to avoid private key exposure.
2. Encrypt Data
Encrypts data using a public key.
Avoid using this gRPC endpoint in production environments to avoid known-cipher vulnerabilities.
3. Generate Transform Key
Generates a transform key for re-encryption.
Avoid using this gRPC endpoint in production environments to avoid private key exposure.
4. Transform Ciphertext
Transforms (re-encrypts) a ciphertext using a transform key.
5. Decrypt Data
Decrypts a ciphertext using a private key.
Avoid using this gRPC endpoint in production environments to avoid private key exposure.
Best Practices
-
Security
- Secure private key storage
- Validate public keys
- Implement proper key rotation
-
Connection Management
- Reuse client instances
- Implement connection pooling
- Handle reconnection gracefully
-
Error Handling
- Implement retries with backoff
- Use backup nodes when primary is unavailable
- Validate inputs before sending
-
Performance
- Batch operations when possible
- Cache transform keys
- Monitor response times
Rate Limits
Environment | Requests/Second | Burst Limit |
---|---|---|
Production | 100 | 200 |
Testnet | 50 | 100 |
Monitoring
Service status can be monitored at https://status.gateway.tech/pre