UriParser

public final class UriParser : Sendable

Base class for URI parsers with common functionality.

Common Parameters

  • Declaration

    Swift

    public static let mfauthScheme: String
  • Declaration

    Swift

    public static let issuerParam: String
  • Declaration

    Swift

    public static let userIdParam: String
  • Declaration

    Swift

    public static let userIdParamOath: String
  • Declaration

    Swift

    public static let imageUrlParam: String
  • Declaration

    Swift

    public static let backgroundColorParam: String
  • Declaration

    Swift

    public static let policiesParam: String
  • Declaration

    Swift

    public init()

Label Parsing

  • Parses the issuer and account name from the label component of a URI.

    Throws

    UriParseError.issuerMismatch if the issuer parameter doesn’t match the label issuer.

    Declaration

    Swift

    public func parseLabelComponents(_ label: String, issuerParam: String?) throws -> (issuer: String, accountName: String)

    Parameters

    label

    The label from the URI path (format: “Issuer:AccountName”).

    issuerParam

    The issuer from the URI query parameter (optional).

    Return Value

    A tuple containing the issuer and account name.

Helper Methods

  • Formats the background color for URI inclusion by removing the “#” prefix if present.

    Declaration

    Swift

    public func formatBackgroundColor(_ backgroundColor: String?) -> String?

    Parameters

    backgroundColor

    The background color string to format.

    Return Value

    The formatted background color value, or nil if input is nil.