github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/engine/loopback_identify_ui.go (about) 1 // Copyright 2015 Keybase, Inc. All rights reserved. Use of 2 // this source code is governed by the included BSD license. 3 4 package engine 5 6 import ( 7 "sync" 8 9 "github.com/keybase/client/go/libkb" 10 keybase1 "github.com/keybase/client/go/protocol/keybase1" 11 ) 12 13 type LoopbackIdentifyUI struct { 14 libkb.Contextified 15 sync.Mutex 16 trackBreaksP **keybase1.IdentifyTrackBreaks 17 } 18 19 var _ libkb.IdentifyUI = (*LoopbackIdentifyUI)(nil) 20 21 func NewLoopbackIdentifyUI(g *libkb.GlobalContext, tb **keybase1.IdentifyTrackBreaks) *LoopbackIdentifyUI { 22 return &LoopbackIdentifyUI{ 23 Contextified: libkb.NewContextified(g), 24 trackBreaksP: tb, 25 } 26 } 27 28 func (b *LoopbackIdentifyUI) Start(m libkb.MetaContext, s string, r keybase1.IdentifyReason, f bool) error { 29 return nil 30 } 31 32 func (b *LoopbackIdentifyUI) trackBreaks() *keybase1.IdentifyTrackBreaks { 33 if *b.trackBreaksP == nil { 34 *b.trackBreaksP = &keybase1.IdentifyTrackBreaks{} 35 } 36 return *b.trackBreaksP 37 } 38 39 func (b *LoopbackIdentifyUI) FinishWebProofCheck(m libkb.MetaContext, p keybase1.RemoteProof, l keybase1.LinkCheckResult) error { 40 b.Lock() 41 defer b.Unlock() 42 if l.BreaksTracking { 43 tb := b.trackBreaks() 44 tb.Proofs = append(tb.Proofs, keybase1.IdentifyProofBreak{ 45 RemoteProof: p, 46 Lcr: l, 47 }) 48 } 49 return nil 50 } 51 52 func (b *LoopbackIdentifyUI) FinishSocialProofCheck(m libkb.MetaContext, p keybase1.RemoteProof, l keybase1.LinkCheckResult) error { 53 return b.FinishWebProofCheck(m, p, l) 54 } 55 56 func (b *LoopbackIdentifyUI) Confirm(m libkb.MetaContext, o *keybase1.IdentifyOutcome) (keybase1.ConfirmResult, error) { 57 return keybase1.ConfirmResult{}, nil 58 } 59 60 func (b *LoopbackIdentifyUI) DisplayCryptocurrency(m libkb.MetaContext, c keybase1.Cryptocurrency) error { 61 return nil 62 } 63 64 func (b *LoopbackIdentifyUI) DisplayStellarAccount(libkb.MetaContext, keybase1.StellarAccount) error { 65 return nil 66 } 67 68 func (b *LoopbackIdentifyUI) DisplayKey(m libkb.MetaContext, k keybase1.IdentifyKey) error { 69 b.Lock() 70 defer b.Unlock() 71 if k.BreaksTracking { 72 tb := b.trackBreaks() 73 tb.Keys = append(tb.Keys, k) 74 } 75 return nil 76 } 77 78 func (b *LoopbackIdentifyUI) ReportLastTrack(m libkb.MetaContext, s *keybase1.TrackSummary) error { 79 return nil 80 } 81 82 func (b *LoopbackIdentifyUI) LaunchNetworkChecks(m libkb.MetaContext, i *keybase1.Identity, u *keybase1.User) error { 83 return nil 84 } 85 86 func (b *LoopbackIdentifyUI) DisplayTrackStatement(m libkb.MetaContext, s string) error { 87 return nil 88 } 89 90 func (b *LoopbackIdentifyUI) DisplayUserCard(m libkb.MetaContext, c keybase1.UserCard) error { 91 return nil 92 } 93 94 func (b *LoopbackIdentifyUI) ReportTrackToken(m libkb.MetaContext, t keybase1.TrackToken) error { 95 return nil 96 } 97 98 func (b *LoopbackIdentifyUI) Cancel(m libkb.MetaContext) error { 99 return nil 100 } 101 102 func (b *LoopbackIdentifyUI) Finish(m libkb.MetaContext) error { 103 return nil 104 } 105 106 func (b *LoopbackIdentifyUI) DisplayTLFCreateWithInvite(m libkb.MetaContext, d keybase1.DisplayTLFCreateWithInviteArg) error { 107 return nil 108 } 109 110 func (b *LoopbackIdentifyUI) Dismiss(m libkb.MetaContext, s string, r keybase1.DismissReason) error { 111 return nil 112 }