forked from irinazheltisheva/vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignService.ts
More file actions
35 lines (30 loc) · 1.09 KB
/
Copy pathsignService.ts
File metadata and controls
35 lines (30 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ISignService } from 'vs/platform/sign/common/sign';
declare module vsda {
// the signer is a native module that for historical reasons uses a lower case class name
// eslint-disable-next-line @typescript-eslint/naming-convention
export class signer {
sign(arg: any): any;
}
}
export class SignService implements ISignService {
declare readonly _serviceBrand: undefined;
private vsda(): Promise<typeof vsda> {
return new Promise((resolve, reject) => require(['vsda'], resolve, reject));
}
async sign(value: string): Promise<string> {
try {
const vsda = await this.vsda();
const signer = new vsda.signer();
if (signer) {
return signer.sign(value);
}
} catch (e) {
// ignore errors silently
}
return value;
}
}