misfin send message #5
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6f1ebb6377
commit
2448d2e28b
1 changed files with 30 additions and 0 deletions
30
misfin.go
Normal file
30
misfin.go
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"gitlab.com/clseibold/misfin-server/misfin_client"
|
||||||
|
)
|
||||||
|
|
||||||
|
const ZORDSDAVINI_MISFIN = "misfin://zordsdavini@arns.lt"
|
||||||
|
|
||||||
|
func SendMisfinMessage(message string, recipient string) error {
|
||||||
|
certFile, err := os.ReadFile("./identities/alkierios_misfin.pem")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("[Misfin-send] couldn't read misfin certificate: %s", err)
|
||||||
|
}
|
||||||
|
client := misfin_client.Client{MisfinB: true}
|
||||||
|
resp, err := client.SendWithCert("misfin://zordsdavini@arns.lt", certFile, certFile, message)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("[Misfin-send] %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf(
|
||||||
|
"[Misfin-send] %d %s\n",
|
||||||
|
resp.Status,
|
||||||
|
resp.Meta,
|
||||||
|
) // Should print `20 <fingerprint>` if server is running
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue