Skip to content
Merged
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
8 changes: 4 additions & 4 deletions packages/apple-targets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,19 @@ Ideally, this would be generated automatically based on a fully qualified Xcode
| virtual-conference | Virtual Conference Provider |
| shield-action | Shield Action Extension |
| shield-config | Shield Configuration Extension |
| print-service | Print Service Extension |
| smart-card | Smart Card / Persistent Token |
| authentication-services | Authentication Services Extension |


<!-- | imessage | iMessage Extension | -->

### Not yet supported

The following iOS extension types exist in Xcode but aren't supported yet. Contributions welcome! See `docs/xcode-target-discovery.md` for details on how these were discovered.
The following extension types exist in Xcode but aren't supported yet. Contributions welcome! See `docs/xcode-target-discovery.md` for details on how these were discovered.

| Extension Point Identifier | Xcode Template Name |
| --- | --- |
| `com.apple.printing.discovery` | Print Service Extension |
| `com.apple.ctk-tokens` | Smart Card / Persistent Token Extension |
| `com.apple.AppSSO.idp-extension` | Authentication Services Extension |
| `com.apple.tv-top-shelf` | TV Top Shelf Extension (tvOS) |
| `com.apple.FinderSync` | Finder Sync Extension (macOS) |
| `com.apple.email.extension` | Mail Extension (macOS) |
Expand Down
7 changes: 7 additions & 0 deletions packages/apple-targets/e2e/__tests__/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ const TARGET_REGISTRY: TargetEntry[] = [
},
{ type: "shield-action", dir: "shield-action", target: "shieldaction" },
{ type: "shield-config", dir: "shield-config", target: "shieldconfig" },
{ type: "print-service", dir: "print-service", target: "printservice" },
{ type: "smart-card", dir: "smart-card", target: "smartcard" },
{
type: "authentication-services",
dir: "authentication-services",
target: "authenticationservices",
},
];

// Derived from the central TARGET_REGISTRY — no need to maintain by hand.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "type": "authentication-services" }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "type": "print-service" }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "type": "smart-card" }
7 changes: 5 additions & 2 deletions packages/apple-targets/src/configuration-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export type XcodeSettings = {

export type DeviceFamily = "phone" | "tablet";

function createNotificationContentConfigurationList({
function createDefaultConfigurationList({
name,
displayName,
cwd,
Expand Down Expand Up @@ -818,7 +818,10 @@ function getConfigurationListBuildSettingsForType(
case "virtual-conference":
case "shield-action":
case "shield-config":
return createNotificationContentConfigurationList(props);
case "print-service":
case "smart-card":
case "authentication-services":
return createDefaultConfigurationList(props);
default:
const exhaustiveCheck: never = props.type;
throw new Error(`Unhandled case: ${exhaustiveCheck}`);
Expand Down
40 changes: 40 additions & 0 deletions packages/apple-targets/src/target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,22 @@ export const TARGET_REGISTRY = {
frameworks: ["ManagedSettings", "ManagedSettingsUI"],
displayName: "Shield Configuration",
},
"print-service": {
extensionPointIdentifier: "com.apple.printing.discovery",
displayName: "Print Service",
},
"smart-card": {
extensionPointIdentifier: "com.apple.ctk-tokens",
frameworks: ["CryptoTokenKit"],
displayName: "Smart Card",
description: "Persistent token / smart card extension",
},
"authentication-services": {
extensionPointIdentifier: "com.apple.AppSSO.idp-extension",
frameworks: ["AuthenticationServices"],
displayName: "Authentication Services",
description: "Single sign-on extension",
},
} as const satisfies Record<string, TargetDefinition>;

export type ExtensionType = keyof typeof TARGET_REGISTRY;
Expand Down Expand Up @@ -665,6 +681,30 @@ export function getTargetInfoPlistForType(type: ExtensionType) {
"$(PRODUCT_MODULE_NAME).ShieldConfigurationExtension",
},
};
case "print-service":
return {
NSExtension: {
NSExtensionPointIdentifier,
NSExtensionPrincipalClass:
"$(PRODUCT_MODULE_NAME).PrintServiceExtension",
},
};
case "smart-card":
return {
NSExtension: {
NSExtensionPointIdentifier,
NSExtensionPrincipalClass:
"$(PRODUCT_MODULE_NAME).TokenExtension",
},
};
case "authentication-services":
return {
NSExtension: {
NSExtensionPointIdentifier,
NSExtensionPrincipalClass:
"$(PRODUCT_MODULE_NAME).AuthenticationExtension",
},
};
default:
// Default: used for widget and bg-download
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ module.exports = config => ({
});"
`;

exports[`getTemplateConfig should return a valid template for authentication-services 1`] = `
"/** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
module.exports = config => ({
type: \\"authentication-services\\",
entitlements: { /* Add entitlements */ },
});"
`;

exports[`getTemplateConfig should return a valid template for bg-download 1`] = `
"/** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
module.exports = config => ({
Expand Down Expand Up @@ -163,6 +171,14 @@ module.exports = config => ({
});"
`;

exports[`getTemplateConfig should return a valid template for print-service 1`] = `
"/** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
module.exports = config => ({
type: \\"print-service\\",
entitlements: { /* Add entitlements */ },
});"
`;

exports[`getTemplateConfig should return a valid template for quicklook-preview 1`] = `
"/** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
module.exports = config => ({
Expand Down Expand Up @@ -214,6 +230,14 @@ module.exports = config => ({
});"
`;

exports[`getTemplateConfig should return a valid template for smart-card 1`] = `
"/** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
module.exports = config => ({
type: \\"smart-card\\",
entitlements: { /* Add entitlements */ },
});"
`;

exports[`getTemplateConfig should return a valid template for spotlight 1`] = `
"/** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
module.exports = config => ({
Expand Down
3 changes: 3 additions & 0 deletions packages/create-target/src/__tests__/createAsync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ const ALL_TARGET_TYPES = [
"virtual-conference",
"shield-action",
"shield-config",
"print-service",
"smart-card",
"authentication-services",
];

describe(getTemplateConfig, () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import AuthenticationServices

class AuthenticationExtension: NSObject, ASAuthorizationProviderExtensionAuthorizationRequestHandler {

func beginAuthorization(with request: ASAuthorizationProviderExtensionAuthorizationRequest) {
request.doNotHandle()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

class PrintServiceExtension: NSObject {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import CryptoTokenKit

class TokenExtension: TKSmartCardTokenDriver {

}