Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2e89c2d4
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2e89c2d4
编写于
1月 15, 2021
作者:
R
Rachel Macfarlane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add 'key' to onDidChange of secrets API, #112249
上级
c5f0bac2
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
43 addition
and
23 deletion
+43
-23
src/vs/platform/native/common/native.ts
src/vs/platform/native/common/native.ts
+1
-1
src/vs/platform/native/electron-main/nativeHostMainService.ts
...vs/platform/native/electron-main/nativeHostMainService.ts
+3
-3
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+11
-1
src/vs/workbench/api/browser/mainThreadSecretState.ts
src/vs/workbench/api/browser/mainThreadSecretState.ts
+3
-2
src/vs/workbench/api/common/exHostSecretState.ts
src/vs/workbench/api/common/exHostSecretState.ts
+5
-5
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-1
src/vs/workbench/api/common/extHostSecrets.ts
src/vs/workbench/api/common/extHostSecrets.ts
+7
-3
src/vs/workbench/services/credentials/browser/credentialsService.ts
...kbench/services/credentials/browser/credentialsService.ts
+4
-4
src/vs/workbench/services/credentials/common/credentials.ts
src/vs/workbench/services/credentials/common/credentials.ts
+6
-1
src/vs/workbench/services/credentials/electron-sandbox/credentialsService.ts
...rvices/credentials/electron-sandbox/credentialsService.ts
+2
-2
未找到文件。
src/vs/platform/native/common/native.ts
浏览文件 @
2e89c2d4
...
...
@@ -49,7 +49,7 @@ export interface ICommonNativeHostService {
readonly
onDidChangeColorScheme
:
Event
<
IColorScheme
>
;
readonly
onDidChangePassword
:
Event
<
void
>
;
readonly
onDidChangePassword
:
Event
<
{
service
:
string
,
account
:
string
}
>
;
// Window
getWindows
():
Promise
<
IOpenedWindow
[]
>
;
...
...
src/vs/platform/native/electron-main/nativeHostMainService.ts
浏览文件 @
2e89c2d4
...
...
@@ -90,7 +90,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
private
readonly
_onDidChangeColorScheme
=
this
.
_register
(
new
Emitter
<
IColorScheme
>
());
readonly
onDidChangeColorScheme
=
this
.
_onDidChangeColorScheme
.
event
;
private
readonly
_onDidChangePassword
=
this
.
_register
(
new
Emitter
<
void
>
());
private
readonly
_onDidChangePassword
=
this
.
_register
(
new
Emitter
<
{
account
:
string
,
service
:
string
}
>
());
readonly
onDidChangePassword
=
this
.
_onDidChangePassword
.
event
;
//#endregion
...
...
@@ -705,7 +705,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
await
keytar
.
setPassword
(
service
,
account
,
password
);
}
this
.
_onDidChangePassword
.
fire
();
this
.
_onDidChangePassword
.
fire
(
{
service
,
account
}
);
}
async
deletePassword
(
windowId
:
number
|
undefined
,
service
:
string
,
account
:
string
):
Promise
<
boolean
>
{
...
...
@@ -713,7 +713,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
const
didDelete
=
await
keytar
.
deletePassword
(
service
,
account
);
if
(
didDelete
)
{
this
.
_onDidChangePassword
.
fire
();
this
.
_onDidChangePassword
.
fire
(
{
service
,
account
}
);
}
return
didDelete
;
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
2e89c2d4
...
...
@@ -2424,6 +2424,16 @@ declare module 'vscode' {
//#region https://github.com/microsoft/vscode/issues/112249
/**
* The event data that is fired when a secret is added or removed.
*/
export
interface
SecretStorageChangeEvent
{
/**
* The key of the secret that has changed.
*/
key
:
string
;
}
/**
* Represents a storage utility for secrets, information that is
* sensitive.
...
...
@@ -2453,7 +2463,7 @@ declare module 'vscode' {
/**
* Fires when a secret is set or deleted.
*/
onDidChange
:
Event
<
void
>
;
onDidChange
:
Event
<
SecretStorageChangeEvent
>
;
}
export
interface
ExtensionContext
{
...
...
src/vs/workbench/api/browser/mainThreadSecretState.ts
浏览文件 @
2e89c2d4
...
...
@@ -23,8 +23,9 @@ export class MainThreadSecretState extends Disposable implements MainThreadSecre
super
();
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostSecretState
);
this
.
_register
(
this
.
credentialsService
.
onDidChangePassword
(
_
=>
{
this
.
_proxy
.
$onDidChangePassword
();
this
.
_register
(
this
.
credentialsService
.
onDidChangePassword
(
e
=>
{
const
extensionId
=
e
.
service
.
substring
(
this
.
productService
.
urlProtocol
.
length
);
this
.
_proxy
.
$onDidChangePassword
({
extensionId
,
key
:
e
.
account
});
}));
}
...
...
src/vs/workbench/api/common/exHostSecretState.ts
浏览文件 @
2e89c2d4
...
...
@@ -4,21 +4,21 @@
*--------------------------------------------------------------------------------------------*/
import
{
ExtHostSecretStateShape
,
MainContext
,
MainThreadSecretStateShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/extHostRpcService
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
export
class
ExtHostSecretState
implements
ExtHostSecretStateShape
{
private
_proxy
:
MainThreadSecretStateShape
;
private
_onDidChangePassword
=
new
Emitter
<
void
>
();
readonly
onDidChangePassword
:
Event
<
void
>
=
this
.
_onDidChangePassword
.
event
;
private
_onDidChangePassword
=
new
Emitter
<
{
extensionId
:
string
,
key
:
string
}
>
();
readonly
onDidChangePassword
=
this
.
_onDidChangePassword
.
event
;
constructor
(
mainContext
:
IExtHostRpcService
)
{
this
.
_proxy
=
mainContext
.
getProxy
(
MainContext
.
MainThreadSecretState
);
}
async
$onDidChangePassword
():
Promise
<
void
>
{
this
.
_onDidChangePassword
.
fire
();
async
$onDidChangePassword
(
e
:
{
extensionId
:
string
,
key
:
string
}
):
Promise
<
void
>
{
this
.
_onDidChangePassword
.
fire
(
e
);
}
get
(
extensionId
:
string
,
key
:
string
):
Promise
<
string
|
undefined
>
{
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
2e89c2d4
...
...
@@ -1130,7 +1130,7 @@ export interface ExtHostAuthenticationShape {
}
export
interface
ExtHostSecretStateShape
{
$onDidChangePassword
():
Promise
<
void
>
;
$onDidChangePassword
(
e
:
{
extensionId
:
string
,
key
:
string
}
):
Promise
<
void
>
;
}
export
interface
ExtHostSearchShape
{
...
...
src/vs/workbench/api/common/extHostSecrets.ts
浏览文件 @
2e89c2d4
...
...
@@ -14,15 +14,19 @@ export class ExtensionSecrets implements vscode.SecretStorage {
protected
readonly
_id
:
string
;
protected
readonly
_secretState
:
ExtHostSecretState
;
private
_onDidChange
=
new
Emitter
<
v
oid
>
();
readonly
onDidChange
:
Event
<
v
oid
>
=
this
.
_onDidChange
.
event
;
private
_onDidChange
=
new
Emitter
<
v
scode
.
SecretStorageChangeEvent
>
();
readonly
onDidChange
:
Event
<
v
scode
.
SecretStorageChangeEvent
>
=
this
.
_onDidChange
.
event
;
constructor
(
extensionDescription
:
IExtensionDescription
,
secretState
:
ExtHostSecretState
)
{
this
.
_id
=
ExtensionIdentifier
.
toKey
(
extensionDescription
.
identifier
);
this
.
_secretState
=
secretState
;
this
.
_secretState
.
onDidChangePassword
(
_
=>
this
.
_onDidChange
.
fire
());
this
.
_secretState
.
onDidChangePassword
(
e
=>
{
if
(
e
.
extensionId
===
this
.
_id
)
{
this
.
_onDidChange
.
fire
({
key
:
e
.
key
});
}
});
}
get
(
key
:
string
):
Promise
<
string
|
undefined
>
{
...
...
src/vs/workbench/services/credentials/browser/credentialsService.ts
浏览文件 @
2e89c2d4
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ICredentialsService
,
ICredentialsProvider
}
from
'
vs/workbench/services/credentials/common/credentials
'
;
import
{
ICredentialsService
,
ICredentialsProvider
,
ICredentialsChangeEvent
}
from
'
vs/workbench/services/credentials/common/credentials
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
...
...
@@ -13,7 +13,7 @@ export class BrowserCredentialsService extends Disposable implements ICredential
declare
readonly
_serviceBrand
:
undefined
;
private
_onDidChangePassword
=
this
.
_register
(
new
Emitter
<
void
>
());
private
_onDidChangePassword
=
this
.
_register
(
new
Emitter
<
ICredentialsChangeEvent
>
());
readonly
onDidChangePassword
=
this
.
_onDidChangePassword
.
event
;
private
credentialsProvider
:
ICredentialsProvider
;
...
...
@@ -35,13 +35,13 @@ export class BrowserCredentialsService extends Disposable implements ICredential
async
setPassword
(
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
{
await
this
.
credentialsProvider
.
setPassword
(
service
,
account
,
password
);
this
.
_onDidChangePassword
.
fire
();
this
.
_onDidChangePassword
.
fire
(
{
service
,
account
}
);
}
deletePassword
(
service
:
string
,
account
:
string
):
Promise
<
boolean
>
{
const
didDelete
=
this
.
credentialsProvider
.
deletePassword
(
service
,
account
);
if
(
didDelete
)
{
this
.
_onDidChangePassword
.
fire
();
this
.
_onDidChangePassword
.
fire
(
{
service
,
account
}
);
}
return
didDelete
;
...
...
src/vs/workbench/services/credentials/common/credentials.ts
浏览文件 @
2e89c2d4
...
...
@@ -16,7 +16,12 @@ export interface ICredentialsProvider {
findCredentials
(
service
:
string
):
Promise
<
Array
<
{
account
:
string
,
password
:
string
}
>>
;
}
export
interface
ICredentialsChangeEvent
{
service
:
string
account
:
string
;
}
export
interface
ICredentialsService
extends
ICredentialsProvider
{
readonly
_serviceBrand
:
undefined
;
readonly
onDidChangePassword
:
Event
<
void
>
;
readonly
onDidChangePassword
:
Event
<
ICredentialsChangeEvent
>
;
}
src/vs/workbench/services/credentials/electron-sandbox/credentialsService.ts
浏览文件 @
2e89c2d4
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ICredentialsService
}
from
'
vs/workbench/services/credentials/common/credentials
'
;
import
{
ICredentials
ChangeEvent
,
ICredentials
Service
}
from
'
vs/workbench/services/credentials/common/credentials
'
;
import
{
INativeHostService
}
from
'
vs/platform/native/electron-sandbox/native
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
...
...
@@ -13,7 +13,7 @@ export class KeytarCredentialsService extends Disposable implements ICredentials
declare
readonly
_serviceBrand
:
undefined
;
private
_onDidChangePassword
:
Emitter
<
void
>
=
this
.
_register
(
new
Emitter
());
private
_onDidChangePassword
:
Emitter
<
ICredentialsChangeEvent
>
=
this
.
_register
(
new
Emitter
());
readonly
onDidChangePassword
=
this
.
_onDidChangePassword
.
event
;
constructor
(@
INativeHostService
private
readonly
nativeHostService
:
INativeHostService
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录