fork of indigo with slightly nicer lexgen

better name for keys field type on Identity

Changed files
+6 -4
atproto
identity
+6 -4
atproto/identity/identity.go
··· 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 23 Services map[string]ServiceEndpoint 24 - Keys map[string]IdentityKey 24 + Keys map[string]VerificationMethod 25 25 } 26 26 27 - type IdentityKey struct { 27 + // Sub-field type for [Identity], representing a crytographic public key declared as a "verificationMethod" in the DID document. 28 + type VerificationMethod struct { 28 29 Type string 29 30 PublicKeyMultibase string 30 31 } 31 32 33 + // Sub-field type for [Identity], representing a service endpoint URL declared in the DID document. 32 34 type ServiceEndpoint struct { 33 35 Type string 34 36 URL string ··· 38 40 // 39 41 // Always returns an invalid Handle field; calling code should only populate that field if it has been bi-directionally verified. 40 42 func ParseIdentity(doc *DIDDocument) Identity { 41 - keys := make(map[string]IdentityKey, len(doc.VerificationMethod)) 43 + keys := make(map[string]VerificationMethod, len(doc.VerificationMethod)) 42 44 for _, vm := range doc.VerificationMethod { 43 45 parts := strings.SplitN(vm.ID, "#", 2) 44 46 if len(parts) < 2 { ··· 53 55 continue 54 56 } 55 57 // TODO: verify that ID and type match for atproto-specific services? 56 - keys[parts[1]] = IdentityKey{ 58 + keys[parts[1]] = VerificationMethod{ 57 59 Type: vm.Type, 58 60 PublicKeyMultibase: vm.PublicKeyMultibase, 59 61 }