| 259 | (msg: string, cancelToken?: vscode.CancellationToken) => Promise<string | undefined>; |
| 260 | |
| 261 | export class TwoFacInteractor implements IInteractor { |
| 262 | static ID = '2fa'; |
| 263 | |
| 264 | constructor(private readonly verificationCodeProvider: IVerificationCodeProvider) { } |
| 265 | |
| 266 | get id(): string { |
| 267 | return TwoFacInteractor.ID; |
| 268 | } |
| 269 | |
| 270 | async onData(data: string, cancelToken?: vscode.CancellationToken): Promise<IInteraction> { |
| 271 | const result: IInteraction = { postAction: 'keep' }; |
| 272 | if (data.includes('Verification code:')) { |
| 273 | result.postAction = 'consume'; |
| 274 | const verificationCode: string | undefined = await this.verificationCodeProvider('Enter verification code', cancelToken); |
| 275 | if (typeof verificationCode === 'string') { |
| 276 | result.response = verificationCode; |
| 277 | result.isPassword = true; |
| 278 | } else { |
| 279 | result.canceled = true; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | return result; |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | // https://github.com/microsoft/vscode-remote-release/issues/2170 |
| 288 | export class DuoTwoFacInteractor implements IInteractor { |
nothing calls this directly
no outgoing calls
no test coverage detected