diff --git a/actor.go b/actor.go index 9385bf8..1d90888 100644 --- a/actor.go +++ b/actor.go @@ -271,7 +271,7 @@ func (a *Actor) save() error { // check if we already have a directory to save actors // and if not, create it - dir := storage + slash + "actors" + slash + a.Name + slash + "items" + dir := storage + slash + "actors" + slash + base64.StdEncoding.EncodeToString(a.ed25519PublicKey) + slash + "items" if _, err := os.Stat(dir); os.IsNotExist(err) { os.MkdirAll(dir, 0755) } @@ -299,7 +299,7 @@ func (a *Actor) save() error { } //log.Info(actorToSave) //log.Info(string(actorJSON)) - err = ioutil.WriteFile(storage+slash+"actors"+slash+a.Name+slash+a.Name+".json", actorJSON, 0644) + err = ioutil.WriteFile(storage+slash+"actors"+slash+(base64.StdEncoding.EncodeToString(a.ed25519PublicKey))+slash+"actor.json", actorJSON, 0644) if err != nil { log.Printf("WriteFileJson ERROR: %+v", err) return err @@ -309,7 +309,7 @@ func (a *Actor) save() error { } func (a *Actor) whoAmI() string { - encoded := base64.StdEncoding.EncodeToString(a.ed25519PublicKey) + encoded := "did:key:" + base64.StdEncoding.EncodeToString(a.ed25519PublicKey) self := make(map[string]interface{}) self["@context"] = context() self["type"] = a.actorType