github.com/code-to-go/safepool.lib@v0.0.0-20221205180519-ee25e63c226e/security/identity_test.go (about) 1 package security 2 3 import ( 4 "encoding/json" 5 "testing" 6 7 "github.com/stretchr/testify/assert" 8 ) 9 10 func TestIdentity(t *testing.T) { 11 12 identity, err := NewIdentity("test") 13 assert.NoErrorf(t, err, "cannot create identity") 14 15 data, err := json.Marshal(identity.Public()) 16 assert.NoErrorf(t, err, "cannot marshal private identity") 17 print(string(data)) 18 19 }