15 lines
571 B
Go
15 lines
571 B
Go
package awsserversdk
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// Secret redacts credentials when formatted or marshaled. Reveal must be called explicitly.
|
|
type Secret struct{ value string }
|
|
|
|
func (s Secret) Reveal() string { return s.value }
|
|
func (Secret) String() string { return "[REDACTED]" }
|
|
func (Secret) GoString() string { return "[REDACTED]" }
|
|
func (Secret) MarshalJSON() ([]byte, error) { return json.Marshal("[REDACTED]") }
|
|
func (s *Secret) UnmarshalJSON(raw []byte) error { return json.Unmarshal(raw, &s.value) }
|