MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / DuoTwoFacInteractor

Class DuoTwoFacInteractor

Extension/src/SSH/commandInteractors.ts:288–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286
287// https://github.com/microsoft/vscode-remote-release/issues/2170
288export class DuoTwoFacInteractor implements IInteractor {
289 static ID = 'duo-2fa';
290
291 constructor(private readonly verificationCodeProvider: IVerificationCodeProvider) { }
292
293 get id(): string {
294 return DuoTwoFacInteractor.ID;
295 }
296
297 async onData(data: string, cancelToken?: vscode.CancellationToken): Promise<IInteraction> {
298 const result: IInteraction = { postAction: 'keep' };
299 if (data.includes('Passcode:')) {
300 result.postAction = 'consume';
301 const verificationCode: string | undefined = await this.verificationCodeProvider('Enter passcode', cancelToken);
302 if (typeof verificationCode === 'string') {
303 result.response = verificationCode;
304 result.isPassword = true;
305 } else {
306 result.canceled = true;
307 }
308 }
309
310 return result;
311 }
312}
313
314export class ContinueOnInteractor implements IInteractor {
315 static ID = 'continueOn';

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected