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
P256KeyPair
A P256 key pair object containing the public and private keys.
Error Handling
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
- 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