| 286 | |
| 287 | // https://github.com/microsoft/vscode-remote-release/issues/2170 |
| 288 | export 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 | |
| 314 | export class ContinueOnInteractor implements IInteractor { |
| 315 | static ID = 'continueOn'; |
nothing calls this directly
no outgoing calls
no test coverage detected