Documentation ¶
Index ¶
- Constants
- func GetAllAddresses(dataDirPath string) (addresses [][]byte, err error)
- func IsValidKeyJson(j []byte) []byte
- func StartStandAloneServer(keysDir, host, port string, AllowBadFilePermissions bool, ...) error
- func WriteKeyFile(addr []byte, dataDirPath string, content []byte) (err error)
- type Key
- type KeyClient
- type KeyStore
- func (k *KeyStore) AddName(ctx context.Context, in *pbkeys.AddNameRequest) (*pbkeys.AddNameResponse, error)
- func (ks *KeyStore) AllKeys() ([]*Key, error)
- func (ks *KeyStore) DeleteKey(passphrase string, keyAddr []byte) (err error)
- func (k *KeyStore) Export(ctx context.Context, in *pbkeys.ExportRequest) (*pbkeys.ExportResponse, error)
- func (ks *KeyStore) Gen(passphrase string, curveType crypto.CurveType) (key *Key, err error)
- func (k *KeyStore) GenerateKey(ctx context.Context, in *pbkeys.GenRequest) (*pbkeys.GenResponse, error)
- func (ks *KeyStore) GetAllAddresses() (addresses [][]byte, err error)
- func (ks *KeyStore) GetAllNames() (map[string]string, error)
- func (ks *KeyStore) GetKey(passphrase string, keyAddr []byte) (*Key, error)
- func (ks *KeyStore) GetKeyFile(dataDirPath string, keyAddr []byte) (fileContent []byte, err error)
- func (k *KeyStore) Hash(ctx context.Context, in *pbkeys.HashRequest) (*pbkeys.HashResponse, error)
- func (k *KeyStore) Import(ctx context.Context, in *pbkeys.ImportRequest) (*pbkeys.ImportResponse, error)
- func (k *KeyStore) ImportJSON(ctx context.Context, in *pbkeys.ImportJSONRequest) (*pbkeys.ImportResponse, error)
- func (k *KeyStore) List(ctx context.Context, in *pbkeys.ListRequest) (*pbkeys.ListResponse, error)
- func (k *KeyStore) PublicKey(ctx context.Context, in *pbkeys.PubRequest) (*pbkeys.PubResponse, error)
- func (k *KeyStore) RemoveName(ctx context.Context, in *pbkeys.RemoveNameRequest) (*pbkeys.RemoveNameResponse, error)
- func (k *KeyStore) Sign(ctx context.Context, in *pbkeys.SignRequest) (*pbkeys.SignResponse, error)
- func (ks *KeyStore) StoreKey(passphrase string, key *Key) error
- func (ks *KeyStore) StoreKeyEncrypted(passphrase string, key *Key) error
- func (ks *KeyStore) StoreKeyPlain(key *Key) (err error)
- func (k *KeyStore) Verify(ctx context.Context, in *pbkeys.VerifyRequest) (*pbkeys.VerifyResponse, error)
- type KeysConfig
- type Signer
Constants ¶
View Source
const ( DefaultHost = "localhost" DefaultPort = "10997" DefaultHashType = "sha256" DefaultKeysDir = ".keys" TestPort = "7674" )
View Source
const ( CryptoNone = "none" CryptoAESGCM = "scrypt-aes-gcm" HashEd25519 = "go-crypto-0.5.0" HashSecp256k1 = "btc" )
Variables ¶
This section is empty.
Functions ¶
func GetAllAddresses ¶ added in v0.19.0
func IsValidKeyJson ¶ added in v0.19.0
returns the address if valid, nil otherwise
func StartStandAloneServer ¶ added in v0.19.0
Types ¶
type Key ¶ added in v0.19.0
type Key struct { CurveType crypto.CurveType Address crypto.Address PublicKey crypto.PublicKey PrivateKey crypto.PrivateKey }
func DecryptKey ¶ added in v0.19.0
func NewKeyFromPriv ¶ added in v0.19.0
func NewKeyFromPub ¶ added in v0.19.0
func (*Key) MarshalJSON ¶ added in v0.19.0
func (*Key) UnmarshalJSON ¶ added in v0.19.0
type KeyClient ¶
type KeyClient interface { // Sign returns the signature bytes for given message signed with the key associated with signAddress Sign(signAddress crypto.Address, message []byte) (signature crypto.Signature, err error) // PublicKey returns the public key associated with a given address PublicKey(address crypto.Address) (publicKey crypto.PublicKey, err error) // Generate requests that a key be generate within the keys instance and returns the address Generate(keyName string, keyType crypto.CurveType) (keyAddress crypto.Address, err error) // Returns nil if the keys instance is healthy, error otherwise HealthCheck() error }
func NewLocalKeyClient ¶ added in v0.19.0
type KeyStore ¶ added in v0.19.0
type KeyStore struct { sync.Mutex AllowBadFilePermissions bool // contains filtered or unexported fields }
func NewKeyStore ¶ added in v0.19.0
func (*KeyStore) AddName ¶ added in v0.19.0
func (k *KeyStore) AddName(ctx context.Context, in *pbkeys.AddNameRequest) (*pbkeys.AddNameResponse, error)
func (*KeyStore) Export ¶ added in v0.19.0
func (k *KeyStore) Export(ctx context.Context, in *pbkeys.ExportRequest) (*pbkeys.ExportResponse, error)
func (*KeyStore) GenerateKey ¶ added in v0.19.0
func (k *KeyStore) GenerateKey(ctx context.Context, in *pbkeys.GenRequest) (*pbkeys.GenResponse, error)
func (*KeyStore) GetAllAddresses ¶ added in v0.19.0
func (*KeyStore) GetAllNames ¶ added in v0.19.0
func (*KeyStore) GetKeyFile ¶ added in v0.19.0
func (*KeyStore) Hash ¶ added in v0.19.0
func (k *KeyStore) Hash(ctx context.Context, in *pbkeys.HashRequest) (*pbkeys.HashResponse, error)
func (*KeyStore) Import ¶ added in v0.19.0
func (k *KeyStore) Import(ctx context.Context, in *pbkeys.ImportRequest) (*pbkeys.ImportResponse, error)
func (*KeyStore) ImportJSON ¶ added in v0.19.0
func (k *KeyStore) ImportJSON(ctx context.Context, in *pbkeys.ImportJSONRequest) (*pbkeys.ImportResponse, error)
func (*KeyStore) List ¶ added in v0.19.0
func (k *KeyStore) List(ctx context.Context, in *pbkeys.ListRequest) (*pbkeys.ListResponse, error)
func (*KeyStore) PublicKey ¶ added in v0.19.0
func (k *KeyStore) PublicKey(ctx context.Context, in *pbkeys.PubRequest) (*pbkeys.PubResponse, error)
func (*KeyStore) RemoveName ¶ added in v0.19.0
func (k *KeyStore) RemoveName(ctx context.Context, in *pbkeys.RemoveNameRequest) (*pbkeys.RemoveNameResponse, error)
func (*KeyStore) Sign ¶ added in v0.19.0
func (k *KeyStore) Sign(ctx context.Context, in *pbkeys.SignRequest) (*pbkeys.SignResponse, error)
func (*KeyStore) StoreKeyEncrypted ¶ added in v0.19.0
func (*KeyStore) StoreKeyPlain ¶ added in v0.19.0
func (*KeyStore) Verify ¶ added in v0.19.0
func (k *KeyStore) Verify(ctx context.Context, in *pbkeys.VerifyRequest) (*pbkeys.VerifyResponse, error)
type KeysConfig ¶ added in v0.18.0
type KeysConfig struct { GRPCServiceEnabled bool AllowBadFilePermissions bool RemoteAddress string KeysDirectory string }
func DefaultKeysConfig ¶ added in v0.18.0
func DefaultKeysConfig() *KeysConfig
type Signer ¶ added in v0.18.0
type Signer struct {
// contains filtered or unexported fields
}
func AddressableSigner ¶ added in v0.19.0
Creates a AddressableSigner that assumes the address holds an Ed25519 key
Click to show internal directories.
Click to hide internal directories.