Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
signalapp
GitHub Repository: signalapp/Signal-iOS
Path: blob/main/SignalServiceKit/Usernames/UsernameLookupRecord.swift
1 views
//
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//

public import GRDB
import LibSignalClient

/// A point-in-time result of performing a lookup for a given username.
///
/// At the time this record was created, the contained username was
/// associated with the contained ACI. Note that this may have since changed,
/// and that therefore we should not assume the association is still valid.
public struct UsernameLookupRecord: Codable, FetchableRecord, PersistableRecord {
    public static let databaseTableName: String = "UsernameLookupRecord"

    public enum CodingKeys: String, CodingKey, ColumnExpression, CaseIterable {
        case aci
        case username
    }

    public let aci: UUID
    public let username: String

    init(aci: Aci, username: String) {
        self.aci = aci.rawUUID
        self.username = username
    }
}