mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-09-23 17:30:48 +02:00
Remove HMAC salt from public release
This commit is contained in:
@@ -2,7 +2,7 @@ import Foundation
|
|||||||
import CryptoKit
|
import CryptoKit
|
||||||
import SGLogging
|
import SGLogging
|
||||||
|
|
||||||
private let HMAC_SALT = "glegram-hmac-v1"
|
private let HMAC_SALT = "YOUR_HMAC_SALT"
|
||||||
private let TS_MAX_AGE_SEC = 300
|
private let TS_MAX_AGE_SEC = 300
|
||||||
|
|
||||||
/// AES-256-GCM + HMAC-SHA256 (anti-tampering, replay protection).
|
/// AES-256-GCM + HMAC-SHA256 (anti-tampering, replay protection).
|
||||||
@@ -24,7 +24,7 @@ enum SupportersCrypto {
|
|||||||
SymmetricKey(data: normalizeKeyData(key))
|
SymmetricKey(data: normalizeKeyData(key))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Derive HMAC key: HMAC-SHA256(master_key, "glegram-hmac-v1").
|
/// Derive HMAC key: HMAC-SHA256(master_key, "HMAC salt string").
|
||||||
private static func deriveHmacKey(from masterKey: Data) -> SymmetricKey {
|
private static func deriveHmacKey(from masterKey: Data) -> SymmetricKey {
|
||||||
let key = SymmetricKey(data: masterKey)
|
let key = SymmetricKey(data: masterKey)
|
||||||
let salt = Data(Array(HMAC_SALT.utf8))
|
let salt = Data(Array(HMAC_SALT.utf8))
|
||||||
|
|||||||
@@ -26,8 +26,20 @@ if grep -rq "F8A8NWPL78" . --include="*.swift" --include="*.json" --include="*.b
|
|||||||
FOUND=1
|
FOUND=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# HMAC salt
|
||||||
|
if grep -rq "glegram-hmac-v1" . --include="*.swift" 2>/dev/null; then
|
||||||
|
echo "FAIL: HMAC salt found!"
|
||||||
|
FOUND=1
|
||||||
|
fi
|
||||||
|
|
||||||
# SSL pinning hashes
|
# SSL pinning hashes
|
||||||
if grep -rq "brDmHiqwkhgPrFDmkcD2IsDUdKLZlyGjGkn0SOGNKFI" . --include="*.swift" --include="*.json" 2>/dev/null; then
|
if grep -rq "brDmHiqwkhgPrFDmkcD2IsDUdKLZlyGjGkn0SOGNKFI" . --include="*.swift" --include="*.json" 2>/dev/null; then
|
||||||
|
# HMAC salt
|
||||||
|
if grep -rq "glegram-hmac-v1" . --include="*.swift" 2>/dev/null; then
|
||||||
|
echo "FAIL: HMAC salt found!"
|
||||||
|
FOUND=1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "FAIL: SSL pinning hashes found!"
|
echo "FAIL: SSL pinning hashes found!"
|
||||||
FOUND=1
|
FOUND=1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ public let SG_API_WEBAPP_URL_PARSED = URL(string: SG_CONFIG.webappUrl)!
|
|||||||
SWIFT
|
SWIFT
|
||||||
echo " Stripped: SGConfig"
|
echo " Stripped: SGConfig"
|
||||||
|
|
||||||
|
# 1.5 SupportersCrypto — remove HMAC salt
|
||||||
|
sed -i '' 's/private let HMAC_SALT = .*/private let HMAC_SALT = "YOUR_HMAC_SALT"/' GLEGram/SGSupporters/Sources/SupportersCrypto.swift 2>/dev/null
|
||||||
|
echo " Stripped: HMAC salt"
|
||||||
|
|
||||||
# 2. Build configs — replace with templates
|
# 2. Build configs — replace with templates
|
||||||
for cfg in build-system/ipa-build-configuration.json build-system/glegram-appstore-configuration.json; do
|
for cfg in build-system/ipa-build-configuration.json build-system/glegram-appstore-configuration.json; do
|
||||||
cat > "$cfg" << 'JSON'
|
cat > "$cfg" << 'JSON'
|
||||||
|
|||||||
Reference in New Issue
Block a user