@kubun/plugin-connector 0.13.0 → 0.13.1
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/api.d.ts +8 -0
- package/lib/api.js +3 -0
- package/lib/oauth.js +7 -1
- package/package.json +15 -15
package/lib/api.d.ts
CHANGED
|
@@ -65,6 +65,14 @@ export type ConnectorAPI = {
|
|
|
65
65
|
createPendingAuth: (record: PendingAuthRecord) => Promise<void>;
|
|
66
66
|
consumePendingAuth: (state: string) => Promise<PendingAuthRecord | null>;
|
|
67
67
|
deleteExpiredPendingAuth: (cutoffMs: number) => Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* The controller resolvers for this API's (request-scoped) transaction
|
|
70
|
+
* provider — the exact `methods` the credential mint passes to `createKey`.
|
|
71
|
+
* Exposed so the OAuth pre-flight can ask `canWrapTo` with the same resolver
|
|
72
|
+
* the mint uses, rather than failing closed on a `did:kokuin:` owner whose
|
|
73
|
+
* agreement key is resolvable only through the controller resolver.
|
|
74
|
+
*/
|
|
75
|
+
getControllerMethods: () => MethodRegistry;
|
|
68
76
|
};
|
|
69
77
|
export type CreateConnectorAPIParams = {
|
|
70
78
|
stores: StoreProvider;
|
package/lib/api.js
CHANGED
|
@@ -189,6 +189,9 @@ export function createConnectorAPI(params) {
|
|
|
189
189
|
async deleteExpiredPendingAuth (cutoffMs) {
|
|
190
190
|
const store = await getStore();
|
|
191
191
|
await store.deleteExpiredPendingAuth(cutoffMs);
|
|
192
|
+
},
|
|
193
|
+
getControllerMethods () {
|
|
194
|
+
return params.getControllerMethods(params.stores);
|
|
192
195
|
}
|
|
193
196
|
};
|
|
194
197
|
}
|
package/lib/oauth.js
CHANGED
|
@@ -39,7 +39,13 @@ export class OAuthService {
|
|
|
39
39
|
// then the pending row is consumed and the authorization code is spent, so
|
|
40
40
|
// the provider has issued a real token pair that the failure discards and
|
|
41
41
|
// the user has to run the whole dance again.
|
|
42
|
-
|
|
42
|
+
//
|
|
43
|
+
// Resolved with the same controller `methods` the mint's `createKey` uses,
|
|
44
|
+
// so the guard cannot be stricter than the operation it guards: a
|
|
45
|
+
// `did:kokuin:` owner's agreement key resolves only through the controller
|
|
46
|
+
// resolver, and asking without it would fail closed and block a flow the
|
|
47
|
+
// mint would have completed.
|
|
48
|
+
if (!await canWrapTo(ownerWrappableDID, api.getControllerMethods())) {
|
|
43
49
|
throw new Error(`Cannot start OAuth for "${args.provider}": nothing can be encrypted to "${ownerWrappableDID}", so the credential's owner could never read it. Pass \`viewerWrappableDID\` — for a did:peer:4 viewer that is the long form, which carries the agreement key.`);
|
|
44
50
|
}
|
|
45
51
|
// Carried to the mint like the owner's wrappable DID; it becomes a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubun/plugin-connector",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"license": "see LICENSE.md",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -26,34 +26,34 @@
|
|
|
26
26
|
"graphql": "^16.14.2",
|
|
27
27
|
"graphql-scalars": "^2.0.0",
|
|
28
28
|
"kysely": "^0.29.5",
|
|
29
|
-
"@kubun/
|
|
30
|
-
"@kubun/
|
|
29
|
+
"@kubun/connector": "^0.13.1",
|
|
30
|
+
"@kubun/hlc": "^0.13.0",
|
|
31
31
|
"@kubun/db": "^0.13.0",
|
|
32
|
-
"@kubun/
|
|
32
|
+
"@kubun/engine": "^0.13.1",
|
|
33
33
|
"@kubun/logger": "^0.13.0",
|
|
34
|
-
"@kubun/
|
|
35
|
-
"@kubun/
|
|
36
|
-
"@kubun/store-credential": "^0.13.0",
|
|
37
|
-
"@kubun/hlc": "^0.13.0",
|
|
38
|
-
"@kubun/store-graph": "^0.13.0",
|
|
34
|
+
"@kubun/graphql": "^0.13.1",
|
|
35
|
+
"@kubun/credential": "^0.13.0",
|
|
39
36
|
"@kubun/store-connector": "^0.13.0",
|
|
40
|
-
"@kubun/
|
|
41
|
-
"@kubun/
|
|
37
|
+
"@kubun/store-credential": "^0.13.0",
|
|
38
|
+
"@kubun/id": "^0.13.0",
|
|
39
|
+
"@kubun/store-graph": "^0.13.2",
|
|
40
|
+
"@kubun/store-delegation": "^0.13.0",
|
|
41
|
+
"@kubun/protocol": "^0.13.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@kokuin/controller": "^0.1.0",
|
|
45
45
|
"@testcontainers/postgresql": "^12.1.0",
|
|
46
46
|
"get-port": "^7.2.0",
|
|
47
|
-
"@kubun/db-postgres": "^0.13.0",
|
|
48
47
|
"@kubun/blob-backend": "^0.13.0",
|
|
48
|
+
"@kubun/db-postgres": "^0.13.0",
|
|
49
49
|
"@kubun/connector-google-mail": "^0.13.0",
|
|
50
|
+
"@kubun/models": "^0.13.0",
|
|
50
51
|
"@kubun/plugin-blob": "^0.13.0",
|
|
51
52
|
"@kubun/plugin-workflow": "^0.13.0",
|
|
53
|
+
"@kubun/store-controller": "^0.13.0",
|
|
52
54
|
"@kubun/store-blob": "^0.13.0",
|
|
53
|
-
"@kubun/models": "^0.13.0",
|
|
54
55
|
"@kubun/store-workflow": "^0.13.0",
|
|
55
|
-
"@kubun/test-utils": "^0.13.0"
|
|
56
|
-
"@kubun/store-controller": "^0.13.0"
|
|
56
|
+
"@kubun/test-utils": "^0.13.0"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|