Skip to content

sentinelgrowthdao/casanode-ble

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Casanode BLE

Application for Bluetooth communication between phone and casanode node.

Web server

The application listens to two network ports, one in HTTP that gives access to the QR Code connection and the other in HTTPS to enable requests to the REST APIs.

Configuration

The parameters used to configure the web server are in the /etc/casanode.conf configuration file:

  • WEB_LISTEN: Interface and listening port for the QR Code display page (in HTTP)
  • API_LISTEN: Interface and listening port for APIs (in HTTPS)
  • API_AUTH: Authentication token for using APIs

Testing REST APIs

The commands below are examples of how to test the API. Replace the <token> with the value available in the /etc/casanode.conf configuration file in the API_AUTH attribute.

Node status

curl -X GET -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/status

Check Installation

curl -X GET -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/check/installation

Check Port

curl -X GET -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/check/port/node
curl -X GET -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/check/port/vpn

Renew Certificate SSL

curl -X POST -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/certificate/renew

Remove Certificate SSL

curl -X DELETE -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/certificate/remove

Node Status

curl -X PUT -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/node/status

Node Configuration

curl -X GET -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/node/configuration

Create Node Configuration

curl -X POST -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/install/configuration

Apply Configuration

curl -X PUT -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/node/configuration/apply -H "Content-Type: application/json" -d '{"moniker":"newMoniker", "backend":"file", "nodeType":"residential", "nodeIp":"x.x.x.x", "nodePort":12345, "vpnType":"wireguard", "vpnPort":51820, "maximumPeers":1000}'

Download Docker Image

curl -X POST -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/install/docker-image

Start Node

curl -X PUT -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/node/start

Stop Node

curl -X PUT -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/node/stop

Restart Node

curl -X PUT -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/node/restart

Node Address

curl -X GET -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/node/address

Node Balance

curl -X GET -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/node/balance

Set the Passphrase

curl -X POST -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/node/passphrase -H "Content-Type: application/json" -d '{"passphrase": "your_wallet_passphrase"}'

Check if passphrase is available

curl -X GET -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/node/passphrase

System Update

curl -X POST -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/system/update -H "Content-Type: application/json" -d '{"target": "system"}'
curl -X POST -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/system/update -H "Content-Type: application/json" -d '{"target": "sentinel"}'

System Reboot

curl -X POST -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/system/reboot

System Halt

curl -X POST -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/system/halt

System Reset

curl -X POST -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/system/reset

Wallet Address

curl -X GET -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/wallet/address

Create Wallet

curl -X POST -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/wallet/create

Restore Wallet

curl -X POST -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/wallet/restore

Remove Wallet

curl -X DELETE -H "Authorization: Bearer <token>" -k https://192.168.x.x:8081/api/v1/wallet/remove

Generating .deb Packages

The creation of the .deb package is done in a Docker container. To do this, follow these steps:

  1. Start the container by running the docker.sh bash script available at the root of the project.
  2. Once the container is started, execute the build.sh script.
  3. To send the .deb file to the GitHub repository, use the push.sh bash script (outside the container) available at the root of the project. This script clones a repository and sends everything to the gh-pages branch of the repository.

License

This project is licensed under the GPL v3 License - see the LICENSE file for details.

About

Service for Bluetooth Communication

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages