@kubun/plugin-credential 0.17.4 → 0.17.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/service.js +28 -0
- package/package.json +3 -3
package/lib/service.js
CHANGED
|
@@ -151,6 +151,15 @@ function readAccountPeek(raw) {
|
|
|
151
151
|
proceed: ()=>readSeam.getCredential(param.providerName, param.ownerDID)
|
|
152
152
|
});
|
|
153
153
|
},
|
|
154
|
+
'credential/get-ref': (context)=>{
|
|
155
|
+
const param = context.param;
|
|
156
|
+
return authorizeRead({
|
|
157
|
+
context,
|
|
158
|
+
subject: param.ownerDID,
|
|
159
|
+
emptyResult: null,
|
|
160
|
+
proceed: ()=>readSeam.getCredentialRef(param.providerName, param.ownerDID)
|
|
161
|
+
});
|
|
162
|
+
},
|
|
154
163
|
// The same vault read as `credential/get` — the DB credential API, which
|
|
155
164
|
// never refreshes a token — narrowed to the provider account and the
|
|
156
165
|
// granted scopes: no token material leaves the vault on a peek.
|
|
@@ -211,6 +220,19 @@ function readAccountPeek(raw) {
|
|
|
211
220
|
await writeInTx((seam)=>seam.setCredential(param.providerName, param.ownerDID, param.credential));
|
|
212
221
|
return null;
|
|
213
222
|
},
|
|
223
|
+
'credential/refresh-entry': async (context)=>{
|
|
224
|
+
const param = context.param;
|
|
225
|
+
await authorizeWrite({
|
|
226
|
+
context,
|
|
227
|
+
subject: param.ownerDID
|
|
228
|
+
});
|
|
229
|
+
return writeInTx(async (seam)=>{
|
|
230
|
+
// The authorized alias must still name the entry being refreshed.
|
|
231
|
+
const ref = await seam.getCredentialRef(param.providerName, param.ownerDID);
|
|
232
|
+
if (ref?.entryID !== param.entryID) return 'absent';
|
|
233
|
+
return seam.setCredentialForEntry(param);
|
|
234
|
+
});
|
|
235
|
+
},
|
|
214
236
|
'credential/delete': async (context)=>{
|
|
215
237
|
const param = context.param;
|
|
216
238
|
await authorizeWrite({
|
|
@@ -241,6 +263,9 @@ function readAccountPeek(raw) {
|
|
|
241
263
|
'credential/get': {
|
|
242
264
|
allow: true
|
|
243
265
|
},
|
|
266
|
+
'credential/get-ref': {
|
|
267
|
+
allow: true
|
|
268
|
+
},
|
|
244
269
|
'credential/peek': {
|
|
245
270
|
allow: true
|
|
246
271
|
},
|
|
@@ -253,6 +278,9 @@ function readAccountPeek(raw) {
|
|
|
253
278
|
'credential/refresh': {
|
|
254
279
|
allow: true
|
|
255
280
|
},
|
|
281
|
+
'credential/refresh-entry': {
|
|
282
|
+
allow: true
|
|
283
|
+
},
|
|
256
284
|
'credential/delete': {
|
|
257
285
|
allow: true
|
|
258
286
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubun/plugin-credential",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.5",
|
|
4
4
|
"license": "see LICENSE.md",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@kokuin/token": "^0.5.0",
|
|
18
18
|
"@kubun/credential": "^0.17.4",
|
|
19
19
|
"@kubun/db": "^0.17.0",
|
|
20
|
-
"@kubun/engine": "^0.17.
|
|
20
|
+
"@kubun/engine": "^0.17.3",
|
|
21
21
|
"@kubun/graphql": "^0.17.2",
|
|
22
22
|
"@kubun/hlc": "^0.17.0",
|
|
23
23
|
"@kubun/id": "^0.17.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@kokuin/capability": "^0.3.0",
|
|
36
36
|
"@kokuin/controller": "^0.1.0",
|
|
37
37
|
"@kubun/db-better-sqlite": "^0.17.0",
|
|
38
|
-
"@kubun/service-credential-api": "^0.17.
|
|
38
|
+
"@kubun/service-credential-api": "^0.17.3",
|
|
39
39
|
"@kubun/store-controller": "^0.17.0",
|
|
40
40
|
"@kubun/store-graph": "^0.17.1",
|
|
41
41
|
"@kubun/test-utils": "^0.0.0"
|