Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Added APIKey
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon-T committed Jun 22, 2020
1 parent e30952f commit bf2b810
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions Client/Configuration/Beta.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
MOZ_BUNDLE_DISPLAY_NAME = BraveBeta

BRAVE_API_KEY = key
BRAVE_SERVICES_API_KEY = service_key

// Bundle Identifier
MOZ_BUNDLE_ID = $(BASE_BUNDLE_ID).browser.beta
Expand Down
1 change: 1 addition & 0 deletions Client/Configuration/Debug.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
MOZ_BUNDLE_DISPLAY_NAME = Brave ($(USER))

BRAVE_API_KEY = key
BRAVE_SERVICES_API_KEY = service_key

// Bundle Identifier
// MOZ_BUNDLE_ID = set in Local.xconfig
Expand Down
1 change: 1 addition & 0 deletions Client/Configuration/Dev.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
MOZ_BUNDLE_DISPLAY_NAME = BraveDev

BRAVE_API_KEY = key
BRAVE_SERVICES_API_KEY = service_key

// Bundle Identifier
MOZ_BUNDLE_ID = $(BASE_BUNDLE_ID).BrowserBeta
Expand Down
16 changes: 9 additions & 7 deletions Client/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<dict>
<key>API_KEY</key>
<string>$(BRAVE_API_KEY)</string>
<key>SERVICES_API_KEY</key>
<string>$(BRAVE_SERVICES_API_KEY)</string>
<key>AdjustAppToken</key>
<string>$(ADJUST_APP_TOKEN)</string>
<key>AdjustEnvironment</key>
Expand Down Expand Up @@ -69,8 +71,8 @@
<string>$(DEVELOPMENT_TEAM)</string>
<key>MozWhatsNewTopic</key>
<string></string>
<key>NFCReaderUsageDescription</key>
<string>The application needs access to NFC reading to communicate with your Yubikey.</string>
<key>NFCReaderUsageDescription</key>
<string>The application needs access to NFC reading to communicate with your Yubikey.</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand Down Expand Up @@ -155,10 +157,10 @@
</array>
<key>UIFileSharingEnabled</key>
<true/>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A000000527471117</string>
<string>A0000006472F0001</string>
</array>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A000000527471117</string>
<string>A0000006472F0001</string>
</array>
</dict>
</plist>
6 changes: 5 additions & 1 deletion Client/SafeBrowsing/GSafeBrowsing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension SafeBrowsing {
}

class SafeBrowsingClient {
private static let apiKey = "DUMMY_KEY"
private static let apiKey = SafeBrowsingClient.getAPIKey()
private static let maxBandwidth = 2048 //Maximum amount of results we can process per threat-type
private static let maxDatabaseEntries = 250000 //Maximum amount of entries our database can hold per threat-type
private static let clientId = AppInfo.baseBundleIdentifier
Expand All @@ -43,6 +43,10 @@ extension SafeBrowsing {
}
}

private static func getAPIKey() -> String {
return (Bundle.main.infoDictionary?["SERVICES_API_KEY"] as? String)?.trimmingCharacters(in: .whitespaces) ?? "INVALID_API_KEY"
}

func find(_ hashes: [String], _ completion: @escaping (_ isSafe: SafeBrowsingResult, Error?) -> Void) {
let group = DispatchGroup()
var potentiallyBadHashes = [String: [ThreatType]]()
Expand Down

0 comments on commit bf2b810

Please sign in to comment.