- Docs
- Developers
- Keyring go
Keyring go
This is a Go-based library for managing keyrings within the Archway ecosystem. This tool provides a secure and efficient way to handle key storage and cryptographic operations in Go-based applications. It supports multiple backends for keyring storage, including filesystem, memory, and hardware-backed solutions, making it a flexible choice for developers working on blockchain applications.
Its Capabilities include:
- Multi-Backend Support: Keyring Go offers various backends for key storage, including filesystem, in-memory, and hardware security modules (HSM).
- Secure Key Management: Provides robust key management, ensuring secure storage and handling of private keys.
- Compatible with Go Applications: Designed to integrate seamlessly into Go-based applications, providing developers with a native solution for cryptographic operations.
- Blockchain Integration: Optimized for use within blockchain ecosystems like Archway, supporting cryptographic functions and key management needs specific to blockchain networks.
- HD Wallet Support: Includes support for Hierarchical Deterministic (HD) wallets, allowing for secure generation and management of multiple keys from a single seed.
Getting started
Keyring Go can be easily integrated into your Go applications to handle key storage and cryptographic functions. Here’s how to get started:
- Installation:
Add the Keyring Go package to your Go project by running:
go get github.com/archway-network/keyring-go
- Choose a Backend: Depending on your needs, select one of the supported keyring backends, such as filesystem, in-memory, or HSM.
- Create and Manage Keys: Use the library’s simple API to create, retrieve, and manage cryptographic keys securely within your Go application.
Example usage
Here’s a quick example of how to use Keyring Go in a Go project:
package main
import (
"fmt"
"github.com/archway-network/keyring-go"
)
func main() {
kr, err := keyring.New("myApp", keyring.BackendFile, "myFilePath", nil)
if err != nil {
fmt.Println("Error creating keyring:", err)
return
}
// Generate a new key
newKey, err := kr.NewAccount("myKey", "mySeed", "", "password", "", "")
if err != nil {
fmt.Println("Error generating key:", err)
return
}
fmt.Println("New key generated:", newKey.Address)
}
This example demonstrates how to create a new keyring, generate a key, and retrieve its address.
Use cases
- Blockchain Applications: Securely manage and store private keys for interacting with the Archway blockchain or other blockchain ecosystems.
- Cryptographic Operations: Handle secure cryptographic operations like key generation, signing, and encryption in Go-based projects.
- HD Wallets: Manage HD wallets for applications requiring multiple keys generated from a single seed.