2022-12-27 23:05:32 +00:00
# GoSmartKeyboard
2022-09-08 18:32:54 +00:00
2023-03-06 04:29:15 +00:00
Copyright [Kevin Froman ](https://chaoswebs.net/ ) [Licensed under GPLv3 ](LICENSE.md )
2022-09-08 18:32:54 +00:00
2022-12-27 23:05:32 +00:00
Work in progress
2022-09-08 18:32:54 +00:00
2022-12-27 23:05:32 +00:00
# Introduction
2022-09-08 18:32:54 +00:00
2023-03-06 04:29:15 +00:00
GoSmartKeyboard is a daemon that allows you to have a more powerful keyboarding experience. It can be used with a secondary device, such as an Android phone or a raspberry pi, or it can run locally. A seperate client binary is provided that reads from a FIFO (named pipe) and sends the data to the server. This allows you to use any program that can write to a FIFO as a source of keyboard input.
2022-09-08 18:32:54 +00:00
2022-12-27 23:05:32 +00:00
This is done with a simple websocket server meant to accept a single connection, authenticate it, and stream UTF16 characters and send them as key strokes into the window manager. **With a simple daemon like this we can enhance keyboarding with inteligent features.**
2023-03-06 04:29:15 +00:00
Be careful with online games, as they may interpret the keystrokes as cheating. I assume if you don't send keystrokes or more accurately than a human you should be fine, but don't blame the software if you get banned.
2022-09-08 18:32:54 +00:00
2023-01-05 07:10:57 +00:00
**See [Building.md ](Building.md ) for instructions on how to build this [literate ](https://en.wikipedia.org/wiki/Literate_programming ) project.**
2022-09-08 18:32:54 +00:00
2023-03-06 04:29:15 +00:00
## What can you do with it?
2022-09-08 18:32:54 +00:00
2023-03-06 04:29:15 +00:00
Examples of what you can do:
2022-09-08 18:32:54 +00:00
2023-03-06 04:29:15 +00:00
* Run dictation software on a separate device
2022-09-08 18:32:54 +00:00
* Typical macros
2023-03-06 04:29:15 +00:00
* Buffer typed text before sending it to the server, preventing invalid commands or input.
2022-09-08 18:32:54 +00:00
* Clever CLI tricks, think `vim` or `cowsay` on your keyboard!
* Isolated password manager
* One Time Passwords
2023-03-06 04:29:15 +00:00
* Virtual keyboard switch (keyboard multiplexer)
* Typing things into VMS, or transfering text based files to VMs/servers.
2022-09-08 18:32:54 +00:00
* Text storage, such as configuration or SSH pubkeys
* On-the-fly spell checking or translation
* On-the-fly encryption (ex: PGP sign every message you type), isolated from the perhaps untrusted computer
* Easy layout configuration
* Delay keystrokes by a few dozen or so milliseconds to reduce [key stroke timing biometrics ](https://en.wikipedia.org/wiki/Keystroke_dynamics )
2022-12-27 23:05:32 +00:00
Some points about the design of this project:
* Written in go with the [literate ](https://en.wikipedia.org/wiki/Literate_programming ) tool [srcweave ](https://github.com/justinmeiners/srcweave ), so this
markdown book is actually the source code
* KISS principle above All
* Small and light core
2023-03-06 04:29:15 +00:00
* No dependencies for the core and most features
* Features (such as described in above section) are implementend as seperate programs, unix style
* Simple [threat model ](ThreatModel.md )
2022-12-27 23:05:32 +00:00
2023-03-05 02:40:41 +00:00
# Running
## Server
`sudo KEYBOARD_TCP_BIND_ADDRESS=0.0 KEYBOARD_TCP_BIND_PORT=8080 ./keyboard`
2023-03-06 04:29:15 +00:00
# Server Entrypoint
2023-01-01 01:23:52 +00:00
2022-09-08 18:32:54 +00:00
2022-12-27 23:05:32 +00:00
Right out of the gate, we make sure a token is provisioned. In the future we will use the system keyring.
Then we can start the web server and listen for websocket connections.
2022-09-08 18:32:54 +00:00
2022-09-13 17:28:40 +00:00
``` go
2022-09-08 18:32:54 +00:00
--- entrypoint
2022-09-10 19:23:48 +00:00
func main(){
2023-01-01 01:23:52 +00:00
2022-12-31 06:34:03 +00:00
tokenBase64, _ := auth.ProvisionToken()
2023-01-02 07:24:35 +00:00
if len(tokenBase64) > 0 {
fmt.Println("This is your authentication token, it will only be shown once: " + tokenBase64)
}
2022-09-13 17:28:40 +00:00
server.StartServer()
2022-09-10 19:23:48 +00:00
}
2022-09-08 18:32:54 +00:00
---
2023-01-27 00:51:31 +00:00
--- /server/main.go
2022-09-10 19:23:48 +00:00
package main
2022-09-08 18:32:54 +00:00
2022-09-13 17:28:40 +00:00
import(
2022-12-31 06:34:03 +00:00
"fmt"
2022-09-13 17:28:40 +00:00
"keyboard.voidnet.tech/server"
2022-09-16 05:42:29 +00:00
"keyboard.voidnet.tech/auth"
2022-09-13 17:28:40 +00:00
)
2022-09-08 18:32:54 +00:00
2022-09-10 19:23:48 +00:00
@{entrypoint}
2022-09-08 18:32:54 +00:00
---
--- set network bind globals
2022-09-10 19:23:48 +00:00
var string unixSocketPath
var bool unixSocketPathExists
var string tcpBindAddress
var bool tcpBindAddressExists
var string tcpBindPort
var bool tcpBindPortExists
2022-09-13 17:28:40 +00:00
---
```