github.com/sixexorg/magnetic-ring@v0.0.0-20191119090307-31705a21e419/account/keystore/provider.go (about) 1 // Copyright (C) 2017 go-nebulas authors 2 // 3 // This file is part of the go-nebulas library. 4 // 5 // the go-nebulas library is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // the go-nebulas library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with the go-nebulas library. If not, see <http://www.gnu.org/licenses/>. 17 // 18 19 package account 20 21 import "github.com/sixexorg/magnetic-ring/crypto" 22 23 // Provider class represents a "provider" for the 24 // Security API, where a provider implements some or all parts of 25 // Security. Services that a provider may implement include: 26 // Algorithms 27 // Key generation, conversion, and management facilities (such as for 28 // algorithm-specific keys). 29 // Each provider has a name and a version number, and is configured 30 // in each runtime it is installed in. 31 type Provider interface { 32 33 // Aliases all alias in provider save 34 Aliases() []string 35 36 // SetKey assigns the given key (that has already been protected) to the given alias. 37 SetKey(a string, key crypto.PrivateKey, passphrase []byte) error 38 39 // GetKey returns the key associated with the given alias, using the given 40 // password to recover it. 41 GetKey(a string, passphrase []byte) (crypto.PrivateKey, error) 42 43 // Delete remove key 44 Delete(a string) error 45 46 // ContainsAlias check provider contains key 47 ContainsAlias(a string) (bool, error) 48 49 // Clear all entries in provider 50 Clear() error 51 }