Version 3
This commit is contained in:
@@ -1,28 +1,33 @@
|
||||
import Foundation
|
||||
|
||||
/// A protocol that defines the required properties for a keychain service descriptor.
|
||||
/// A type that describes a keychain service used to group and identify stored items.
|
||||
///
|
||||
/// Types conforming to this protocol provide an identifier used to distinguish stored items
|
||||
/// and may optionally specify an access group to enable keychain sharing between apps.
|
||||
public protocol KeychainServiceProtocol {
|
||||
/// A unique string used to identify the keychain service.
|
||||
/// Conforming types define a unique service identifier and may optionally specify an access group
|
||||
/// for sharing keychain data between multiple apps or extensions.
|
||||
///
|
||||
/// ## Topics
|
||||
///
|
||||
/// ### Properties
|
||||
///
|
||||
/// - ``identifier``
|
||||
/// - ``accessGroup``
|
||||
public protocol KeychainServiceProtocol: Sendable {
|
||||
/// A unique string that identifies the keychain service.
|
||||
var identifier: String { get }
|
||||
|
||||
/// An optional keychain access group identifier to support shared access between apps.
|
||||
|
||||
/// An optional keychain access group identifier that enables shared access between apps.
|
||||
///
|
||||
/// The default implementation returns `nil`, indicating no access group is specified.
|
||||
/// Defaults to `nil`, meaning no access group is specified.
|
||||
var accessGroup: String? { get }
|
||||
}
|
||||
|
||||
public extension KeychainServiceProtocol {
|
||||
/// The default implementation returns `nil`, indicating that no access group is specified.
|
||||
var accessGroup: String? { nil }
|
||||
}
|
||||
|
||||
public extension KeychainServiceProtocol where Self: RawRepresentable, Self.RawValue == String {
|
||||
/// Provides a default `identifier` implementation for `RawRepresentable` types
|
||||
/// whose `RawValue` is `String`.
|
||||
/// A unique string that identifies the keychain service.
|
||||
///
|
||||
/// The `identifier` is derived from the raw string value.
|
||||
/// Derived from the instance’s raw string value.
|
||||
var identifier: String { rawValue }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user