Skip to content

Commit

Permalink
restructure files (#260)
Browse files Browse the repository at this point in the history
* restructure org

* remove unused license

* empty readme

* update lock

* move examples

* restructure coverage badge (#261)

* Update coverage badge

* Retain NameGuard intro docs

* Display coverage badge from active branch

* Fix typo

---------

Co-authored-by: kwrobel.eth <djstrong@gmail.com>
Co-authored-by: github-actions <actions@github.com>
Co-authored-by: lightwalker.eth <126201998+lightwalker-eth@users.noreply.github.com>
  • Loading branch information
4 people authored May 15, 2024
1 parent dd6f9af commit 6f795b5
Show file tree
Hide file tree
Showing 108 changed files with 7,631 additions and 4,776 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ jobs:

- name: Generate coverage badge
working-directory: ./api
run: poetry run coverage-badge -fo ../coverage_badge.svg
run: poetry run coverage-badge -fo coverage_badge.svg

- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
author_name: github-actions
author_email: actions@github.com
message: 'Update coverage badge'
add: 'coverage_badge.svg'
add: 'api/coverage_badge.svg'
111 changes: 2 additions & 109 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,110 +1,3 @@
# NameHash NameGuard
# Namekit

![Tests](https://github.com/namehash/nameguard/actions/workflows/ci_api.yml/badge.svg?branch=main)
![Coverage](https://raw.githubusercontent.com/namehash/nameguard/main/coverage_badge.svg)

The NameHash team is proud to present NameGuard, a tool for identifying and preventing malicious use of ENS names.

- Offers multiple levels of protection
- Impersonated name detection
- Confusable grapheme detection
- International accessibility checks
- Rendering checks for different fonts
- ENSIP-15 verification with detailed explanations and auto-suggestions (provided by [ens-normalize-python](https://github.com/namehash/ens-normalize-python))
- Punycode and DNS hostname compatibility checks
- and more!
- Provides a unified rating system for entire names, as well as detailed explanations for each check
- :green_circle: Pass: no issues found
- :yellow_circle: Warn: potential issues found
- :red_circle: Fail: serious issues found
- Supports many use cases
- Standalone Python library ([PyPI](https://pypi.org/project/nameguard/))
- ASGI web server
- [Amazon AWS Lambda](https://aws.amazon.com/lambda/) handler

⚠️ **This SDK is BETA. Things will change based on the community feedback.**

## Getting Started

### [Try the official web app](https://nameguard.io)

### Using the public API

NameGuard is hosted at <https://api.nameguard.io>

You can make a basic request to the API like this:

```bash
curl https://api.nameguard.io/inspect-name/mainnet/nick.eth
```

The API documentation is available at <https://api.nameguard.io/redoc> or <https://api.nameguard.io/docs>.

### Using the SDK

Quickstart:

```bash
npm install @namehash/nameguard
```

```ts
import { nameguard } from "@namehash/nameguard";
await nameguard.inspectName("nick.eth");
```

See the [SDK README](./packages/sdk/README.md) for more details.

### Using the Python library

Quickstart:

```bash
pip install nameguard
```

```python
from nameguard import NameGuard
ng = NameGuard()
await ng.inspect_name(network_name='mainnet', name='nick.eth')
```

See the [NameGuard Python README](./api/README.md) for more details.

### Running your own NameGuard instance

See the [NameGuard Python README](./api/README.md) for more details.

## NameGuard Specification

### Checks

1. **Impersonation**: Detects names that could be trying to impersonate a different name by using similar characters. Example: [`vitalìk.eth`](https://nameguard.io/inspect/vitalìk.eth)

2. **Confusables**: Detects characters that can be confused with other characters. Example: [`vitalìk.eth`](https://nameguard.io/inspect/vitalìk.eth)

3. **Font Support**: Checks if the characters in the name are supported by commonly used fonts. Example: [`🛈.eth`](https://nameguard.io/inspect/🛈.eth)

4. **Invisibles**: Detects invisible characters. Example: [`888‍‍.eth`](https://nameguard.io/inspect/888‍‍.eth)

5. **Typing Difficulty**: Detects names that are difficult to type on some keyboards. Example: [`żółć.eth`](https://nameguard.io/inspect/żółć.eth)

6. **Mixed Scripts**: Detects names that contain characters from multiple scripts or alphabets. Example: [`あア.eth`](https://www.nameguard.io/inspect/あア.eth)

7. **Name Wrapper**: Checks if the name is supported by the new ENS Name Wrapper. Example: [`abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd.eth`](https://nameguard.io/inspect/abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd.eth)

8. **ENSIP-15**: Checks if the name is normalized according to ENSIP-15. Example: [`bitсoin.eth`](https://nameguard.io/inspect/bitсoin.eth)

9. **Punycode**: Checks if the name is compatible with Punycode encoding. Example: [`ab--abc.eth`](https://www.nameguard.io/inspect/ab--abc.eth)

10. **Unknown Labels**: Checks if the name contains unknown labels. Example: [`[5bc926fc40cc7c49e0df6dddf26e4dc7b9d6d32f4a55d4f0670320dbf414afd2].byongdok.eth`](https://nameguard.io/inspect/[5bc926fc40cc7c49e0df6dddf26e4dc7b9d6d32f4a55d4f0670320dbf414afd2].byongdok.eth)

11. **Decentralized Name**: Checks if the name is decentralized (unruggable). Example: [`example.com`](https://www.nameguard.io/inspect/example.com)

12. **NameWrapper fuses**: Checks that the NameWrapper configuration of a name is safe.

## License

Licensed under the MIT License, Copyright © 2023-present [NameHash Labs](https://namehashlabs.org).

See [LICENSE](./LICENSE) for more information.
NameKit contains multiple projects, including [NameGuard](./nameguard.md).
31 changes: 27 additions & 4 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,42 @@
# NameGuard Python

![Tests](https://github.com/namehash/nameguard/actions/workflows/ci_api.yml/badge.svg?branch=main)
![Coverage](coverage_badge.svg)

This repository contains the core logic for NameGuard, a python library, web API server, and AWS Lambda handler.

## Getting Started

### Env variables
### Using the public API

NameGuard is hosted at <https://api.nameguard.io>

You can make a basic request to the API like this:

```bash
curl https://api.nameguard.io/inspect-name/mainnet/nick.eth
```

The API documentation is available at <https://api.nameguard.io/redoc> or <https://api.nameguard.io/docs>.

### Running your own NameGuard instance

#### Env variables

```bash
AWS_ROLE - AWS Role used by GitHub actions to create the CloudFormation infrastructure for deploying NameGuard as an AWS Lambda and pushing the latest build image to AWS ECR.
SLACK_WEBHOOK_URL - Slack webhook url used by GitHub actions to send notifications of deployment success or failure to the dev team's slack channel.
```
### Installing the library
#### Installing the library
NameGuard is available as a Python library on [PyPI](https://pypi.org/project/nameguard/). You can install it with `pip`:
```bash
pip install nameguard
```
### Setting Provider URIs
#### Setting Provider URIs
NameGuard uses the specified Provider endpoint (e.g. Alchemy, Infura, your own Ethereum node, etc...) for `secure-primary-name/`. Provider endpoints have to be set by environment variables, e.g.:
Expand All @@ -28,7 +45,7 @@ export PROVIDER_URI_MAINNET=https://eth-mainnet.g.alchemy.com/v2/[YOUR_ALCHEMY_A
export PROVIDER_URI_SEPOLIA=https://eth-sepolia.g.alchemy.com/v2/[YOUR_ALCHEMY_API_KEY]
```
### Starting the web server
#### Starting the web server
A FastAPI application is included in the `nameguard.web_api` module. The default installation from PyPI does not include an ASGI server, so you will need to install one separately. For example, to install [uvicorn](https://www.uvicorn.org):
Expand Down Expand Up @@ -104,3 +121,9 @@ By default, the tests are using mock responses from external APIs. If you want t
```bash
MONKEYPATCH=0 poetry run pytest
```
## License
Licensed under the MIT License, Copyright © 2023-present [NameHash Labs](https://namehashlabs.org).
See [LICENSE](./LICENSE) for more information.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"prettier-check": "prettier --check ."
"lint": "next lint"
},
"dependencies": {
"@calcom/embed-react": "1.3.0",
"@heroicons/react": "2.0.18",
"@namehash/ens-utils": "1.3.0",
"@namehash/ens-utils": "workspace:*",
"@namehash/ens-webfont": "workspace:*",
"@namehash/nameguard": "workspace:*",
"@namehash/nameguard-react": "workspace:*",
"@namehash/utils": "0.0.1",
"@namehash/seo": "workspace:*",
"@tailwindcss/forms": "0.5.6",
"@vercel/analytics": "1.1.2",
"@vercel/speed-insights": "1.0.9",
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "./globals.css";
import "@namehash/ens-webfont";
import type { Metadata } from "next";
import { Metadata as NamehashMetadata } from "@namehash/utils";
import { Metadata as NamehashMetadata } from "@namehash/seo";
import { Inter } from "next/font/google";
import Favicon from "../../public/favicon/favicon_package_v0-2/favicon.ico";
import AppleTouchIcon from "../../public/favicon/favicon_package_v0-2/apple-touch-icon.png";
Expand Down
Loading

0 comments on commit 6f795b5

Please sign in to comment.