Browse Source

Add type assertions for sig/pub/privkey implemenetations

pull/1782/head
Ethan Frey 7 years ago
parent
commit
9e57d521ef
3 changed files with 12 additions and 0 deletions
  1. +4
    -0
      priv_key.go
  2. +4
    -0
      pub_key.go
  3. +4
    -0
      signature.go

+ 4
- 0
priv_key.go View File

@ -64,6 +64,8 @@ var privKeyMapper = data.NewMapper(PrivKey{}).
//-------------------------------------
var _ PrivKeyInner = PrivKeyEd25519{}
// Implements PrivKey
type PrivKeyEd25519 [64]byte
@ -149,6 +151,8 @@ func GenPrivKeyEd25519FromSecret(secret []byte) PrivKeyEd25519 {
//-------------------------------------
var _ PrivKeyInner = PrivKeySecp256k1{}
// Implements PrivKey
type PrivKeySecp256k1 [32]byte


+ 4
- 0
pub_key.go View File

@ -67,6 +67,8 @@ var pubKeyMapper = data.NewMapper(PubKey{}).
//-------------------------------------
var _ PubKeyInner = PubKeyEd25519{}
// Implements PubKeyInner
type PubKeyEd25519 [32]byte
@ -146,6 +148,8 @@ func (pubKey PubKeyEd25519) Wrap() PubKey {
//-------------------------------------
var _ PubKeyInner = PubKeySecp256k1{}
// Implements PubKey.
// Compressed pubkey (just the x-cord),
// prefixed with 0x02 or 0x03, depending on the y-cord.


+ 4
- 0
signature.go View File

@ -62,6 +62,8 @@ var sigMapper = data.NewMapper(Signature{}).
//-------------------------------------
var _ SignatureInner = SignatureEd25519{}
// Implements Signature
type SignatureEd25519 [64]byte
@ -100,6 +102,8 @@ func (sig SignatureEd25519) Wrap() Signature {
//-------------------------------------
var _ SignatureInner = SignatureSecp256k1{}
// Implements Signature
type SignatureSecp256k1 []byte


Loading…
Cancel
Save