A NodeJS proxy server for doip.js
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Yarmo Mackenbach ec14603ea9 Update README 3 weeks ago
api/v1 Run prettier 3 weeks ago
src Apply changes made by prettier 1 month ago
.gitignore Ignore .env 3 weeks ago
.licenseignore Fix licenseignore 1 month ago
.prettierignore Add prettier 1 month ago
.prettierrc.yaml Apply changes made by prettier 1 month ago
Dockerfile Fix production flag in dockerfile 3 weeks ago
LICENSE Initial commit 1 month ago
LICENSE.HEADER Add project files 1 month ago
README.md Update README 3 weeks ago
license-checker-config.json Add project files 1 month ago
package.json Run production without nodemon 3 weeks ago
yarn.lock Add XMPP vCard query support 3 weeks ago

README.md

doip-proxy

Introduction

This is a proxy server written in Node.js for the doip.js library.

When doip.js is ran in a Node.js environment, it can function completely autonomously. When ran in a browser, some proofs can't be verified due to CORS restrictions or lack of Node.js tools like DNS resolvers. In these cases, the requests will need to be routed to a proxy server running this project.

Currently, doip-proxy handles:

  • REST queries (GET, result in JSON or text)
  • DNS resolving
  • XMPP vCard data fetching

Please note that XMPP functionality is disabled by default. Information on how to enable is found below.

Getting started

Installing the server using plain Node.js

git clone git@codeberg.org:keyoxide/doip-proxy.git
yarn --production
yarn start

Doip-proxy is now available at http://localhost:3000

Installing the server using docker

git clone git@codeberg.org:keyoxide/doip-proxy.git
docker build -t doip-proxy .
docker container run -p 3000:3000 doip-proxy

Doip-proxy is now available at http://localhost:3000.

API

Get JSON document via REST

/api/1/get/json/:url

The url needs to be encoded (in js: encodeURIComponent(url)).

Get text document via REST

/api/1/get/txt/:url

The url needs to be encoded (in js: encodeURIComponent(url)).

Resolve DNS

/api/1/get/dns/:hostname

hostname means just the domain without https://.

Fetch XMPP vCard data

/api/1/get/xmpp/:xmppid/:xmppdata

xmppid is also known as jabberid and looks like an email address: user@domain.org.

xmppdata is the specific vCard entry that you are requesting. For DOIP proof verification, you will need DESC. Possible values are: FN, NUMBER, USERID, URL, BDAY, NICKNAME, DESC.

Configuration

Enabling XMPP functionality

Enabling XMPP functionality requires an XMPP account. Please note that after some testing, it turns out not all XMPP instances work equally well with doip-proxy. If XMPP continues to fail, please try a different XMPP instances.

XMPP account credentials are passed to the library using environment variables.

For example, with docker:

docker container run -p 3000:3000 -e XMPP_SERVICE=domain.org -e XMPP_USERNAME=username -e XMPP_PASSWORD=password doip-proxy

Development

Todo:

  • improve documentation