Skip to content

Commit

Permalink
Add hashedDefaultUser property (#180)
Browse files Browse the repository at this point in the history
This allows customers to access the hashed version of the user string they’ve set, in order to hand it over to other SDKs or webhooks.
  • Loading branch information
winsmith authored Aug 21, 2024
1 parent 22f36ce commit eba444d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/TelemetryClient/TelemetryClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ public final class TelemetryManager: @unchecked Sendable {
configuration.defaultUser = newDefaultUser
}

public var hashedDefaultUser: String? {
guard let defaultUser = configuration.defaultUser else { return nil }
return CryptoHashing.sha256(string: defaultUser, salt: configuration.salt)
}

/// Generate a new Session ID for all new Signals, in order to begin a new session instead of continuing the old one.
@available(*, deprecated, renamed: "TelemetryDeck.generateNewSession()", message: "This call was renamed to `TelemetryDeck.generateNewSession()`. Please migrate – a fix-it is available.")
public static func generateNewSession() {
Expand Down

0 comments on commit eba444d

Please sign in to comment.