Go SDK
Getting Started
Gateway’s Go SDK provides a robust interface for interacting with encrypted storage and secure data sharing capabilities. The SDK offers a type-safe way to create, manage, and share data assets while maintaining strict access control.
Installation
Install the SDK using Go modules:
Authentication
The SDK supports multiple authentication methods:
- JWT-based authentication
- Wallet-based authentication (Ethereum, Solana, Sui)
Initialize the SDK with your preferred authentication method:
Switching Accounts
The SDK allows you to switch between different authentication methods during runtime:
Error Handling
The SDK uses Go’s standard error handling patterns. Always check returned errors:
Best Practices
-
Type safety
- Use Go structs for known data structures when possible
- Validate data before creating assets
- Handle type assertions carefully when working with interface values
-
Resource Management
- Use defer for cleanup when necessary
- Close response bodies and other resources properly
- Handle pagination efficiently for large datasets
-
Documentation
- Comment your schema definitions
- Document any custom validation rules
- Include examples in your code documentation