# APPX testing & signing

To test appx packages you need to sign them.

> You need the windows sdk in your `PATH` env variable that windows can find `MakeCert.exe` and `pvk2pfx.exe`

First generate a certificate with these steps:

1. run `MakeCert.exe -r -h 0 -n "CN=C13753E5-D590-467C-9FCA-6799E1A5EC1E" -eku 1.3.6.1.5.5.7.3.3 -pe -sv ../my.pvk ../my.cer` in the dialog select None. (the cn is the publisher id (`appx.publisher`) specified in `electron-builder.json5`)
2. run `pvk2pfx.exe -pvk ../my.pvk -spc ../my.cer -pfx ../my.pfx`

Now you have a certificate with which you can package a self-signed appx:

```powershell
pnpm i
cd packages/target-electron
pnpm build
pnpm run pack:generate_config
pnpm run pack:patch-node-modules
pnpm electron-builder --config ./electron-builder.json5 --config.win.signtoolOptions.certificateFile=../my.pfx --win appx
```

To install your self-signed appx, you first need to import it: double click on the certificate and install it into the **Trusted People** store. After that you should be able to double click the appx package in the `dist/` folder to install it. If not have a look at the properties of that file (right click in Explorer), select Certificates => Details => View Certificate => Install => Store => Trusted People

If signing fails with some "Timestamp server not reachable" error, have a look at System Settings => Date & Time => Synchronize to see if the server is reachable

If you get an install error after having uninstalled the app before try logging out and in again before installing

If you have installed deltachat-desktop manually with a setup.exe your AppData will be stored in AppData/Local/DeltaChat. If you install then an appx package the user data will also go there. If you remove the data from there before installing the appx package, your data will go to AppData/Local/Packages/merlinux_xxx/LocalCache/Local/DeltaChat/
