+8
-8
atproto/identity/identity.go
+8
-8
atproto/identity/identity.go
···
20
20
21
21
// These fields represent a parsed subset of a DID document. They are all nullable. Note that the services and keys maps do not preserve order, so they don't exactly round-trip DID documents.
22
22
AlsoKnownAs []string
23
-
Services map[string]Service
24
-
Keys map[string]Key
23
+
Services map[string]ServiceEndpoint
24
+
Keys map[string]IdentityKey
25
25
}
26
26
27
-
type Key struct {
27
+
type IdentityKey struct {
28
28
Type string
29
29
PublicKeyMultibase string
30
30
}
31
31
32
-
type Service struct {
32
+
type ServiceEndpoint struct {
33
33
Type string
34
34
URL string
35
35
}
···
38
38
//
39
39
// Always returns an invalid Handle field; calling code should only populate that field if it has been bi-directionally verified.
40
40
func ParseIdentity(doc *DIDDocument) Identity {
41
-
keys := make(map[string]Key, len(doc.VerificationMethod))
41
+
keys := make(map[string]IdentityKey, len(doc.VerificationMethod))
42
42
for _, vm := range doc.VerificationMethod {
43
43
parts := strings.SplitN(vm.ID, "#", 2)
44
44
if len(parts) < 2 {
···
53
53
continue
54
54
}
55
55
// TODO: verify that ID and type match for atproto-specific services?
56
-
keys[parts[1]] = Key{
56
+
keys[parts[1]] = IdentityKey{
57
57
Type: vm.Type,
58
58
PublicKeyMultibase: vm.PublicKeyMultibase,
59
59
}
60
60
}
61
-
svc := make(map[string]Service, len(doc.Service))
61
+
svc := make(map[string]ServiceEndpoint, len(doc.Service))
62
62
for _, s := range doc.Service {
63
63
parts := strings.SplitN(s.ID, "#", 2)
64
64
if len(parts) < 2 {
···
69
69
continue
70
70
}
71
71
// TODO: verify that ID and type match for atproto-specific services?
72
-
svc[parts[1]] = Service{
72
+
svc[parts[1]] = ServiceEndpoint{
73
73
Type: s.Type,
74
74
URL: s.ServiceEndpoint,
75
75
}