Documentation ¶
Index ¶
- Constants
- func CreateED25519KeyFromSeed(privateBytes []byte) ([]byte, []byte, error)
- func CreateP384Key(privateBytes []byte) (*ecdsa.PrivateKey, []byte, []byte, string, string)
- func CreateSECP256K1Key(privateBytes []byte) (*ecdsa.PrivateKey, []byte, []byte, string, string)
- func Decrypt(priv *ecdsa.PrivateKey, encryptedObject string) ([]byte, error)
- func EllipticParamsToJWK(crv string, kty string, x []byte, y []byte) (*jwk.JWK, error)
- func EllipticPubkeyToJWK(pub *ecdsa.PublicKey) (*jwk.JWK, error)
- func EncryptToEllipticPubkey(pub *ecdsa.PublicKey, msg []byte) (string, error)
- func JWKToElliptic(jsonWebKey *jwk.JWK) (*ecdsa.PublicKey, error)
- func SignED25519(priv *ed25519.PrivateKey, keyId string, header string, msg []byte) (string, error)
- func SignElliptic(priv *ecdsa.PrivateKey, keyId string, header string, msg []byte) (string, error)
- func VerifyED25519(pub *ed25519.PublicKey, signature string) ([]byte, error)
- func VerifyElliptic(pub *ecdsa.PublicKey, signature string) ([]byte, string, error)
- type Config
- type EllipticJwk
- type KeyManager
Constants ¶
View Source
const ENCRYPTION_ROUNDS = 1048576
Variables ¶
This section is empty.
Functions ¶
func CreateP384Key ¶
func CreateSECP256K1Key ¶
func EllipticParamsToJWK ¶
func EncryptToEllipticPubkey ¶
func SignED25519 ¶
func SignElliptic ¶
Types ¶
type EllipticJwk ¶
type KeyManager ¶
type KeyManager interface { // InitSeed creates the master key encrypted with a passphrase, returns the mnemonic InitSeed(seedImport string, passphrase string) (string, error) // UnlockSeed unlocks the master key with passphrase UnlockSeed(passphrase string) error // GetSeed gets the seed phrase mnemonic that was used to initialize this daemon GetSeed() (string, error) IsLocked() bool // New Child will create a new child key from the master key. // If current index is specified, that will be used. Otherwise generated. // Master seed should be unlocked first. Child ID should be tracked // by the caller. Private key bytes are also returned. NewChild(parentId int64, keyIndex uint32) (int64, []byte, uint32, error) // GetChildKey gets the private key bytes for a certain child derrivation. GetChildKey(childId int64) ([]byte, error) GetIndex(id int64) (uint32, error) // GetChildrenKeys gets all the children private keys created from parent GetChildrenKeys(parentId int64) ([][]byte, []uint32, error) // CreateNewED25519Key will create a new ED25519 keypair and save to DB under the identity key passed in. // Returns public key, private key, the backing store ID, and the backing key index. CreateNewED25519Key(int64) ([]byte, []byte, int64, uint32, error) // CreateNewSECP256K1Key will create a new SECP256K1 keypair and save to DB under the identity key passed in. // Returns private key, the backing store ID, and the backing key index. CreateNewSECP256K1Key(int64) (*ecdsa.PrivateKey, int64, uint32, error) // CreateNewP384Key will create a new P384 keypair and save to DB under the identity key passed in. // Returns private key, the backing store ID, and the backing key index. CreateNewP384Key(int64) (*ecdsa.PrivateKey, int64, uint32, error) // Decrypt will attempt to decrypt a message with one of the saved keys // Returns the decrypted message as bytes. Decrypt(protected, ciphertext, iv, tag string) ([]byte, error) }
func New ¶
func New(cfg Config) (KeyManager, error)
Click to show internal directories.
Click to hide internal directories.