Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hckhanh/google-safe-browsing

A JavaScript client for Google Safe Browsing API
https://github.com/hckhanh/google-safe-browsing

api browser browsing cloud google safe safe-browsing safety server web website

Last synced: about 1 month ago
JSON representation

A JavaScript client for Google Safe Browsing API

Awesome Lists containing this project

README

        

# google-safe-browsing

A JavaScript client for [Google Safe Browsing](https://safebrowsing.google.com) API (https://developers.google.com/safe-browsing)

## Features

- [Zero dependencies](https://jsr.io/@hckhanh/google-safe-browsing/dependencies)
- Built-in support for Edge runtime
- Typesafe with TypeScript
- Supports all Google Safe Browsing API v4 endpoints
- Fully documented

## APIs

### findThreadMatches

Finds the threat entries that match the Safe Browsing lists.

```ts
import { findThreadMatches } from '@hckhanh/google-safe-browsing'

const result = await findThreadMatches('apiKey', {
client: {
clientId: 'uniqueClientId',
clientVersion: '1.0.0',
},
threatInfo: {
threatTypes: ['MALWARE', 'SOCIAL_ENGINEERING'],
platformTypes: ['ALL_PLATFORMS'],
threatEntryTypes: ['URL'],
threatEntries: [
{ url: 'http://malware.testing.google.test/testing/malware/' },
],
},
})

const hasRisk = result.matches !== undefined && result.matches.length > 0
```

## Release Notes

You can go to [Releases](https://github.com/hckhanh/google-safe-browsing/releases) page to see the release notes.

> [!NOTE]
> The Safe Browsing API is for non-commercial use only. If you need to use APIs to detect malicious URLs for commercial
> purposes - meaning 'for sale or revenue-generating purposes' - please refer to the [Web Risk API](https://github.com/hckhanh/google-web-risk).