misfin send message #6
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Arnas Udovic 2025-03-28 20:54:09 +02:00
parent 2448d2e28b
commit 812af32757
3 changed files with 17 additions and 4 deletions

5
go.mod
View file

@ -13,7 +13,10 @@ require (
google.golang.org/protobuf v1.28.1
)
require g.arns.lt/zordsdavini/abcex/v4 v4.0.4 // indirect
require (
g.arns.lt/zordsdavini/abcex/v4 v4.0.4 // indirect
golang.org/x/crypto v0.28.0 // indirect
)
require (
g.arns.lt/zordsdavini/zordfsdb v1.0.7

2
go.sum
View file

@ -72,6 +72,8 @@ gitlab.com/clseibold/misfin-server v0.0.0-20250210073459-f21af62ee2f3/go.mod h1:
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=

View file

@ -4,18 +4,26 @@ import (
"fmt"
"os"
"gitlab.com/clseibold/misfin-server/gemmail"
"gitlab.com/clseibold/misfin-server/misfin_client"
)
const ZORDSDAVINI_MISFIN = "misfin://zordsdavini@arns.lt"
func SendMisfinMessage(message string, recipient string) error {
func SendMisfinMessage(body 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)
client := misfin_client.Client{}
message := gemmail.CreateGemMailFromBody(body)
resp, err := client.SendWithCert(
recipient,
certFile,
certFile,
message.String(),
)
if err != nil {
return fmt.Errorf("[Misfin-send] %s", err)
}