i want to ed25519 key being as actor primary key
This commit is contained in:
parent
22b4dcfa0e
commit
b18d9bc6f1
1 changed files with 3 additions and 3 deletions
6
actor.go
6
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
|
||||
|
|
Loading…
Reference in a new issue