Skip to content
Closed
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Breaking Changes

- Bumped minimum macOS version from 10.14.0 to 10.15.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h: We can not do this due to #6758

Copy link
Contributor Author

@antonis antonis Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback. Given that the CryptoKit API is not available I suggest to close the PR. I've also added the Blocked label

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use it for newer macOS versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can conditionally use CryptoKit and fallback to CommonCrypto when not available.
I think this would make things more complicated though and beat the purpose of using a simpler Swift friendly syntax.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is not clear advantage to conditionally use CryptoKit let's not do this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good 👍
I'm closing this PR. We can revisit it when bumping macos is possible.


## 9.1.0

> [!Warning]
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ var targets: [Target] = [

let package = Package(
name: "Sentry",
platforms: [.iOS(.v15), .macOS(.v10_14), .tvOS(.v15), .watchOS(.v8), .visionOS(.v1)],
platforms: [.iOS(.v15), .macOS(.v10_15), .tvOS(.v15), .watchOS(.v8), .visionOS(.v1)],
products: products,
targets: targets,
swiftLanguageModes: [.v5],
Expand Down
2 changes: 1 addition & 1 deletion Sources/Configuration/DeploymentTargets.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MACOSX_DEPLOYMENT_TARGET = 10.14
MACOSX_DEPLOYMENT_TARGET = 10.15
IPHONEOS_DEPLOYMENT_TARGET = 15.0
TVOS_DEPLOYMENT_TARGET = 15.0
WATCHOS_DEPLOYMENT_TARGET = 8.0
Expand Down
2 changes: 1 addition & 1 deletion Sources/Configuration/SentrySwiftUI.xcconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PRODUCT_NAME = SentrySwiftUI
CURRENT_PROJECT_VERSION = 9.1.0

MACOSX_DEPLOYMENT_TARGET = 10.14
MACOSX_DEPLOYMENT_TARGET = 10.15
IPHONEOS_DEPLOYMENT_TARGET = 15.0
WATCHOS_DEPLOYMENT_TARGET = 8.0
TVOS_DEPLOYMENT_TARGET = 15.0
Expand Down
11 changes: 3 additions & 8 deletions Sources/Swift/SentryDsn.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
@_implementationOnly import _SentryPrivate
import CryptoKit
import Foundation

import CommonCrypto

/// Represents a Sentry Data Source Name (DSN) which identifies a Sentry project.
@objc(SentryDsn)
public final class SentryDsn: NSObject {
Expand Down Expand Up @@ -78,12 +77,8 @@ public final class SentryDsn: NSObject {
data = Data()
}

var digest = [UInt8](repeating: 0, count: Int(CC_SHA1_DIGEST_LENGTH))
data.withUnsafeBytes { bytes in
_ = CC_SHA1(bytes.baseAddress, CC_LONG(data.count), &digest)
}

return digest.map { String(format: "%02x", $0) }.joined()
let hash = Insecure.SHA1.hash(data: data)
return hash.map { String(format: "%02x", $0) }.joined()
}

/// Returns the envelope endpoint URL for this DSN.
Expand Down
42 changes: 42 additions & 0 deletions Tests/SentryTests/Networking/SentryDsnTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,46 @@ - (void)testGetEnvelopeDsnCachesResult
XCTAssertTrue([dsn getEnvelopeEndpoint] == [dsn getEnvelopeEndpoint]);
}

- (void)testGetHash_ReturnsSHA1Hash
{
SentryDsn *dsn = [[SentryDsn alloc] initWithString:@"https://username:password@getsentry.net/1"
didFailWithError:nil];

NSString *hash = [dsn getHash];

XCTAssertNotNil(hash);
XCTAssertEqual(hash.length, 40, @"SHA1 hash should be 40 characters");

NSCharacterSet *hexCharacterSet =
[NSCharacterSet characterSetWithCharactersInString:@"0123456789abcdef"];
NSCharacterSet *hashCharacterSet = [NSCharacterSet characterSetWithCharactersInString:hash];
XCTAssertTrue([hexCharacterSet isSupersetOfSet:hashCharacterSet],
@"Hash should only contain hexadecimal characters");
}

- (void)testGetHash_IsConsistent
{
NSString *dsnString = @"https://username:password@getsentry.net/1";
SentryDsn *dsn1 = [[SentryDsn alloc] initWithString:dsnString didFailWithError:nil];
SentryDsn *dsn2 = [[SentryDsn alloc] initWithString:dsnString didFailWithError:nil];

NSString *hash1 = [dsn1 getHash];
NSString *hash2 = [dsn2 getHash];

XCTAssertEqualObjects(hash1, hash2, @"Same DSN should produce the same hash");
}

- (void)testGetHash_DifferentDsnProducesDifferentHash
{
SentryDsn *dsn1 = [[SentryDsn alloc] initWithString:@"https://user1:pass1@getsentry.net/1"
didFailWithError:nil];
SentryDsn *dsn2 = [[SentryDsn alloc] initWithString:@"https://user2:pass2@getsentry.net/2"
didFailWithError:nil];

NSString *hash1 = [dsn1 getHash];
NSString *hash2 = [dsn2 getHash];

XCTAssertNotEqualObjects(hash1, hash2, @"Different DSNs should produce different hashes");
}

@end
12 changes: 6 additions & 6 deletions sdk_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -30755,22 +30755,22 @@
},
{
"kind": "Import",
"name": "CommonCrypto",
"printedName": "CommonCrypto",
"name": "CoreGraphics",
"printedName": "CoreGraphics",
"declKind": "Import",
"moduleName": "Sentry"
},
{
"kind": "Import",
"name": "CoreGraphics",
"printedName": "CoreGraphics",
"name": "CoreMedia",
"printedName": "CoreMedia",
"declKind": "Import",
"moduleName": "Sentry"
},
{
"kind": "Import",
"name": "CoreMedia",
"printedName": "CoreMedia",
"name": "CryptoKit",
"printedName": "CryptoKit",
"declKind": "Import",
"moduleName": "Sentry"
},
Expand Down
Loading