3 // Directive: +gen on PrivKeyInner
8 "github.com/tendermint/go-wire/data"
11 // Auto-generated adapters for happily unmarshaling interfaces
13 // Copyright (c) 2017 Ethan Frey (ethan.frey@tendermint.com)
16 PrivKeyInner "json:\"unwrap\""
19 var PrivKeyMapper = data.NewMapper(PrivKey{})
21 func (h PrivKey) MarshalJSON() ([]byte, error) {
22 return PrivKeyMapper.ToJSON(h.PrivKeyInner)
25 func (h *PrivKey) UnmarshalJSON(data []byte) (err error) {
26 parsed, err := PrivKeyMapper.FromJSON(data)
27 if err == nil && parsed != nil {
28 h.PrivKeyInner = parsed.(PrivKeyInner)
33 // Unwrap recovers the concrete interface safely (regardless of levels of embeds)
34 func (h PrivKey) Unwrap() PrivKeyInner {
36 for wrap, ok := hi.(PrivKey); ok; wrap, ok = hi.(PrivKey) {
37 hi = wrap.PrivKeyInner
42 /*** below are bindings for each implementation ***/
45 PrivKeyMapper.RegisterImplementation(PrivKeyEd25519{}, "ed25519", 0x1)
48 func (hi PrivKeyEd25519) Wrap() PrivKey {