2024-02-08 16:35:07 +01:00
|
|
|
package messages
|
|
|
|
|
|
|
|
import "encoding/json"
|
|
|
|
|
|
|
|
type SessionAuthRequest struct {
|
|
|
|
Token string
|
|
|
|
}
|
|
|
|
|
|
|
|
type SessionAuthResponse struct {
|
|
|
|
Verified bool
|
|
|
|
}
|
|
|
|
|
2024-02-09 00:24:28 +01:00
|
|
|
type PinentryRegistrationRequest struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
type PinentryRegistrationResponse struct {
|
|
|
|
Success bool
|
|
|
|
}
|
|
|
|
|
|
|
|
type PinentryPinRequest struct {
|
|
|
|
Message string
|
|
|
|
}
|
|
|
|
|
|
|
|
type PinentryPinResponse struct {
|
|
|
|
Pin string
|
|
|
|
}
|
|
|
|
|
|
|
|
type PinentryApprovalRequest struct {
|
|
|
|
Message string
|
|
|
|
}
|
|
|
|
|
|
|
|
type PinentryApprovalResponse struct {
|
|
|
|
Approved bool
|
|
|
|
}
|
|
|
|
|
2024-02-08 16:35:07 +01:00
|
|
|
func init() {
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req SessionAuthRequest
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, SessionAuthRequest{})
|
|
|
|
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req SessionAuthResponse
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, SessionAuthResponse{})
|
2024-02-09 00:24:28 +01:00
|
|
|
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req PinentryRegistrationRequest
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, PinentryRegistrationRequest{})
|
|
|
|
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req PinentryRegistrationResponse
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, PinentryRegistrationResponse{})
|
|
|
|
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req PinentryPinRequest
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, PinentryPinRequest{})
|
|
|
|
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req PinentryPinResponse
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, PinentryPinResponse{})
|
|
|
|
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req PinentryApprovalRequest
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, PinentryApprovalRequest{})
|
|
|
|
|
|
|
|
registerPayloadParser(func(payload []byte) (interface{}, error) {
|
|
|
|
var req PinentryApprovalResponse
|
|
|
|
err := json.Unmarshal(payload, &req)
|
|
|
|
if err != nil {
|
|
|
|
panic("Unmarshal: " + err.Error())
|
|
|
|
}
|
|
|
|
return req, nil
|
|
|
|
}, PinentryApprovalResponse{})
|
2024-02-08 16:35:07 +01:00
|
|
|
}
|