func (s *SharedSecret) toProto() *panda_proto.KeyExchange_SharedSecret { ret := new(panda_proto.KeyExchange_SharedSecret) if len(s.Secret) > 0 { ret.Secret = proto.String(s.Secret) } if s.Cards.NumDecks > 0 { ret.NumDecks = proto.Int32(int32(s.Cards.NumDecks)) canonical := s.Cards.Canonicalise() ret.CardCount = canonical.counts[:] } if s.Year != 0 { ret.Time = &panda_proto.KeyExchange_SharedSecret_Time{ Day: proto.Int32(int32(s.Day)), Month: proto.Int32(int32(s.Month)), Year: proto.Int32(int32(s.Year)), Hours: proto.Int32(int32(s.Hours)), Minutes: proto.Int32(int32(s.Minutes)), } } return ret }