diff options
Diffstat (limited to 'registry')
-rw-r--r-- | registry/registry.go | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/registry/registry.go b/registry/registry.go index 20138e1..5b912b1 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -186,9 +186,23 @@ func (r *Registry) Inbox(name string, req *http.Request) error { if err != nil { return err } - var t vocab.ActivityStreamsPerson - streams.ToType(context.Background(), keyPageData) - pubKeyProp := t.GetW3IDSecurityV1PublicKey() + + var person vocab.ActivityStreamsPerson + + resolver, err := streams.NewJSONResolver(func(c context.Context, p vocab.ActivityStreamsPerson) error { + // Store the person in the enclosing scope, for later. + person = p + return nil + }, func(c context.Context, note vocab.ActivityStreamsNote) error { + // We can treat the type differently. + return nil + }) + + ctx := context.Background() + // Pass in a vocab.Type instead of map[string]interface{}. + err = resolver.Resolve(ctx, keyPageData) + + pubKeyProp := person.GetW3IDSecurityV1PublicKey() iter := pubKeyProp.At(0) pubKey := iter.Get() pemProp := pubKey.GetW3IDSecurityV1PublicKeyPem() |