diff options
author | Julio Capote <jcapote@gmail.com> | 2023-01-04 13:22:57 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2023-01-04 13:22:57 +0000 |
commit | e92d23b4e3e065fe7e0ce87b5045dd7199ff0c0c (patch) | |
tree | a1060b513fad5eb0ca425db53533588a5fe9da26 /registry/registry.go | |
parent | 979d2c5e0f8188840bbc1c99daed470e20c5eabc (diff) | |
download | communique-e92d23b4e3e065fe7e0ce87b5045dd7199ff0c0c.tar.gz |
try to resolve publickey json
Diffstat (limited to 'registry/registry.go')
-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() |