Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
0299fd43
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
0299fd43
编写于
9月 24, 2020
作者:
B
Benjamin Pasero
提交者:
GitHub
9月 24, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sandbox - move keytar into native host service (#107292)
上级
635cfbcd
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
95 addition
and
54 deletion
+95
-54
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
.../code/electron-browser/sharedProcess/sharedProcessMain.ts
+0
-3
src/vs/platform/credentials/node/credentialsService.ts
src/vs/platform/credentials/node/credentialsService.ts
+0
-40
src/vs/platform/native/common/native.ts
src/vs/platform/native/common/native.ts
+7
-0
src/vs/platform/native/electron-main/nativeHostMainService.ts
...vs/platform/native/electron-main/nativeHostMainService.ts
+36
-0
src/vs/workbench/api/browser/mainThreadKeytar.ts
src/vs/workbench/api/browser/mainThreadKeytar.ts
+1
-1
src/vs/workbench/services/credentials/browser/credentialsService.ts
...kbench/services/credentials/browser/credentialsService.ts
+1
-1
src/vs/workbench/services/credentials/common/credentials.ts
src/vs/workbench/services/credentials/common/credentials.ts
+6
-5
src/vs/workbench/services/credentials/electron-sandbox/credentialsService.ts
...rvices/credentials/electron-sandbox/credentialsService.ts
+37
-0
src/vs/workbench/test/electron-browser/workbenchTestServices.ts
.../workbench/test/electron-browser/workbenchTestServices.ts
+5
-0
src/vs/workbench/workbench.desktop.main.ts
src/vs/workbench/workbench.desktop.main.ts
+0
-3
src/vs/workbench/workbench.sandbox.main.ts
src/vs/workbench/workbench.sandbox.main.ts
+1
-0
src/vs/workbench/workbench.web.api.ts
src/vs/workbench/workbench.web.api.ts
+1
-1
未找到文件。
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
浏览文件 @
0299fd43
...
...
@@ -55,8 +55,6 @@ import { UserDataSyncChannel, UserDataSyncUtilServiceClient, UserDataAutoSyncCha
import
{
INativeHostService
}
from
'
vs/platform/native/electron-sandbox/native
'
;
import
{
LoggerService
}
from
'
vs/platform/log/node/loggerService
'
;
import
{
UserDataSyncLogService
}
from
'
vs/platform/userDataSync/common/userDataSyncLog
'
;
import
{
ICredentialsService
}
from
'
vs/platform/credentials/common/credentials
'
;
import
{
KeytarCredentialsService
}
from
'
vs/platform/credentials/node/credentialsService
'
;
import
{
UserDataAutoSyncService
}
from
'
vs/platform/userDataSync/electron-sandbox/userDataAutoSyncService
'
;
import
{
NativeStorageService
}
from
'
vs/platform/storage/node/storageService
'
;
import
{
GlobalStorageDatabaseChannelClient
}
from
'
vs/platform/storage/node/storageIpc
'
;
...
...
@@ -198,7 +196,6 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
services
.
set
(
IDiagnosticsService
,
new
SyncDescriptor
(
DiagnosticsService
));
services
.
set
(
IExtensionTipsService
,
new
SyncDescriptor
(
ExtensionTipsService
));
services
.
set
(
ICredentialsService
,
new
SyncDescriptor
(
KeytarCredentialsService
));
services
.
set
(
IUserDataSyncAccountService
,
new
SyncDescriptor
(
UserDataSyncAccountService
));
services
.
set
(
IUserDataSyncLogService
,
new
SyncDescriptor
(
UserDataSyncLogService
));
services
.
set
(
IUserDataSyncUtilService
,
new
UserDataSyncUtilServiceClient
(
server
.
getChannel
(
'
userDataSyncUtil
'
,
client
=>
client
.
ctx
!==
'
main
'
)));
...
...
src/vs/platform/credentials/node/credentialsService.ts
已删除
100644 → 0
浏览文件 @
635cfbcd
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
type
*
as
keytar
from
'
keytar
'
;
import
{
ICredentialsService
}
from
'
vs/platform/credentials/common/credentials
'
;
import
{
IdleValue
}
from
'
vs/base/common/async
'
;
export
class
KeytarCredentialsService
implements
ICredentialsService
{
declare
readonly
_serviceBrand
:
undefined
;
private
readonly
_keytar
=
new
IdleValue
<
Promise
<
typeof
keytar
>>
(()
=>
import
(
'
keytar
'
));
async
getPassword
(
service
:
string
,
account
:
string
):
Promise
<
string
|
null
>
{
const
keytar
=
await
this
.
_keytar
.
value
;
return
keytar
.
getPassword
(
service
,
account
);
}
async
setPassword
(
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
{
const
keytar
=
await
this
.
_keytar
.
value
;
return
keytar
.
setPassword
(
service
,
account
,
password
);
}
async
deletePassword
(
service
:
string
,
account
:
string
):
Promise
<
boolean
>
{
const
keytar
=
await
this
.
_keytar
.
value
;
return
keytar
.
deletePassword
(
service
,
account
);
}
async
findPassword
(
service
:
string
):
Promise
<
string
|
null
>
{
const
keytar
=
await
this
.
_keytar
.
value
;
return
keytar
.
findPassword
(
service
);
}
async
findCredentials
(
service
:
string
):
Promise
<
Array
<
{
account
:
string
,
password
:
string
}
>>
{
const
keytar
=
await
this
.
_keytar
.
value
;
return
keytar
.
findCredentials
(
service
);
}
}
src/vs/platform/native/common/native.ts
浏览文件 @
0299fd43
...
...
@@ -141,4 +141,11 @@ export interface ICommonNativeHostService {
// Registry (windows only)
windowsGetStringRegKey
(
hive
:
'
HKEY_CURRENT_USER
'
|
'
HKEY_LOCAL_MACHINE
'
|
'
HKEY_CLASSES_ROOT
'
|
'
HKEY_USERS
'
|
'
HKEY_CURRENT_CONFIG
'
,
path
:
string
,
name
:
string
):
Promise
<
string
|
undefined
>
;
// Credentials
getPassword
(
service
:
string
,
account
:
string
):
Promise
<
string
|
null
>
;
setPassword
(
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
;
deletePassword
(
service
:
string
,
account
:
string
):
Promise
<
boolean
>
;
findPassword
(
service
:
string
):
Promise
<
string
|
null
>
;
findCredentials
(
service
:
string
):
Promise
<
Array
<
{
account
:
string
,
password
:
string
}
>>
}
src/vs/platform/native/electron-main/nativeHostMainService.ts
浏览文件 @
0299fd43
...
...
@@ -610,6 +610,42 @@ export class NativeHostMainService implements INativeHostMainService {
}
}
//#endregion
//#region Credentials
async
getPassword
(
windowId
:
number
|
undefined
,
service
:
string
,
account
:
string
):
Promise
<
string
|
null
>
{
const
keytar
=
await
import
(
'
keytar
'
);
return
keytar
.
getPassword
(
service
,
account
);
}
async
setPassword
(
windowId
:
number
|
undefined
,
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
{
const
keytar
=
await
import
(
'
keytar
'
);
return
keytar
.
setPassword
(
service
,
account
,
password
);
}
async
deletePassword
(
windowId
:
number
|
undefined
,
service
:
string
,
account
:
string
):
Promise
<
boolean
>
{
const
keytar
=
await
import
(
'
keytar
'
);
return
keytar
.
deletePassword
(
service
,
account
);
}
async
findPassword
(
windowId
:
number
|
undefined
,
service
:
string
):
Promise
<
string
|
null
>
{
const
keytar
=
await
import
(
'
keytar
'
);
return
keytar
.
findPassword
(
service
);
}
async
findCredentials
(
windowId
:
number
|
undefined
,
service
:
string
):
Promise
<
Array
<
{
account
:
string
,
password
:
string
}
>>
{
const
keytar
=
await
import
(
'
keytar
'
);
return
keytar
.
findCredentials
(
service
);
}
//#endregion
private
windowById
(
windowId
:
number
|
undefined
):
ICodeWindow
|
undefined
{
if
(
typeof
windowId
!==
'
number
'
)
{
return
undefined
;
...
...
src/vs/workbench/api/browser/mainThreadKeytar.ts
浏览文件 @
0299fd43
...
...
@@ -5,7 +5,7 @@
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
MainContext
,
MainThreadKeytarShape
,
IExtHostContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ICredentialsService
}
from
'
vs/
platform
/credentials/common/credentials
'
;
import
{
ICredentialsService
}
from
'
vs/
workbench/services
/credentials/common/credentials
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadKeytar
)
export
class
MainThreadKeytar
implements
MainThreadKeytarShape
{
...
...
src/vs/workbench/services/credentials/browser/credentialsService.ts
浏览文件 @
0299fd43
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ICredentials
Provider
,
ICredentialsService
}
from
'
vs/platform
/credentials/common/credentials
'
;
import
{
ICredentials
Service
,
ICredentialsProvider
}
from
'
vs/workbench/services
/credentials/common/credentials
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
...
...
src/vs/workbench/services/credentials/common/credentials.ts
浏览文件 @
0299fd43
...
...
@@ -5,15 +5,16 @@
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
export
const
ICredentialsService
=
createDecorator
<
ICredentialsService
>
(
'
ICredentialsService
'
);
export
interface
ICredentialsService
{
readonly
_serviceBrand
:
undefined
;
export
const
ICredentialsService
=
createDecorator
<
ICredentialsService
>
(
'
credentialsService
'
);
export
interface
ICredentialsProvider
{
getPassword
(
service
:
string
,
account
:
string
):
Promise
<
string
|
null
>
;
setPassword
(
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
;
deletePassword
(
service
:
string
,
account
:
string
):
Promise
<
boolean
>
;
findPassword
(
service
:
string
):
Promise
<
string
|
null
>
;
findCredentials
(
service
:
string
):
Promise
<
Array
<
{
account
:
string
,
password
:
string
}
>>
;
}
export
interface
ICredentialsService
extends
ICredentialsProvider
{
readonly
_serviceBrand
:
undefined
;
}
src/vs/
platform/credentials/common/credentials
.ts
→
src/vs/
workbench/services/credentials/electron-sandbox/credentialsService
.ts
浏览文件 @
0299fd43
...
...
@@ -3,18 +3,35 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
export
interface
ICredentialsProvider
{
getPassword
(
service
:
string
,
account
:
string
):
Promise
<
string
|
null
>
;
setPassword
(
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
;
deletePassword
(
service
:
string
,
account
:
string
):
Promise
<
boolean
>
;
findPassword
(
service
:
string
):
Promise
<
string
|
null
>
;
findCredentials
(
service
:
string
):
Promise
<
Array
<
{
account
:
string
,
password
:
string
}
>>
;
}
import
{
ICredentialsService
}
from
'
vs/workbench/services/credentials/common/credentials
'
;
import
{
INativeHostService
}
from
'
vs/platform/native/electron-sandbox/native
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
export
class
KeytarCredentialsService
implements
ICredentialsService
{
declare
readonly
_serviceBrand
:
undefined
;
constructor
(@
INativeHostService
private
readonly
nativeHostService
:
INativeHostService
)
{
}
export
const
ICredentialsService
=
createDecorator
<
ICredentialsService
>
(
'
ICredentialsService
'
);
getPassword
(
service
:
string
,
account
:
string
):
Promise
<
string
|
null
>
{
return
this
.
nativeHostService
.
getPassword
(
service
,
account
);
}
export
interface
ICredentialsService
extends
ICredentialsProvider
{
readonly
_serviceBrand
:
undefined
;
setPassword
(
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
{
return
this
.
nativeHostService
.
setPassword
(
service
,
account
,
password
);
}
deletePassword
(
service
:
string
,
account
:
string
):
Promise
<
boolean
>
{
return
this
.
nativeHostService
.
deletePassword
(
service
,
account
);
}
findPassword
(
service
:
string
):
Promise
<
string
|
null
>
{
return
this
.
nativeHostService
.
findPassword
(
service
);
}
findCredentials
(
service
:
string
):
Promise
<
Array
<
{
account
:
string
,
password
:
string
}
>>
{
return
this
.
nativeHostService
.
findCredentials
(
service
);
}
}
registerSingleton
(
ICredentialsService
,
KeytarCredentialsService
,
true
);
src/vs/workbench/test/electron-browser/workbenchTestServices.ts
浏览文件 @
0299fd43
...
...
@@ -232,6 +232,11 @@ export class TestNativeHostService implements INativeHostService {
async
hasClipboard
(
format
:
string
,
type
?:
'
selection
'
|
'
clipboard
'
|
undefined
):
Promise
<
boolean
>
{
return
false
;
}
async
sendInputEvent
(
event
:
MouseInputEvent
):
Promise
<
void
>
{
}
async
windowsGetStringRegKey
(
hive
:
'
HKEY_CURRENT_USER
'
|
'
HKEY_LOCAL_MACHINE
'
|
'
HKEY_CLASSES_ROOT
'
|
'
HKEY_USERS
'
|
'
HKEY_CURRENT_CONFIG
'
,
path
:
string
,
name
:
string
):
Promise
<
string
|
undefined
>
{
return
undefined
;
}
async
getPassword
(
service
:
string
,
account
:
string
):
Promise
<
string
|
null
>
{
return
null
;
}
async
setPassword
(
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
{
}
async
deletePassword
(
service
:
string
,
account
:
string
):
Promise
<
boolean
>
{
return
false
;
}
async
findPassword
(
service
:
string
):
Promise
<
string
|
null
>
{
return
null
;
}
async
findCredentials
(
service
:
string
):
Promise
<
{
account
:
string
;
password
:
string
;
}[]
>
{
return
[];
}
}
export
function
workbenchInstantiationService
():
ITestInstantiationService
{
...
...
src/vs/workbench/workbench.desktop.main.ts
浏览文件 @
0299fd43
...
...
@@ -97,12 +97,9 @@ import 'vs/workbench/services/diagnostics/electron-browser/diagnosticsService';
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
ICredentialsService
}
from
'
vs/platform/credentials/common/credentials
'
;
import
{
KeytarCredentialsService
}
from
'
vs/platform/credentials/node/credentialsService
'
;
import
{
ITunnelService
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
TunnelService
}
from
'
vs/platform/remote/node/tunnelService
'
;
registerSingleton
(
ICredentialsService
,
KeytarCredentialsService
,
true
);
registerSingleton
(
ITunnelService
,
TunnelService
);
//#endregion
...
...
src/vs/workbench/workbench.sandbox.main.ts
浏览文件 @
0299fd43
...
...
@@ -41,6 +41,7 @@ import 'vs/workbench/services/accessibility/electron-sandbox/accessibilityServic
import
'
vs/workbench/services/path/electron-sandbox/pathService
'
;
import
'
vs/workbench/services/themes/electron-sandbox/nativeHostColorSchemeService
'
;
import
'
vs/workbench/services/extensionManagement/electron-sandbox/extensionManagementService
'
;
import
'
vs/workbench/services/credentials/electron-sandbox/credentialsService
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
ITimerService
}
from
'
vs/workbench/services/timer/browser/timerService
'
;
...
...
src/vs/workbench/workbench.web.api.ts
浏览文件 @
0299fd43
...
...
@@ -18,7 +18,7 @@ import { IWorkspaceProvider, IWorkspace } from 'vs/workbench/services/host/brows
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IProductConfiguration
}
from
'
vs/platform/product/common/productService
'
;
import
{
mark
}
from
'
vs/base/common/performance
'
;
import
{
ICredentialsProvider
}
from
'
vs/
platform
/credentials/common/credentials
'
;
import
{
ICredentialsProvider
}
from
'
vs/
workbench/services
/credentials/common/credentials
'
;
interface
IResourceUriProvider
{
(
uri
:
URI
):
URI
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录