apple / apple/swift-crypto

Add SecureEnclave stub

Open
#147 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Assembly
Stars
1.7k
Forks
223
Avg merge
1d 2h
Merged PRs (30d)
7

Description

### New API Proposal: SecureEnclave

#### Motivation:

Swift packages that use [CryptoKit's SecureEnclave module](https://developer.apple.com/documentation/cryptokit/secureenclave) (if it is available) cannot compile against Crypto, since Crypto does not define this module. All SecureEnclave operations have to be conditionally compiled in this case.

Since SecureEnclave has runtime detection (`SecureEnclave.isAvailable`), a stub of the SecureEnclave API that returns `false` for isAvailable (and throws for all operations) on non-macOS platforms would remove the need for conditional compilation.

One annoyance is that some functions in this API also take `LAContext` and `SecAccessControl` parameters. These can be left out, or the structures would have to be stubbed out too.

#### Importance:

Better compatibility with CryptoKit.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing CryptoKit's SecureEnclave API from the linked documentation and comparing it with the repository's existing cross-platform API structure. Define the supported stub surface, including whether LAContext and SecAccessControl are included. Done means non-macOS builds can import the module, isAvailable is false, and supported operations throw as specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cryptography, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.