1 // csp is a package of cipher service provider
8 vcrypto "github.com/vapor/crypto"
9 edchainkd "github.com/vapor/crypto/ed25519/chainkd"
14 func NewXKeys(r io.Reader) (xprv vcrypto.XPrvKeyer, xpub vcrypto.XPubKeyer, err error) {
15 // TODO: if ... create sm2 xprv and xpub
18 // if ... create ed25519 xprv and xpub
19 return edchainkd.NewXKeys(r)
22 func XPubKeys(xpubs []vcrypto.XPubKeyer) []crypto.PublicKey {
23 res := make([]crypto.PublicKey, 0, len(xpubs))
24 for _, xpub := range xpubs {
25 switch xpb := xpub.(type) {
27 res = append(res, xpb.PublicKey())
33 func DeriveXPubs(xpubs []vcrypto.XPubKeyer, path [][]byte) []vcrypto.XPubKeyer {
34 res := make([]vcrypto.XPubKeyer, 0, len(xpubs))
35 for _, xpub := range xpubs {
36 switch xpb := xpub.(type) {