-
Notifications
You must be signed in to change notification settings - Fork 26
add SMP support #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
add SMP support #20
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| JSONWebToken.xcodeproj/xcuserdata | ||
| .swiftpm/xcode/xcuserdata |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <Scheme | ||
| LastUpgradeVersion = "1140" | ||
| version = "1.3"> | ||
| <BuildAction | ||
| parallelizeBuildables = "YES" | ||
| buildImplicitDependencies = "YES"> | ||
| <BuildActionEntries> | ||
| <BuildActionEntry | ||
| buildForTesting = "YES" | ||
| buildForRunning = "YES" | ||
| buildForProfiling = "YES" | ||
| buildForArchiving = "YES" | ||
| buildForAnalyzing = "YES"> | ||
| <BuildableReference | ||
| BuildableIdentifier = "primary" | ||
| BlueprintIdentifier = "JSONWebToken" | ||
| BuildableName = "JSONWebToken" | ||
| BlueprintName = "JSONWebToken" | ||
| ReferencedContainer = "container:"> | ||
| </BuildableReference> | ||
| </BuildActionEntry> | ||
| </BuildActionEntries> | ||
| </BuildAction> | ||
| <TestAction | ||
| buildConfiguration = "Debug" | ||
| selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| shouldUseLaunchSchemeArgsEnv = "YES"> | ||
| <Testables> | ||
| </Testables> | ||
| </TestAction> | ||
| <LaunchAction | ||
| buildConfiguration = "Debug" | ||
| selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| launchStyle = "0" | ||
| useCustomWorkingDirectory = "NO" | ||
| ignoresPersistentStateOnLaunch = "NO" | ||
| debugDocumentVersioning = "YES" | ||
| debugServiceExtension = "internal" | ||
| allowLocationSimulation = "YES"> | ||
| </LaunchAction> | ||
| <ProfileAction | ||
| buildConfiguration = "Release" | ||
| shouldUseLaunchSchemeArgsEnv = "YES" | ||
| savedToolIdentifier = "" | ||
| useCustomWorkingDirectory = "NO" | ||
| debugDocumentVersioning = "YES"> | ||
| <MacroExpansion> | ||
| <BuildableReference | ||
| BuildableIdentifier = "primary" | ||
| BlueprintIdentifier = "JSONWebToken" | ||
| BuildableName = "JSONWebToken" | ||
| BlueprintName = "JSONWebToken" | ||
| ReferencedContainer = "container:"> | ||
| </BuildableReference> | ||
| </MacroExpansion> | ||
| </ProfileAction> | ||
| <AnalyzeAction | ||
| buildConfiguration = "Debug"> | ||
| </AnalyzeAction> | ||
| <ArchiveAction | ||
| buildConfiguration = "Release" | ||
| revealArchiveInOrganizer = "YES"> | ||
| </ArchiveAction> | ||
| </Scheme> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // swift-tools-version:5.2 | ||
| // The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
|
||
| import PackageDescription | ||
|
|
||
| let package = Package( | ||
| name: "JSONWebToken", | ||
| platforms: [ | ||
| .iOS(.v12), .tvOS(.v12) | ||
| ], | ||
| products: [ | ||
| // Products define the executables and libraries produced by a package, and make them visible to other packages. | ||
| .library( | ||
| name: "JSONWebToken", | ||
| targets: ["JSONWebToken"]), | ||
| ], | ||
| dependencies: [ | ||
| // Dependencies declare other packages that this package depends on. | ||
| // .package(url: /* package url */, from: "1.0.0"), | ||
| ], | ||
| 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 which this package depends on. | ||
| .target( | ||
| name: "JSONWebToken", | ||
| dependencies: []), | ||
| ] | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ import CryptoKit | |
|
|
||
| extension Data { | ||
| func sha(_ hashFunction: SignatureAlgorithm.HashFunction) -> Data { | ||
| if #available(iOSApplicationExtension 13.0, *) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a fairly significant change as it means this can no longer be used in an app extension (such as the share extension). Is that really necessary? |
||
| if #available(iOS 13.0, *) { | ||
| switch hashFunction { | ||
| case .sha256: return Data(SHA256.hash(data: self)) | ||
| case .sha384: return Data(SHA384.hash(data: self)) | ||
|
|
@@ -40,7 +40,7 @@ extension Data { | |
| } | ||
| } | ||
| func hmac(_ hashFunction: SignatureAlgorithm.HashFunction, secret: Data) -> Data { | ||
| if #available(iOSApplicationExtension 13.0, *) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a fairly significant change as it means this can no longer be used in an app extension (such as the share extension). Is that really necessary? |
||
| if #available(iOS 13.0, *) { | ||
| let key = SymmetricKey(data: secret) | ||
| switch hashFunction { | ||
| case .sha256: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you want to add the test target, in order for people to see how to use the package ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test target needs a container app with an entitlement because the library use a keychain hack to create keys, and I don't know how to do that with SPM.
I'm working on a solution without the keychain hack and CryptoKit and I'll add a test target on the package