Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions Sources/Valet/Internal/Service.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import Foundation
enum Service: CustomStringConvertible, Equatable, Sendable {
case standard(Identifier, Configuration)
case sharedGroup(SharedGroupIdentifier, Identifier?, Configuration)
case standardOverride(service: Identifier, Configuration)
case sharedGroupOverride(service: SharedGroupIdentifier, Configuration)
case standardOverride(Identifier, Configuration)
case sharedGroupOverride(SharedGroupIdentifier, Identifier?, Configuration)

// MARK: Equatable

Expand Down Expand Up @@ -49,10 +49,6 @@ enum Service: CustomStringConvertible, Equatable, Sendable {
}
}

static func sharedGroup(with configuration: Configuration, explicitlySetIdentifier identifier: Identifier, accessibilityDescription: String) -> String {
"VAL_\(configuration.description)_initWithSharedAccessGroupIdentifier:accessibility:_\(identifier)_\(accessibilityDescription)"
}
Comment on lines -52 to -54
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previously it was possible to have an explicitly set identifier that was not a shared group identifier. it looks like we've removed that ability? is this a breaking change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not a public API. As far as I can see, this was effectively dead code. It was only referenced by the migration path from v3 Valets, and shared group Valets with explicitly set identifiers did not exist in v3.


// MARK: Internal Methods

func generateBaseQuery() -> [String : AnyHashable] {
Expand All @@ -77,8 +73,8 @@ enum Service: CustomStringConvertible, Equatable, Sendable {
case let .standardOverride(_, desiredConfiguration):
configuration = desiredConfiguration

case let .sharedGroupOverride(identifier, desiredConfiguration):
baseQuery[kSecAttrAccessGroup as String] = identifier.description
case let .sharedGroupOverride(groupIdentifier, _, desiredConfiguration):
baseQuery[kSecAttrAccessGroup as String] = groupIdentifier.description
configuration = desiredConfiguration
}

Expand Down Expand Up @@ -110,8 +106,8 @@ enum Service: CustomStringConvertible, Equatable, Sendable {
service = Service.sharedGroup(with: configuration, groupIdentifier: groupIdentifier, identifier: identifier, accessibilityDescription: configuration.accessibility.description)
case let .standardOverride(identifier, _):
service = identifier.description
case let .sharedGroupOverride(identifier, _):
service = identifier.groupIdentifier
case let .sharedGroupOverride(groupIdentifier, identifier, _):
service = identifier?.description ?? groupIdentifier.groupIdentifier
}

switch self {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Valet/SecureEnclave.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public final class SecureEnclave: Sendable {
noPromptValet = .valet(with: identifier, accessibility: .whenPasscodeSetThisDeviceOnly)
case let .standard(identifier, _):
noPromptValet = .valet(with: identifier, accessibility: .whenPasscodeSetThisDeviceOnly)
case let .sharedGroupOverride(identifier, _):
noPromptValet = .sharedGroupValet(withExplicitlySet: identifier, accessibility: .whenPasscodeSetThisDeviceOnly)
case let .sharedGroupOverride(groupIdentifier, identifier, _):
noPromptValet = .sharedGroupValet(withExplicitlySet: groupIdentifier, identifier: identifier, accessibility: .whenPasscodeSetThisDeviceOnly)
case let .sharedGroup(groupIdentifier, identifier, _):
noPromptValet = .sharedGroupValet(with: groupIdentifier, identifier: identifier, accessibility: .whenPasscodeSetThisDeviceOnly)
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Valet/SecureEnclaveValet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,8 @@ extension Service {
.sharedGroup(sharedGroupIdentifier, identifier, .singlePromptSecureEnclave(accessControl))
case let .standardOverride(identifier, _):
.standard(identifier, .singlePromptSecureEnclave(accessControl))
case let .sharedGroupOverride(sharedGroupIdentifier, _):
.sharedGroupOverride(service: sharedGroupIdentifier, .singlePromptSecureEnclave(accessControl))
case let .sharedGroupOverride(sharedGroupIdentifier, identifier, _):
.sharedGroupOverride(sharedGroupIdentifier, identifier, .singlePromptSecureEnclave(accessControl))
}
}
}
Expand Down
Loading