@@ -17,6 +17,7 @@ import (
1717type KBFSTLFInfoSource struct {
1818 utils.DebugLabeler
1919 libkb.Contextified
20+ identifier types.Identifier
2021}
2122
2223func NewKBFSTLFInfoSource (g * libkb.GlobalContext ) * KBFSTLFInfoSource {
@@ -26,6 +27,12 @@ func NewKBFSTLFInfoSource(g *libkb.GlobalContext) *KBFSTLFInfoSource {
2627 }
2728}
2829
30+ func NewKBFSTLFInfoSourceWithIdentifier (g * libkb.GlobalContext , identifier types.Identifier ) * KBFSTLFInfoSource {
31+ s := NewKBFSTLFInfoSource (g )
32+ s .identifier = identifier
33+ return s
34+ }
35+
2936func (t * KBFSTLFInfoSource ) tlfKeysClient () (* keybase1.TlfKeysClient , error ) {
3037 xp := t .G ().ConnectionManager .LookupByClientType (keybase1 .ClientType_KBFS )
3138 if xp == nil {
@@ -73,6 +80,9 @@ func (t *KBFSTLFInfoSource) CryptKeys(ctx context.Context, tlfName string) (res
7380 return res , err
7481 }
7582
83+ // skip identify:
84+ query .IdentifyBehavior = keybase1 .TLFIdentifyBehavior_CHAT_SKIP
85+
7686 resp , err := tlfClient .GetTLFCryptKeys (ctx , query )
7787 if err != nil {
7888 return resp , err
@@ -158,6 +168,23 @@ func (t *KBFSTLFInfoSource) identifyTLF(ctx context.Context, arg keybase1.TLFQue
158168}
159169
160170func (t * KBFSTLFInfoSource ) identifyUser (ctx context.Context , assertion string , private bool , idBehavior keybase1.TLFIdentifyBehavior ) (keybase1.TLFIdentifyFailure , error ) {
171+
172+ // if an identify UI is registered, then use it
173+ sessionID , idUI , err := t .G ().UIRouter .GetIdentifyUICtx (ctx )
174+ if err != nil {
175+ return keybase1.TLFIdentifyFailure {}, err
176+ }
177+
178+ if idUI == nil {
179+ if t .identifier != nil {
180+ t .G ().Log .Debug ("using KBFSTLFInfoSource.identifier to identify" )
181+ return t .identifier .Identify (ctx , assertion , private , idBehavior )
182+ }
183+
184+ sessionID = 0
185+ idUI = chatNullIdentifyUI {}
186+ }
187+
161188 reason := "You accessed a public conversation."
162189 if private {
163190 reason = fmt .Sprintf ("You accessed a private conversation with %s." , assertion )
@@ -171,11 +198,6 @@ func (t *KBFSTLFInfoSource) identifyUser(ctx context.Context, assertion string,
171198 IdentifyBehavior : idBehavior ,
172199 }
173200
174- sessionID , idUI , err := t .G ().UIRouter .GetIdentifyUICtx (ctx )
175- if err != nil {
176- return keybase1.TLFIdentifyFailure {}, err
177- }
178-
179201 ectx := engine.Context {
180202 IdentifyUI : idUI ,
181203 SessionID : sessionID ,
0 commit comments