Files
sonr/x/did/controller/base.go
T

55 lines
996 B
Go
Raw Normal View History

package controller
2024-09-25 19:45:28 -04:00
import (
"github.com/onsonr/sonr/pkg/crypto/mpc"
2024-09-25 19:45:28 -04:00
)
type ControllerI interface {
ChainID() string
// GetPubKey() *commonv1.PubKey
2024-09-25 19:45:28 -04:00
SonrAddress() string
RawPublicKey() []byte
2024-09-25 19:45:28 -04:00
}
func New(src mpc.KeyshareSource) (ControllerI, error) {
2024-09-25 19:45:28 -04:00
return &controller{
src: src,
address: src.Address(),
publicKey: src.PublicKey(),
did: src.Issuer(),
chainID: "sonr-testnet-1",
2024-09-25 19:45:28 -04:00
}, nil
}
type controller struct {
src mpc.KeyshareSource
address string
chainID string
publicKey []byte
did string
}
func (c *controller) ChainID() string {
return c.chainID
}
//
// func (c *controller) GetPubKey() *commonv1.PubKey {
// return &commonv1.PubKey{
// KeyType: "ecdsa",
// RawKey: &commonv1.RawKey{
// Algorithm: "secp256k1",
// Key: c.publicKey,
// },
// Role: "authentication",
// }
// }
2024-10-18 13:45:57 -04:00
func (c *controller) RawPublicKey() []byte {
return c.publicKey
}
func (c *controller) SonrAddress() string {
return c.address
}