···20202121 // 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.
2222 AlsoKnownAs []string
2323- Services map[string]Service
2424- Keys map[string]Key
2323+ Services map[string]ServiceEndpoint
2424+ Keys map[string]IdentityKey
2525}
26262727-type Key struct {
2727+type IdentityKey struct {
2828 Type string
2929 PublicKeyMultibase string
3030}
31313232-type Service struct {
3232+type ServiceEndpoint struct {
3333 Type string
3434 URL string
3535}
···3838//
3939// Always returns an invalid Handle field; calling code should only populate that field if it has been bi-directionally verified.
4040func ParseIdentity(doc *DIDDocument) Identity {
4141- keys := make(map[string]Key, len(doc.VerificationMethod))
4141+ keys := make(map[string]IdentityKey, len(doc.VerificationMethod))
4242 for _, vm := range doc.VerificationMethod {
4343 parts := strings.SplitN(vm.ID, "#", 2)
4444 if len(parts) < 2 {
···5353 continue
5454 }
5555 // TODO: verify that ID and type match for atproto-specific services?
5656- keys[parts[1]] = Key{
5656+ keys[parts[1]] = IdentityKey{
5757 Type: vm.Type,
5858 PublicKeyMultibase: vm.PublicKeyMultibase,
5959 }
6060 }
6161- svc := make(map[string]Service, len(doc.Service))
6161+ svc := make(map[string]ServiceEndpoint, len(doc.Service))
6262 for _, s := range doc.Service {
6363 parts := strings.SplitN(s.ID, "#", 2)
6464 if len(parts) < 2 {
···6969 continue
7070 }
7171 // TODO: verify that ID and type match for atproto-specific services?
7272- svc[parts[1]] = Service{
7272+ svc[parts[1]] = ServiceEndpoint{
7373 Type: s.Type,
7474 URL: s.ServiceEndpoint,
7575 }