Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(*): fish fish wrapper #1

Open
wants to merge 65 commits into
base: main
Choose a base branch
from

Conversation

JPBM135
Copy link

@JPBM135 JPBM135 commented Oct 26, 2022

Will write everything when ready!

Readme preview
fishfish

fishfish-js 🐟

The fishfish-js is a simple and easy to use JavaScript wrapper for the fishfish API and WebSocket.

  • Typed
  • Objected oriented
  • Cache

Documentation: API Docs

Installation

npm install fishfish-js
# or
yarn add fishfish-js

How to use?

Static:

import { getAllDomains, getAllUrls, Category } from 'fishfish-js';

const ScamDomains = await getAllDomains(Category.Phishing);
const ScamUrls = await getAllUrls(Category.Phishing);

FishFish Auth:

It is recommended to have one FishFishAuth class and use it for all other classes to avoid unnecessary session tokens.

import { FishFishAuth, Permission } from 'fishfish-js';

const FishAuth = new FishFishAuth({
	apiKey: 'real-api-key',
});

// Infer the apiKey from the env FISHFISH_API_KEY
const FishAuth = new FishFishAuth();

console.log(await FishFish.getSessionToken());

FishFish API:

import { FishFishAuth, FishFishApi, Permission } from 'fishfish-js';

const FishApi = new FishFishApi({
	auth: {
		apiKey: 'real-api-key',
	},
});

const FullScamDomains = await FishApi.getAllDomains(Category.Phishing, { full: true });

Or by using the FishFishAuth class:

import { FishFishAuth, FishFishApi } from 'fishfish-js';

const FishAuth = new FishFishAuth({
	apiKey: 'real-api-key',
});

const FishApi = new FishFishApi({
	auth: FishAuth,
});

const FullScamDomains = await FishApi.getAllUrls(Category.Phishing, { full: true });

FishFish WebSocket:

Receive real-time updates from the fishfish WebSocket.

Pass your own callback function to the FishFishWebSocket class:

import { FishFishWebSocket } from 'fishfish-js';

const FishWebSocket = new FishFishWebSocket({
	auth: {
		apiKey: 'real-api-key',
	},
	callback: (data) => console.log(data),
});

Or use the FishFishApi class to receive the data and cache it:

import { FishFishWebSocket, FishFishApi } from 'fishfish-js';

const manager = new FishFishApi({
	auth: {
		apiKey: 'real-api-key',
	},
});

const FishWebSocket = new FishFishWebSocket({
	manager,
});

// or

const FishWebApi = new FishFishApi({
	auth: {
		apiKey: 'real-api-key',
	},
	webSocket: true,
});
  • Base code
  • Testing
  • CI
  • Husky
  • Lintstaged

  • (GET domains / urls) Only require auth if the full is set to true

.vscode/settings.json Outdated Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
src/types.ts Outdated Show resolved Hide resolved
@JPBM135 JPBM135 changed the title Feat/fish fish wrapper feat(*): fish fish wrapper Oct 28, 2022
@JPBM135 JPBM135 marked this pull request as ready for review January 18, 2023 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant