Skip to content

Commit 8c62aba

Browse files
authored
Adding specific checks for Apple Platforms (#718)
1 parent 829a2d5 commit 8c62aba

File tree

5 files changed

+65
-23
lines changed

5 files changed

+65
-23
lines changed

Sources/ZKP/Asymmetric.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ public extension P256K {
113113
/// - Parameter data: A raw representation of the key.
114114
/// - Parameter format: The key format, default is .compressed.
115115
/// - Throws: An error if the raw representation does not create a private key for signing.
116-
@available(macOS 13.3, *) public init(_ staticInt: UInt256, format: P256K.Format = .compressed) throws {
116+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
117+
public init(_ staticInt: UInt256, format: P256K.Format = .compressed) throws {
117118
self.baseKey = try PrivateKeyImplementation(dataRepresentation: staticInt.rawValue, format: format)
118119
}
119120

Sources/ZKP/UInt256.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public extension SIMDWordsInteger {
9595
/// exactly.
9696
///
9797
/// - Parameter source: An immutable arbitrary-precision signed integer.
98-
@available(macOS 13.3, *)
98+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
9999
init?(exactly source: StaticBigInt) {
100100
if source.signum() == 0 {
101101
self = .zero
@@ -114,7 +114,7 @@ public extension SIMDWordsInteger {
114114
/// truncating or sign extending its binary representation to fit this type.
115115
///
116116
/// - Parameter source: An immutable arbitrary-precision signed integer.
117-
@available(macOS 13.3, *)
117+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
118118
init(truncatingIfNeeded source: StaticBigInt) {
119119
var vector = Vector.zero
120120
for index in vector.indices {
@@ -401,7 +401,7 @@ public extension SIMDWordsInteger {
401401
//===----------------------------------------------------------------------===//
402402

403403
public extension SIMDWordsInteger {
404-
@available(macOS 13.3, *)
404+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
405405
init(integerLiteral source: StaticBigInt) {
406406
self = Self(exactly: source) ?? {
407407
preconditionFailure("integer overflow: '\(source)' as '\(Self.self)'")
@@ -813,7 +813,7 @@ private extension SIMDWrapper where Element == UInt {
813813

814814
/// A 128-bit signed integer, stored as a SIMD vector of words.
815815

816-
@frozen @available(macOS 13.3, *)
816+
@frozen @available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
817817
public struct Int128: SIMDWordsInteger, SignedInteger {
818818
public typealias Magnitude = UInt128
819819

@@ -837,11 +837,11 @@ public struct Int128: SIMDWordsInteger, SignedInteger {
837837

838838
/// A 128-bit unsigned integer, stored as a SIMD vector of words.
839839

840-
@frozen @available(macOS 13.3, *)
840+
@frozen @available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
841841
public struct UInt128: SIMDWordsInteger, UnsignedInteger {
842842
public typealias Magnitude = Self
843843

844-
@available(macOS 13.3, *)
844+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
845845
public typealias Stride = Int128
846846

847847
#if arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32) || arch(powerpc)
@@ -868,7 +868,7 @@ public struct UInt128: SIMDWordsInteger, UnsignedInteger {
868868

869869
/// A 256-bit signed integer, stored as a SIMD vector of words.
870870

871-
@frozen @available(macOS 13.3, *)
871+
@frozen @available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
872872
public struct Int256: SIMDWordsInteger, SignedInteger {
873873
public typealias Magnitude = UInt256
874874

@@ -892,7 +892,7 @@ public struct Int256: SIMDWordsInteger, SignedInteger {
892892

893893
/// A 256-bit unsigned integer, stored as a SIMD vector of words.
894894

895-
@frozen @available(macOS 13.3, *)
895+
@frozen @available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
896896
public struct UInt256: SIMDWordsInteger, UnsignedInteger {
897897
public typealias Magnitude = Self
898898

@@ -914,7 +914,7 @@ public struct UInt256: SIMDWordsInteger, UnsignedInteger {
914914
}
915915
}
916916

917-
@available(macOS 13.3, *)
917+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
918918
extension UInt256.Vector: Sequence {
919919
public func makeIterator() -> Iterator {
920920
Iterator(self)
@@ -941,7 +941,7 @@ extension UInt256.Vector: Sequence {
941941
}
942942
}
943943

944-
@available(macOS 13.3, *)
944+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
945945
extension UInt256: RawRepresentable {
946946
public typealias RawValue = Data
947947

Tests/ZKPTests/AsymmetricTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ struct AsymmetricTestSuite {
145145
}
146146

147147
@Test("Test UInt256")
148-
@available(macOS 13.3, *)
148+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
149149
func testUInt256() {
150150
let expectedPrivateKey: UInt256 = 0x7DA1_2CC3_9BB4_189A_C72D_34FC_2225_DF5C_F36A_AACD_CAC7_E5A4_3963_299B_C8D8_88ED
151151
let expectedPrivateKey2: UInt256 = 0x1BB5_FC86_3773_7549_414D_7F1B_82A5_C12D_234B_56DB_AC17_5E14_0F63_046A_EBA8_DF87

Tests/ZKPTests/UInt256Tests.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ final class SIMDWordsIntegerTests: Base {
126126

127127
//===----------------------------------------------------------------------===//
128128

129-
@available(macOS 13.3, *)
129+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
130130
extension SIMDWordsIntegerTests {
131131
func testAddition<T: FixedWidthInteger>(_: T.Type) {
132132
expectEqual(T.zero, T.zero + T.zero)
@@ -233,7 +233,7 @@ extension SIMDWordsIntegerTests {
233233

234234
//===----------------------------------------------------------------------===//
235235

236-
@available(macOS 13.3, *)
236+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
237237
extension SIMDWordsIntegerTests {
238238
func testBitCounting<T: FixedWidthInteger>(_: T.Type) {
239239
typealias Element = (
@@ -289,7 +289,7 @@ extension SIMDWordsIntegerTests {
289289

290290
//===----------------------------------------------------------------------===//
291291

292-
@available(macOS 13.3, *)
292+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
293293
extension SIMDWordsIntegerTests {
294294
func testBitShifting<T: FixedWidthInteger>(_: T.Type) {
295295
expectEqual(T.min, T.min &<< T.zero)
@@ -376,7 +376,7 @@ extension SIMDWordsIntegerTests {
376376

377377
//===----------------------------------------------------------------------===//
378378

379-
@available(macOS 13.3, *)
379+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
380380
extension SIMDWordsIntegerTests {
381381
func testBitTwiddling<T: FixedWidthInteger>(_: T.Type) {
382382
expectEqual(T.max, ~.min)
@@ -411,7 +411,7 @@ extension SIMDWordsIntegerTests {
411411

412412
//===----------------------------------------------------------------------===//
413413

414-
@available(macOS 13.3, *)
414+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
415415
extension SIMDWordsIntegerTests {
416416
func testByteSwapping<T: FixedWidthInteger>(_: T.Type) {
417417
typealias Element = (lhs: T, rhs: T)
@@ -467,7 +467,7 @@ extension SIMDWordsIntegerTests {
467467

468468
//===----------------------------------------------------------------------===//
469469

470-
@available(macOS 13.3, *)
470+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
471471
extension SIMDWordsIntegerTests {
472472
func testMultiplication<T: FixedWidthInteger>(_: T.Type) {
473473
let identity: T = 1
@@ -566,7 +566,7 @@ extension SIMDWordsIntegerTests {
566566

567567
//===----------------------------------------------------------------------===//
568568

569-
@available(macOS 13.3, *)
569+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
570570
extension SIMDWordsIntegerTests {
571571
func testReflection<T: FixedWidthInteger>(_: T.Type) {
572572
typealias Element = (actual: T, expected: String)
@@ -611,7 +611,7 @@ extension SIMDWordsIntegerTests {
611611

612612
//===----------------------------------------------------------------------===//
613613

614-
@available(macOS 13.3, *)
614+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
615615
extension SIMDWordsIntegerTests {
616616
func testSemantics<T: FixedWidthInteger>(_: T.Type) {
617617
typealias Element = (value: T, distance: T.Stride)
@@ -690,7 +690,7 @@ extension SIMDWordsIntegerTests {
690690

691691
//===----------------------------------------------------------------------===//
692692

693-
@available(macOS 13.3, *)
693+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
694694
extension SIMDWordsIntegerTests {
695695
func testSubtraction<T: FixedWidthInteger>(_: T.Type) {
696696
expectEqual(T.zero, T.zero - T.zero)
@@ -793,7 +793,7 @@ extension SIMDWordsIntegerTests {
793793

794794
//===----------------------------------------------------------------------===//
795795

796-
@available(macOS 13.3, *)
796+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
797797
extension SIMDWordsIntegerTests {
798798
func testTypeProperties() {
799799
expectEqual(128, Int128.bitWidth)
@@ -813,7 +813,7 @@ extension SIMDWordsIntegerTests {
813813

814814
//===----------------------------------------------------------------------===//
815815

816-
@available(macOS 13.3, *)
816+
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, macCatalyst 16.4, visionOS 1.0, *)
817817
extension SIMDWordsIntegerTests {
818818
func testWords<T: FixedWidthInteger>(_: T.Type) {
819819
if T.isSigned {

bitrise.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,47 @@ workflows:
5252
echo "$broken_links"
5353
exit 1
5454
fi
55+
- script:
56+
title: CHECK iOS
57+
timeout: 60
58+
inputs:
59+
- content: |-
60+
#!/usr/bin/env bash
61+
# fail if any commands fails; debug log
62+
set -ex
63+
64+
xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme swift-secp256k1-Package -destination generic/platform=iOS
65+
- script:
66+
title: CHECK tvOS
67+
timeout: 60
68+
inputs:
69+
- content: |-
70+
#!/usr/bin/env bash
71+
# fail if any commands fails; debug log
72+
set -ex
73+
74+
xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme swift-secp256k1-Package -destination generic/platform=tvOS
75+
- script:
76+
title: CHECK watchOS
77+
timeout: 60
78+
inputs:
79+
- content: |-
80+
#!/usr/bin/env bash
81+
# fail if any commands fails; debug log
82+
set -ex
83+
84+
xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme swift-secp256k1-Package -destination generic/platform=watchOS
85+
- script:
86+
title: CHECK visionOS
87+
run_if: false
88+
timeout: 60
89+
inputs:
90+
- content: |-
91+
#!/usr/bin/env bash
92+
# fail if any commands fails; debug log
93+
set -ex
94+
95+
xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme swift-secp256k1-Package -destination generic/platform=visionOS
5596
- deploy-to-bitrise-io:
5697
inputs:
5798
- pipeline_intermediate_files: "$BITRISE_SOURCE_DIR:BITRISE_SOURCE_DIR"

0 commit comments

Comments
 (0)