@@ -30,16 +30,61 @@ extension ComAtprotoLexicon.Identity {
3030 public let token : String ?
3131
3232 /// The rotation keys recommended to be added in the DID document. Optional.
33+ /// An array of aliases of the user account. Optional.
34+ /// - Important: To add a new rotation key, include all existing rotation keys with the new
35+ /// rotation key.
36+ ///
37+ /// - Important: To remove a rotation key, include all existing rotation keys except the
38+ /// rotation key being removed.
3339 public let rotationKeys : [ String ] ?
3440
3541 /// An array of aliases of the user account. Optional.
42+ /// - Important: To add a new alias, include all existing aliases with the new alias.
43+ ///
44+ /// - Important: To remove an alias, include all existing alias' except the alias being removed.
3645 public let alsoKnownAs : [ String ] ?
3746
38- /// A verification method recommeneded to be added in the DID document. Optional.
39- public let verificationMethods : VerificationMethod ?
47+ /// A dictionary of verification methods to inckude in the DID document. Optional.
48+ /// - Important: To add a new verification method, include all existing verification methods with the
49+ /// new verification method.
50+ ///
51+ /// - Important: To remove a verification method, include all existing verification methods except the
52+ /// verification method being removed.
53+ public let verificationMethods : [ String : String ] ? //VerificationMethod?
4054
41- /// The service endpoint recommended in the DID document. Optional.
42- public let service : ATService ?
55+ /// A dictionary of service endpoints to include in the DID document. Optional.
56+ /// - Important: To add a new service endpoint, include all existing service endpoints with the
57+ /// new service endpoint.
58+ ///
59+ /// - Important: To remove a service endpoint, include all existing service endpoints except the
60+ /// service endpoint being removed.
61+ public let services : [ String : PLCOperationATService ] ? //ATService?
62+
63+ public init ( token: String ? , rotationKeys: [ String ] ? , alsoKnownAs: [ String ] ? , verificationMethods: [ String : String ] ? , services: [ String : PLCOperationATService ] ? ) {
64+ self . token = token
65+ self . rotationKeys = rotationKeys
66+ self . alsoKnownAs = alsoKnownAs
67+ self . verificationMethods = verificationMethods
68+ self . services = services
69+ }
70+
71+ public func encode( to encoder: any Encoder ) throws {
72+ var container = encoder. container ( keyedBy: CodingKeys . self)
73+
74+ try container. encodeIfPresent ( self . token, forKey: . token)
75+ try container. encodeIfPresent ( self . rotationKeys, forKey: . rotationKeys)
76+ try container. encodeIfPresent ( self . alsoKnownAs, forKey: . alsoKnownAs)
77+ try container. encodeIfPresent ( self . verificationMethods, forKey: . verificationMethods)
78+ try container. encodeIfPresent ( self . services, forKey: . services)
79+ }
80+
81+ enum CodingKeys : String , CodingKey {
82+ case token
83+ case rotationKeys
84+ case alsoKnownAs
85+ case verificationMethods
86+ case services
87+ }
4388 }
4489
4590 /// An output model for signing a PLC operation to a DID document.
@@ -53,6 +98,77 @@ extension ComAtprotoLexicon.Identity {
5398 public struct SignPLCOperationOutput : Sendable , Codable {
5499
55100 /// A signed PLC operation.
56- public let operation : UnknownType
101+ public let operation : SignedPLCOperation
102+ }
103+
104+ /// Represents a service endpoint in a DID document in a PLC operation
105+ ///
106+ /// - SeeAlso: This is based on the PLC Directory [`CreatePlcOp`][plc].
107+ ///
108+ /// [plc]: https://web.plc.directory/api/redoc#operation/CreatePlcOp
109+ public struct PLCOperationATService : Sendable , Codable {
110+
111+ /// The type of service.
112+ public let type : String
113+
114+ /// The endpoint URL for the service, specifying the location of the service.
115+ public let serviceEndpointURI : String
116+
117+ public init ( type: String , serviceEndpointURI: String ) {
118+ self . type = type
119+ self . serviceEndpointURI = serviceEndpointURI
120+ }
121+
122+ public init ( from decoder: any Decoder ) throws {
123+ let container = try decoder. container ( keyedBy: CodingKeys . self)
124+
125+ self . type = try container. decode ( String . self, forKey: . type)
126+ self . serviceEndpointURI = try container. decode ( String . self, forKey: . serviceEndpointURI)
127+ }
128+
129+ public func encode( to encoder: any Encoder ) throws {
130+ var container = encoder. container ( keyedBy: CodingKeys . self)
131+
132+ try container. encode ( self . type, forKey: . type)
133+ try container. encode ( self . serviceEndpointURI, forKey: . serviceEndpointURI)
134+ }
135+
136+ enum CodingKeys : String , CodingKey {
137+ case type
138+ case serviceEndpointURI = " endpoint "
139+ }
140+ }
141+
142+ /// Represents a signed PLC operation response
143+ ///
144+ /// - Note: A signed PLC operation is returned in the response to calling
145+ /// [`com.atproto.identity.signPlcOperation`][github]
146+ ///
147+ /// - SeeAlso: This is based on the PLC Directory [`CreatePlcOp`][plc].
148+ ///
149+ /// [github]: https://github.com/bluesky-social/atproto/blob/main/lexicons/com/atproto/identity/signPlcOperation.json
150+ /// [plc]: https://web.plc.directory/api/redoc#operation/CreatePlcOp
151+ public struct SignedPLCOperation : Sendable , Codable {
152+
153+ /// The PLC operation type
154+ public let type : String
155+
156+ /// Ordered set (no duplicates) of cryptographic public keys in did:key format
157+ public let rotationKeys : [ String ]
158+
159+ /// Map (object) of application-specific cryptographic public keys in did:key format
160+ public let verificationMethods : [ String : String ]
161+
162+ /// Ordered set (no duplicates) of aliases and names for this account, in the form of URIs
163+ public let alsoKnownAs : [ String ]
164+
165+ /// Map (object) of application-specific service endpoints for this account
166+ public let services : [ String : PLCOperationATService ]
167+
168+ /// Strong reference (hash) of preceeding operation for this DID, in string CID format. Null for genesis operation
169+ public let prev : String
170+
171+ /// Cryptographic signature of this object, with base64 string encoding
172+ public let sig : String
57173 }
58174}
0 commit comments