Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
2.5 kB · 74 lines
Swift
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475//// UserSessionModel.swift// shortcut//// Created by Bailey Townsend on 6/25/25.//
import ATProtoKitimport Foundationimport SwiftData
@Modelclass UserSessionModel {
@Attribute(.unique) public var id: UUID
/// The user's handle within the AT Protocol. public var handle: String
/// The decentralized identifier (DID), serving as a persistent and long-term account /// identifier according to the W3C standard. public var sessionDID: String
/// The user's email address. Optional. public var email: String?
/// Indicates whether the user's email address has been confirmed. Optional. public var isEmailConfirmed: Bool?
/// Indicates whether Two-Factor Authentication (via email) is enabled. Optional. public var isEmailAuthenticationFactorEnabled: Bool?
/// The DID document associated with the user, which contains AT Protocol-specific /// information. Optional. // public var didDocument: DIDDocument?
/// Indicates whether the user account is active. Optional. public var isActive: Bool?
/// Indicates the possible reason for why the user account is inactive. Optional. public var status: UserAccountStatus?
/// The user account's endpoint used for sending authentication requests. public var serviceEndpoint: URL
/// The URL of the Personal Data Server (PDS) associated with the user. Optional. /// /// - Note: This is not included when initalizing `UserSession`. Instead, it's added /// after the successful initalizing. public var pdsURL: String?
/// The URL of the user's profile picture. Optional since it is not part of the user session response. public var profilePicture: URL?
public init( sessionId: UUID, handle: String, sessionDID: String, email: String? = nil, isEmailConfirmed: Bool? = nil, isEmailAuthenticationFactorEnabled: Bool? = nil, isActive: Bool? = nil, status: UserAccountStatus? = nil, serviceEndpoint: URL, pdsURL: String? = nil ) { self.id = sessionId self.handle = handle self.sessionDID = sessionDID self.email = email self.isEmailConfirmed = isEmailConfirmed self.isEmailAuthenticationFactorEnabled = isEmailAuthenticationFactorEnabled // self.didDocument = didDocument self.isActive = isActive self.status = status self.serviceEndpoint = serviceEndpoint self.pdsURL = pdsURL }}