Authorization
Understanding how to authorize intents in Grid
Authorization in Grid follows the principles of Open Banking, where actions require explicit authorization from the appropriate authorities. This is implemented through blockchain signatures, making it secure and verifiable.
The technical implementation details shown below will be abstracted away in an upcoming Grid SDK. The SDK will handle all the complexity of authorization, key management, and Turnkey integration, making it much easier to implement Grid’s authorization system in your applications.
How Authorization Works
Grid uses a two-step authorization process:
- Email-based authentication that provides a credential bundle valid for a specified duration (defaults to 1 hour)
- Authority-based signing of intents using the credential bundle
Authority Types
Grid supports various types of authorities, each with specific permissions that determine what actions they can perform:
CAN_INITIATE
: Authorities that can create new intentsCAN_VOTE
: Authorities that can approve intentsCAN_EXECUTE
: Authorities that can execute approved intents
Each authority must have a Solana-compatible Secp256k1 keypair, which is used to sign transactions and verify ownership of the authority.
Creating and Managing Authorities
Grid provides two ways to create authorities, with email-based creation being the recommended default approach for most use cases:
-
Email-based Authority Creation (Recommended): The simplest way to create authorities using Grid’s built-in authentication:
- Authenticate using the
/auth
endpoint to receive an OTP - Verify the OTP using the
/verify-otp
endpoint - Grid automatically generates and manages a Solana-compatible keypair for the authority
- The verified authority can then be used to authorize intents
- Authenticate using the
-
External Authority Creation: For advanced use cases, you can create authorities externally:
- Generate a Solana-compatible Secp256k1 keypair
- Submit the public key to Grid when creating a smart account
- Define the authority’s permissions in the smart account’s policies
- Manage the private key securely in your own infrastructure
Technical Implementation
The email-based authentication process uses Turnkey’s API key stamper for secure key management. Here’s how it works:
For more details on Turnkey’s API key stamper implementation, see the Turnkey API Documentation.
This implementation ensures secure key management and proper authorization of intents through Turnkey’s infrastructure.
Example: Authentication and OTP Verification
Authenticate and get OTP
Send a POST request to authenticate and receive an OTP:
The response will contain an OTP ID and MPC primary ID:
Verify OTP and get credential bundle
Use the OTP to verify and receive a credential bundle:
The response includes the credential bundle and account information:
The credential bundle obtained from this process can then be used to authorize intents and transactions on behalf of the smart account.
API Reference
For detailed API specifications, see the Authorization API Reference.