Generates a new P256 key pair for use with Base Account. This is essential for advanced integrations and Sub Account management.
Parameters
This function takes no parameters.Returns
A P256 key pair object containing the public and private keys.
Error Handling
Code | Message | Description |
---|---|---|
4100 | Key generation not supported | Browser does not support cryptographic key generation |
4200 | Insufficient entropy | System lacks sufficient randomness for secure key generation |
4300 | Cryptographic system failure | Hardware or software cryptographic failure |
Private Key SecurityNever expose private keys in client-side code or transmit them over insecure channels. Store them securely using appropriate key management systems.
Integration with Sub Accounts
Error Handling
ThegenerateKeyPair
function can throw errors for:
- Cryptographic system failures
- Insufficient entropy
- Browser compatibility issues
generateKeyPair
in a try-catch block:
Security Considerations
Private Key SecurityNever expose private keys in client-side code or transmit them over insecure channels. Store them securely using appropriate key management systems.
- Store private keys using secure storage mechanisms
- Never log private keys to console in production
- Consider using hardware security modules for production applications
- Implement proper key rotation policies