Developers
Blueprint SDK Contexts
Keystore Context

Keystore Context

The KeystoreContext trait provides a standardized interface for accessing, managing, and signing using cryptographic keys in your Blueprint.

Overview

The KeystoreContext trait provides access to a GenericKeystore that implements the Backend trait, offering:

  • Key Creation - Generate new keys of various types (ECDSA, SR25519, ED25519, BN254_BLS, BLS381)
  • Key Storage - Securely store and retrieve keys
  • Key Management - Read, modify, and delete stored keys
  • Signing - Sign messages using stored keys
  • Key Import/Export - Import existing keys and export key data

Using the Context

1. Define Your Context

First, define your context struct that implements the KeystoreContext trait:

2. Access Keystore Functionality

You can then use this context to access the keystore and perform key operations:

The KeystoreContext trait provides comprehensive key management capabilities through the GenericKeystore implementation:

The underlying Backend trait provides the full range of key management operations: