# Signet
The user documentation is located at
[hax0rbana.org/signet](https://hax0rbana.org/signet), the man page is at
[signet.md](signet.md), and the build instructions are below.

The PGP fingerprint of the [Hax0rbana Signet signing key](signet.pub) is:

```
741E F6C7 5913 9E2D C30C F6BC F48E AC51 91E5 3074
```

If you are a developer, there is a [docs/developer's guide](developer_guide.md) in
this repo that should help get you started out. Also, feel free to join the
Matrix channel, which can be found in the user documentation (see link above).

# OSHWA Certification
Signet has been certified as being open source hardware, software, and
documentation.

[![OSHWA UID US002683](OSHWA-US002683.png "OSHWA UID US002683")](https://certification.oshwa.org/us002683.html)

# Build instructions

## Get submodules

If you got this source from a Git repository then before you can build you must get the repositores submodules:

```sh
git submodule update --init
```

If you downloaded the source from an archive then the submodules are already included.

## Generate keepassxc header

Next, a keepassxc header file needs to be generated like so:

```sh
cd keepassxc
cmake -DWITH_XC_ALL=OFF -DWITH_XC_AUTOTYPE=OFF -Wno-dev .
cd ..
```

After this, follow the instructions which are specific to your operating sysytem.

## GNU/Linux build steps

If you are running a Debian-based system (Ubuntu, Linux Mint, etc.) then run the following command to install Signet's build dependencies

```sh
./build-dependencies.sh
```

If you are not on a Debian based system, build or install the equivalent libraries for Qt5 (with Websockets and x11extras), zlib, libX11, and libgcrypt.

To build simply run qmake and then make:

```sh
qmake client/client.pro CONFIG+=release
make
```

To install:

```sh
sudo make install
```

If you want to run the executable from the current directory instead of
installing it to your path, you can do so, but you will need a udev rule
before the signet software will see the hardware. To do so:

```sh
sudo cp signet-base/signetdev/host/linux/50-signet.rules /etc/udev/rules.d
```

## Mac OS build steps

To install Signet's build dependencies first install [Brew](https://brew.sh)

Once you have Brew, run:

```sh
sudo brew install qt5 libgcrypt libgpg-error zlib cmake botan minizip qrencode asciidoctor argon2
```

To build Signet run:

```sh
qmake client/client.pro CONFIG+=release
make
```

Note: in older installations of brew, qmake was located in `/usr/local/opt/qt5/bin/qmake` then it was `/usr/local/opt/qt@5/bin/qmake`, and now in newer installations, it's in `/opt/hombrew/opt/qt@5/bin/qmake`! It should be in your path, but if not, that's where to look next.

The build will create a `signet.app` folder that you can move or copy anywhere. For example:

```sh
cp -r signet.app ~/Desktop
```

To package up the application into a .dmg file:

1. Package it up so it'll run without brew libraries installed: `macdeployqt signet.app`
2. Create a folder (e.g. `mkdir signet-0.9.18`)
3. Copy the .app folder into the newly created folder (e.g. `cp -R signet.app signet-0.9.18/`)
4. Open Disk Utility
5. Select File -> New Image -> From Folder...
6. Select the folder you made (e.g. signet-0.9.18)
7. Give the .dmg file a name (e.g. signet-0.9.18.dmg) and save it

## Windows build steps

First install [MSYS2](http://www.msys2.org). MSYS2 will provide a build environment and a package manager to download Signet's dependencies. Once MSYS2 is installed, launch the MSYS2/MinGW-64 shell and run:

```
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-make mingw-w64-x86_64-cmake \
          mingw-w64-x86_64-qt5-static mingw-w64-x86_64-zlib mingw-w64-x86_64-libgcrypt \
          mingw-w64-x86_64-jasper mingw-w64-x86_64-openssl \
          mingw-w64-x86_64-dbus mingw-w64-x86_64-libwebp \
          mingw-w64-x86_64-argon2 mingw-w64-x86_64-asciidoctor \
          mingw-w64-x86_64-libbotan mingw-w64-x86_64-libusb \
          mingw-w64-x86_64-minizip mingw-w64-x86_64-qrencode
```

Next, a keepassxc header file needs to be generated like so:

```sh
cd keepassxc
cmake -DWITH_XC_ALL=OFF -DWITH_XC_AUTOTYPE=OFF .
cd ..
```

And finally, you can build the executable like so:

```
export PATH=/mingw64/qt5-static/bin:$PATH
qmake TARGET_ARCH="x86_64" client/client.pro CONFIG+=release
mingw32-make
```

This will build `Signet.exe` in the `release` subdirectory. This executable should be self contained and you can copy it anywhere and run it.

# Development environment

Using the QT Creator IDE is optional. Everything can be updated with a text editor and built from the command line with qmake and make. However, if you prefer development in an IDE, QT Creator is obviously tailored for QT projects like the Signet client.

Installation on Debian: `sudo apt install -y qtcreator`

To open the project: `qtcreator client/client.pro`

The UI tour takes about 2 minutes and is well worth the time if it's the first time you've used QT Creator. Everything should compile without any special configuration. You will need to have cloned this repo with the `--recursive` flag, or run `git submodule update --init` and gotten the dependencies (e.g. `./build-dependencies.sh`) as documented above.

# Release process
The process for cutting a new release is to:

- Make sure there are release-notes that cover every change
- Update version number and release date in client/signetapplication.h
- Ensure the firmware version in client/signetapplication.cpp is correct
- Update version number everywhere in .gitlab-ci.yml
- Update the version string in client/macos/Info.plist
- Make sure signet-base subrepo is set to an official release version
- Ensure the CI jobs all succeed
- After changes are merged into the default branch, tag it
- Sign and publish the CI builds (source, Linux executables) to the website
- Update the signet-deb repo to build the new version
- Sign and publish the .deb packages to the website
- Copy .deb packages to apt repo, update Packages.gz and Releases files, then
  sign the Releases file
- Build .app on a Mac, package it into a .dmg, sign and publish
- Build .exe on a Windows machine, sign and publish
