Keep the limiter fallback key as Data so the relay builds on Linux
SymmetricKey is not Sendable under swift-crypto on Linux, so a static of that type is a hard error there (CI build job), while macOS CryptoKit lets it through. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
dd0d4e6674
commit
5ac0041784
@@ -293,13 +293,15 @@ struct HandleCertificate: Content, Equatable {
|
||||
/// random per process, which only means per-replica counters on a relay
|
||||
/// configured with neither.
|
||||
enum LimiterKeys {
|
||||
private static let fallback = SymmetricKey(size: .bits256)
|
||||
// Held as Data: SymmetricKey is not Sendable on Linux, so a static of that
|
||||
// type fails to compile there (macOS builds do not catch it).
|
||||
private static let fallbackBytes: Data = SymmetricKey(size: .bits256).withUnsafeBytes { Data($0) }
|
||||
|
||||
static func secret(_ config: Config) -> SymmetricKey {
|
||||
if let seed = config.issuerSigningKeyRaw ?? config.federationKeyRaw, !seed.isEmpty {
|
||||
return SymmetricKey(data: SHA256.hash(data: seed + Data("limiter-keys".utf8)))
|
||||
}
|
||||
return fallback
|
||||
return SymmetricKey(data: fallbackBytes)
|
||||
}
|
||||
|
||||
/// 16 hex characters standing for `parts`.
|
||||
|
||||
Reference in New Issue
Block a user