Skip to content

Commit

Permalink
Merge pull request #14 from trilemma-dev/blessed-error
Browse files Browse the repository at this point in the history
Introduces `BlessError` to provide detailed error explanation
  • Loading branch information
jakaplan authored Jun 20, 2022
2 parents 395c49c + 714e149 commit 50e98c0
Show file tree
Hide file tree
Showing 6 changed files with 575 additions and 90 deletions.
5 changes: 3 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ let package = Package(
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/trilemma-dev/EmbeddedPropertyList.git", from: "2.0.2"),
.package(url: "https://github.com/trilemma-dev/Required.git", from: "0.1.1"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "Blessed",
dependencies: []),
dependencies: ["EmbeddedPropertyList", "Required"]),
.testTarget(
name: "BlessedTests",
dependencies: ["Blessed"]),
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ try LaunchdManager.authorizeAndBless(message: message, icon: icon)
Both the `message` and `icon` parameters are optional. Defaults will be provided by macOS if they are not specified.

On macOS 10.15 and later this functionality is also available as an `async` variant which will not block while waiting
for a user to grant (or decline) authorization.
for a user to grant (or decline) authorization.

One of the most challenging aspects of using `SMJobBless` is that when it fails, it can be very hard to determine _why_.
To assist your debugging of such situations, this package throws a `BlessError` which provides a detailed explanation
for each bless requirement which was not met.

To see a runnable sample app using this framework, check out
[SwiftAuthorizationSample](https://github.com/trilemma-dev/SwiftAuthorizationSample) which also makes use of [SecureXPC](https://github.com/trilemma-dev/SecureXPC/) for secure interprocess communication.
[SwiftAuthorizationSample](https://github.com/trilemma-dev/SwiftAuthorizationSample) which also makes use of
[SecureXPC](https://github.com/trilemma-dev/SecureXPC/) for secure interprocess communication.

[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Ftrilemma-dev%2FBlessed%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/trilemma-dev/Blessed)

Expand Down Expand Up @@ -44,7 +49,8 @@ macOS's authorization system is built around the concept of rights. The Policy D
the rights on the system and your application can add its own.

If an application defines its own rights it can then use these to self-restrict functionality. For details on *why* you
might want to do see, consider reading Apple's [Technical Note TN2095: Authorization for Everyone](https://developer.apple.com/library/archive/technotes/tn2095/_index.html#//apple_ref/doc/uid/DTS10003110)
might want to do see, consider reading Apple's
[Technical Note TN2095: Authorization for Everyone](https://developer.apple.com/library/archive/technotes/tn2095/_index.html#//apple_ref/doc/uid/DTS10003110)
although keep in mind the code samples shown are not applicable if you are using this Swift implementation.

To define a custom right:
Expand Down
Loading

0 comments on commit 50e98c0

Please sign in to comment.