aboutsummaryrefslogtreecommitdiff
path: root/registry/registry.go
diff options
context:
space:
mode:
Diffstat (limited to 'registry/registry.go')
-rw-r--r--registry/registry.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/registry/registry.go b/registry/registry.go
index e7f66fc..dc83328 100644
--- a/registry/registry.go
+++ b/registry/registry.go
@@ -2,7 +2,9 @@ package registry
import (
"bytes"
+ "crypto/x509"
"encoding/gob"
+ "encoding/pem"
"net/http"
"net/url"
"strings"
@@ -54,7 +56,26 @@ func (r *Registry) Actor(name string) (map[string]interface{}, error) {
if handler == nil {
return nil, nil
}
- return views.RenderActor(handler.handlerCfg.Name, r.cfg.Domain)
+ aso := models.NewKeypair(handler.handlerCfg)
+ result, err := r.persister.Find(aso)
+ if err != nil {
+ return nil, err
+ }
+ buf := bytes.NewBuffer(result)
+ dec := gob.NewDecoder(buf)
+ var keypair models.Keypair
+ err = dec.Decode(&keypair)
+ if err != nil {
+ return nil, err
+ }
+ privKey := &keypair.PrivateKey
+ pemdata := pem.EncodeToMemory(
+ &pem.Block{
+ Type: "PUBLIC KEY",
+ Bytes: x509.MarshalPKCS1PublicKey(&privKey.PublicKey),
+ },
+ )
+ return views.RenderActor(handler.handlerCfg.Name, r.cfg.Domain, string(pemdata))
}
func (r *Registry) OutboxCollection(name string) (map[string]interface{}, error) {