gosecret/secretvalue_funcs.go

18 lines
448 B
Go
Raw Permalink Normal View History

package gosecret
2021-12-13 04:25:45 -05:00
import (
`fmt`
)
/*
MarshalJSON converts a SecretValue to a JSON representation.
For compat reasons, the MarshalText is left "unmolested" (i.e. renders to a Base64 value).
I don't bother with an UnmarshalJSON because it makes exactly 0 sense to unmarshal due to runtime and unexported fields in Secret.
*/
func (s *SecretValue) MarshalJSON() (b []byte, err error) {
2021-12-13 04:25:45 -05:00
b = []byte(fmt.Sprintf("\"%v\"", string(*s)))
return
}