MCPcopy
hub / github.com/ayn2op/discordo / sendInit

Method sendInit

internal/ui/login/qr/msg.go:191–210  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189}
190
191func (m *Model) sendInit() tview.Cmd {
192 return func() tview.Msg {
193 if m.privateKey == nil {
194 return newErrMsg(errors.New("missing private key"))
195 }
196 spki, err := x509.MarshalPKIXPublicKey(m.privateKey.Public())
197 if err != nil {
198 return newErrMsg(err)
199 }
200 encodedPublicKey := base64.StdEncoding.EncodeToString(spki)
201 data := struct {
202 Op string `json:"op"`
203 EncodedPublicKey string `json:"encoded_public_key"`
204 }{"init", encodedPublicKey}
205 if err := m.conn.WriteJSON(data); err != nil {
206 return newErrMsg(err)
207 }
208 return nil
209 }
210}
211
212func (m *Model) sendNonceProof(encryptedNonce string) tview.Cmd {
213 return func() tview.Msg {

Callers 1

UpdateMethod · 0.95

Calls 1

newErrMsgFunction · 0.85

Tested by

no test coverage detected