OSDN Git Service

versoin1.1.9 (#594)
[bytom/vapor.git] / crypto / csp / csp.go
1 // csp is a package of cipher service provider
2
3 package csp
4
5 import (
6         "crypto"
7 )
8
9 type XPrvKeyer interface {
10         // XPub derives an extended public key from a given xprv.
11         XPub() XPubKeyer
12         // Derive generates a child xprv by recursively deriving
13         // non-hardened child xprvs over the list of selectors:
14         // `Derive([a,b,c,...]) == Child(a).Child(b).Child(c)...`
15         Derive(path [][]byte) XPrvKeyer
16         // Sign creates an EdDSA signature using expanded private key
17         // derived from the xprv.
18         Sign(msg []byte) []byte
19 }
20
21 type XPubKeyer interface {
22         // PublicKey extracts the public key from an xpub.
23         PublicKey() crypto.PublicKey
24         // Derive generates a child xpub by recursively deriving
25         // non-hardened child xpubs over the list of selectors:
26         // `Derive([a,b,c,...]) == Child(a).Child(b).Child(c)...`
27         Derive(path [][]byte) XPubKeyer
28         // Verify checks an EdDSA signature using public key
29         Verify(msg []byte, sig []byte) bool
30 }