// `capture.avatar` — a person's photograph, from this app into the store. // // | method | takes | answers | // |---|---|---| // | `capture.avatar` | a person, a PATH this app staged, its mime | the object key, and whose it is | // // **A method, not a tool.** No assistant may point a person at bytes: an // avatar is a file on the owner's own device, and `update_person` can only // ever REMOVE one (`avatarKey: null`). That asymmetry is the whole design — // setting a face means bytes, and bytes are the app's. // // **Not `capture.media` with a `kind`.** That method's own refusal says why: // an avatar "belongs to a record something else writes first, and this method // mints its own". A person is that record, so the photograph is a second // method the way a chat attachment is. import Foundation extension CottonMethod { /// `capture.avatar` — a square JPEG this app staged, into the media store, /// with the person's row updated to point at it. public static let captureAvatar = "capture.avatar" } /// `capture.avatar`'s request. public struct CaptureAvatarRequest: Encodable, Sendable { /// Whose face this is. Proved to exist in this workspace before a byte /// moves. public var personId: String /// An ABSOLUTE path inside this app's own container — the square the /// picker's photo was reduced to, never the original the picker handed /// over. Nothing below the boundary can read a file anywhere else. public var path: String public var mime: String public var filename: String? public init(personId: String, path: String, mime: String, filename: String? = nil) { self.personId = personId self.path = path self.mime = mime self.filename = filename } } /// What `capture.avatar` answers: the key the person's row now carries. public struct CaptureAvatarAnswer: Decodable, Sendable { public let key: String public let personId: String }