2022-06-05 02:54:00 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-06-08 21:23:51 +02:00
|
|
|
# send-bankid-token
|
|
|
|
#
|
2022-06-05 02:54:00 +02:00
|
|
|
# Takes a bankid URI as input, extracts the token and writes the token to disk
|
|
|
|
# on a target Windows SSH host. The target host is expected to watch for this
|
|
|
|
# file, just like the following PowerShell script does:
|
|
|
|
# https://gitlab.com/dabruh/weird-corner/-/blob/main/powershell/BankIDTokenFileWatcher.ps1
|
|
|
|
|
|
|
|
TOKEN=${1:?} || exit 1
|
|
|
|
TOKEN="${TOKEN#*=}"
|
|
|
|
TOKEN="${TOKEN%&*}"
|
|
|
|
|
2022-06-05 02:56:14 +02:00
|
|
|
xclip -selection clipboard <<<"$1"
|
2022-06-05 02:54:00 +02:00
|
|
|
ssh bankid -- powershell.exe -NoLogo -ExecutionPolicy Bypass -Command "Set-Content -Path C:\.bidtoken -Value '$TOKEN'" &
|
|
|
|
notify-send BankID "Token has been sent." &
|