Documentation
¶
Overview ¶
Package suisecret: Pure Go implementation to decode and encode SUI keystore keys Provides direct replacement of third-party sui keytool convert command Supports ed25519 signature scheme with Base64 and hex format conversion Enables seamless wallet creation from decoded private keys
suisecret: 纯 Go 实现来解码和编码 SUI keystore 密钥 提供第三方 sui keytool convert 命令的直接替代方案 支持 ed25519 签名方案,包含 Base64 和十六进制格式转换 支持从解码的私钥无缝创建钱包
Index ¶
Constants ¶
const (
SchemeFlagEd25519 byte = 0x00 // Ed25519 scheme flag value // Ed25519 方案标志值
)
SchemeFlagEd25519 represents the scheme flag byte value in sui keystore format This constant identifies Ed25519 signature scheme as the first byte in encoded keys Value 0x00 indicates Ed25519 cryptographic algorithm
SchemeFlagEd25519 代表 sui keystore 格式中的协议标志字节值 此常量标识编码密钥中第一个字节的 Ed25519 签名方案 值 0x00 表示 Ed25519 加密算法
Variables ¶
This section is empty.
Functions ¶
func Encode ¶
Encode encodes a hex private key with scheme flag into Base64 keystore format Takes hex-encoded private key string and scheme name as input Returns Base64-encoded keystore key or error if encode fails This performs the reverse operation of Decode function
Encode 将十六进制私钥和方案标志编码为 Base64 keystore 格式 接受十六进制编码的私钥字符串和方案名称作为输入 返回 Base64 编码的 keystore 密钥,如果编码失败则返回错误 这是 Decode 函数的反向操作
func GetSchemeFlag ¶
GetSchemeFlag returns the scheme flag byte value corresponding to given scheme name Accepts scheme name string and returns corresponding flag byte Returns error if scheme is not supported (ed25519 is supported)
GetSchemeFlag 返回与给定方案名称对应的方案标志字节值 接受方案名称字符串并返回对应的标志字节 如果方案不受支持则返回错误(支持 ed25519)
Types ¶
type KeyInfo ¶
type KeyInfo struct {
Base64WithFlag string `json:"base64WithFlag"` // Base64 format with scheme flag // 带协议标志的 Base64 格式
HexWithoutFlag string `json:"hexWithoutFlag"` // Hex private key without flag // 不带标志的十六进制私钥
Scheme string `json:"scheme"` // Key scheme type (ed25519) // 密钥协议类型(ed25519)
}
KeyInfo represents the decoded key information from sui keystore format Contains Base64 encoded key with scheme flag and hex private key without flag Supports direct wallet creation through GetWallet method Compatible with standard sui keytool convert output
KeyInfo 代表从 sui keystore 格式解码后的密钥信息 包含带协议标志的 Base64 编码密钥和不带标志的十六进制私钥 支持通过 GetWallet 方法直接创建钱包 与标准 sui keytool convert 输出兼容
func Decode ¶
Decode decodes a Base64-encoded sui keystore key into standard key information Accepts Base64 string from sui.keystore file with format [scheme_flag][private_key] Returns KeyInfo containing decoded components or error if decode fails Compatible with standard sui keytool convert command output
Decode 将 Base64 编码的 sui keystore 密钥解码为标准密钥信息 接受来自 sui.keystore 文件的 Base64 字符串,格式为 [协议标志][私钥] 返回包含解码组件的 KeyInfo,如果解码失败则返回错误 与标准 sui keytool convert 命令输出兼容