package confage import ( "encoding/json" "testing" "github.com/matryer/is" ) func TestTypeScrypt(t *testing.T) { assert := is.New(t) enc := MustNew("passphrase", 0) enc.Value = 100 payload, err := json.Marshal(enc) assert.NoErr(err) // Should be able to marshal JSON dec := MustNew("passphrase", 0) err = json.Unmarshal(payload, &dec) assert.NoErr(err) // Should be able to unmarshal JSON assert.Equal(enc.Value, dec.Value) // Values should match } func TestTypeX25519(t *testing.T) { assert := is.New(t) enc := MustNew("AGE-SECRET-KEY-1F7SU7MXLVHU0SWQ3L2ZMW7G2NN2YTH88NLU6LVDHENTZLMCT3M5S799RDK", 100) payload, err := json.Marshal(enc) assert.NoErr(err) // Should be able to marshal JSON dec := MustNew("AGE-SECRET-KEY-1F7SU7MXLVHU0SWQ3L2ZMW7G2NN2YTH88NLU6LVDHENTZLMCT3M5S799RDK", 0) err = json.Unmarshal(payload, &dec) assert.NoErr(err) // Should be able to unmarshal JSON assert.Equal(enc.Value, dec.Value) // Values should match }