Skip to content

Commit

Permalink
feat: crypto: add SigType: SigTypeDelegated (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
ychiaoli18 authored Sep 23, 2022
1 parent 60676bd commit 3397f15
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crypto/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const (

SigTypeSecp256k1 = SigType(iota)
SigTypeBLS
SigTypeDelegated
)

func (t SigType) Name() (string, error) {
Expand All @@ -26,6 +27,8 @@ func (t SigType) Name() (string, error) {
return "secp256k1", nil
case SigTypeBLS:
return "bls", nil
case SigTypeDelegated:
return "delegated", nil
default:
return "", fmt.Errorf("invalid signature type: %d", t)
}
Expand Down Expand Up @@ -90,6 +93,8 @@ func (s *Signature) UnmarshalCBOR(br io.Reader) error {
s.Type = SigTypeSecp256k1
case SigTypeBLS:
s.Type = SigTypeBLS
case SigTypeDelegated:
s.Type = SigTypeDelegated
}
s.Data = buf[1:]
return nil
Expand Down Expand Up @@ -119,6 +124,8 @@ func (s *Signature) UnmarshalBinary(bs []byte) error {
s.Type = SigTypeSecp256k1
case SigTypeBLS:
s.Type = SigTypeBLS
case SigTypeDelegated:
s.Type = SigTypeDelegated
}
s.Data = bs[1:]
return nil
Expand Down

0 comments on commit 3397f15

Please sign in to comment.