{"id":24903890,"url":"https://github.com/alexruperez/safebrowsing","last_synced_at":"2025-10-16T15:30:56.748Z","repository":{"id":62454838,"uuid":"126880129","full_name":"alexruperez/SafeBrowsing","owner":"alexruperez","description":"Protect your users against malware and phishing threats using Google Safe Browsing","archived":false,"fork":false,"pushed_at":"2019-03-04T10:35:56.000Z","size":96,"stargazers_count":21,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-01T16:01:48.985Z","etag":null,"topics":["api-wrapper","google","google-safebrowsing","malware-detection","phising","protect-your-privacy","safe-browsing","safebrowsing","security","swift","swift-library","threats"],"latest_commit_sha":null,"homepage":"https://developers.google.com/safe-browsing","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexruperez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-26T19:34:22.000Z","updated_at":"2024-12-18T19:47:02.000Z","dependencies_parsed_at":"2022-11-02T00:01:36.236Z","dependency_job_id":null,"html_url":"https://github.com/alexruperez/SafeBrowsing","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexruperez%2FSafeBrowsing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexruperez%2FSafeBrowsing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexruperez%2FSafeBrowsing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexruperez%2FSafeBrowsing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexruperez","download_url":"https://codeload.github.com/alexruperez/SafeBrowsing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236730802,"owners_count":19195683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-wrapper","google","google-safebrowsing","malware-detection","phising","protect-your-privacy","safe-browsing","safebrowsing","security","swift","swift-library","threats"],"created_at":"2025-02-01T22:34:28.580Z","updated_at":"2025-10-16T15:30:51.460Z","avatar_url":"https://github.com/alexruperez.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SafeBrowsing\n[![Twitter](https://img.shields.io/badge/contact-@alexruperez-0FABFF.svg?style=flat)](http://twitter.com/alexruperez)\n[![Version](https://img.shields.io/cocoapods/v/SafeBrowsing.svg?style=flat)](http://cocoapods.org/pods/SafeBrowsing)\n[![License](https://img.shields.io/cocoapods/l/SafeBrowsing.svg?style=flat)](http://cocoapods.org/pods/SafeBrowsing)\n[![Platform](https://img.shields.io/cocoapods/p/SafeBrowsing.svg?style=flat)](http://cocoapods.org/pods/SafeBrowsing)\n[![Swift](https://img.shields.io/badge/Swift-4.2-orange.svg?style=flat)](https://swift.org)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Swift Package Manager Compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-4BC51D.svg?style=flat)](https://github.com/apple/swift-package-manager)\n[![Build Status](https://travis-ci.org/alexruperez/SafeBrowsing.svg?branch=master)](https://travis-ci.org/alexruperez/SafeBrowsing)\n[![codecov](https://codecov.io/gh/alexruperez/SafeBrowsing/branch/master/graph/badge.svg)](https://codecov.io/gh/alexruperez/SafeBrowsing)\n\n### Protect your users against malware and phishing threats using Google Safe Browsing\n\n![SafeBrowsing](https://github.com/alexruperez/SafeBrowsing/raw/master/Logo.jpg)\n\n## 🌟 Features\n\n- [x] Check multiple URLs asynchronously\n- [x] Check single URL asynchronously\n- [x] Check single URL synchronously\n- [x] Open URL in Safari only if it's safe\n- [x] UIApplication extension\n- [x] UIViewController extension\n- [x] SFSafariViewController compatible\n\n## 📲 Installation\n\nSafeBrowsing is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'SafeBrowsing'\n```\n\n#### Or you can install it with [Carthage](https://github.com/Carthage/Carthage):\n\n```ogdl\ngithub \"alexruperez/SafeBrowsing\"\n```\n\n#### Or install it with [Swift Package Manager](https://swift.org/package-manager/):\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/alexruperez/SafeBrowsing.git\", from: \"0.1.0\")\n]\n```\n\n## 🛠 Configuration\n\n### Required configuration\n\nJust [enable Google Safe Browsing API](https://console.developers.google.com/apis/api/safebrowsing.googleapis.com/overview) and [get your API key](https://console.cloud.google.com/apis/credentials).\n\n```swift\nSafeBrowsing.apiKey = \"YOUR_API_KEY_HERE\"\n```\n\n#### Advanced optional configuration\n\nYou can easily customize [threat types](https://developers.google.com/safe-browsing/v4/reference/rest/v4/ThreatType), [platform types](https://developers.google.com/safe-browsing/v4/reference/rest/v4/PlatformType) or [threat entry types](https://developers.google.com/safe-browsing/v4/reference/rest/v4/ThreatEntryType).\n\n```swift\nSafeBrowsing.clientId = \"YOUR_CLIENT_ID\" // By default your bundle identifier.\nSafeBrowsing.clientVersion = \"YOUR_CLIENT_VERSION\" // By default your bundle short version.\nSafeBrowsing.threatTypes = [.malware, .socialEngineering, .unwantedSoftware, .potenciallyHarmfulApplication]\nSafeBrowsing.platformTypes = [.any]\nSafeBrowsing.threatEntryTypes = [.url, .executable]\n```\n\n## 🐒 Usage\n\n#### Check multiple URLs asynchronously:\n\n```swift\nSafeBrowsing.isSafe([anURL, anotherURL]) { isSafe, error in\n    // Your code here\n}\n```\n\n#### Check single URL asynchronously:\n\n```swift\nSafeBrowsing.isSafe(anURL) { isSafe, error in\n    // Your code here\n}\n```\n\n#### Check single URL synchronously:\n\n###### **Caution**: Don't call it in main thread\n\n```swift\nif SafeBrowsing.isSafe(anURL) {\n    // Your code here\n}\n```\n\n#### Open URL in Safari only if it's safe:\n\n```swift\nSafeBrowsing.safeOpen(anURL) { opened, error in\n    // Your code here\n}\n```\n\n#### Open URL in SFSafariViewController only if it's safe:\n\n```swift\nSafeBrowsing.safeOpenInSafariViewController(anURL, over: aViewController, animated: true) { opened, error in\n    // Your code here\n}\n```\n\n### UIApplication extension\n\nYes, you can use SafeBrowsing with UIApplication, just like [open(_:options:completionHandler:)](https://developer.apple.com/documentation/uikit/uiapplication/1648685-open) method works.\n\nYou also have all isSafe(_:) methods available with this extension.\n\n```swift\nUIApplication.shared.safeOpen(anURL) { opened, error in\n    // Your code here\n}\n```\n\n#### Open URL in SFSafariViewController only if it's safe:\n\n```swift\nUIApplication.shared.safeOpenInSafariViewController(anURL, over: aViewController, animated: true) { opened, error in\n    // Your code here\n}\n```\n\n#### UIViewController extension\n\n```swift\naViewController.safeOpenInSafariViewController(anURL, animated: true) { opened, error in\n    // Your code here\n}\n```\n\n### Testing Google Safe Browsing\n\n```swift\nlet testingURL = URL(string: \"http://malware.testing.google.test/testing/malware/\")!\nSafeBrowsing.isSafe(testingURL) { isSafe, error in\n    print(error.debugDescription)\n}\n```\n\n## ❤️ Etc.\n\n* Contributions are very welcome.\n* Attribution is appreciated (let's spread the word!), but not mandatory.\n\n## 👨‍💻 Authors\n\n[alexruperez](https://github.com/alexruperez), contact@alexruperez.com\n\n## 👮‍♂️ License\n\nSafeBrowsing is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexruperez%2Fsafebrowsing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexruperez%2Fsafebrowsing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexruperez%2Fsafebrowsing/lists"}