@cortexkit/common-auth 0.29.0 → 0.29.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.
|
@@ -25,7 +25,8 @@ export interface ClaustrumFamily {
|
|
|
25
25
|
/** Non-secret classification facts, including rows decoded by older clients. */
|
|
26
26
|
export interface VaultRowFacts {
|
|
27
27
|
readonly credentialId: string;
|
|
28
|
-
|
|
28
|
+
/** Internal serving type derived from `authMethod`, not the id's type hint. */
|
|
29
|
+
readonly credentialType: VaultCredentialType;
|
|
29
30
|
readonly authMethod?: string;
|
|
30
31
|
readonly refreshAdapter?: string;
|
|
31
32
|
readonly providerIds?: readonly string[];
|
|
@@ -108,7 +109,10 @@ export interface VaultInventory {
|
|
|
108
109
|
readonly view: string;
|
|
109
110
|
readonly credentials: readonly VaultCredential[];
|
|
110
111
|
readonly skipped: readonly SkippedVaultRecord[];
|
|
111
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Classifying families only: declared policy codes or the fixed library codes
|
|
114
|
+
* `unknown-auth-method`, `unmapped` and `unclassified`, never classifier errors.
|
|
115
|
+
*/
|
|
112
116
|
readonly refused?: readonly {
|
|
113
117
|
credentialId?: string;
|
|
114
118
|
code: string;
|
|
@@ -85,16 +85,28 @@ function credentialTypeOf(row, family) {
|
|
|
85
85
|
return notMine;
|
|
86
86
|
if (!row.categories.includes(family.category))
|
|
87
87
|
return notMine;
|
|
88
|
-
if (row.credentialType !== 'oauth' && row.credentialType !== 'api_key')
|
|
89
|
-
return notMine;
|
|
90
88
|
if ('classify' in family) {
|
|
91
|
-
|
|
89
|
+
const metadata = rowFactsOf(row);
|
|
90
|
+
let type;
|
|
91
|
+
// The id's type is only a hint; the vault's auth method determines serving.
|
|
92
|
+
switch (metadata.authMethod) {
|
|
93
|
+
case 'apikey':
|
|
94
|
+
type = 'api_key';
|
|
95
|
+
break;
|
|
96
|
+
case 'chatgpt':
|
|
97
|
+
case 'antigravity':
|
|
98
|
+
case 'oauth':
|
|
99
|
+
type = 'oauth';
|
|
100
|
+
break;
|
|
101
|
+
default:
|
|
102
|
+
return { kind: 'refused', code: 'unknown-auth-method' };
|
|
103
|
+
}
|
|
92
104
|
const facts = {
|
|
93
105
|
credentialId: row.id,
|
|
94
|
-
credentialType:
|
|
106
|
+
credentialType: type,
|
|
95
107
|
categories: row.categories,
|
|
96
108
|
refreshAdapter: row.refreshAdapter,
|
|
97
|
-
...
|
|
109
|
+
...metadata,
|
|
98
110
|
};
|
|
99
111
|
if (facts.providerIds === undefined)
|
|
100
112
|
return { kind: 'refused', code: 'unmapped' };
|
|
@@ -103,7 +115,7 @@ function credentialTypeOf(row, family) {
|
|
|
103
115
|
if (result.kind === 'not-mine')
|
|
104
116
|
return notMine;
|
|
105
117
|
if (result.kind === 'mine' && typeof result.member === 'string')
|
|
106
|
-
return { kind: 'mine', type
|
|
118
|
+
return { kind: 'mine', type, member: result.member };
|
|
107
119
|
if (result.kind === 'refused' &&
|
|
108
120
|
typeof result.code === 'string' &&
|
|
109
121
|
/^[a-z][a-z0-9-]{0,31}$/.test(result.code) &&
|
|
@@ -116,6 +128,8 @@ function credentialTypeOf(row, family) {
|
|
|
116
128
|
}
|
|
117
129
|
return { kind: 'refused', code: 'unclassified' };
|
|
118
130
|
}
|
|
131
|
+
if (row.credentialType !== 'oauth' && row.credentialType !== 'api_key')
|
|
132
|
+
return notMine;
|
|
119
133
|
if (row.credentialType === 'oauth')
|
|
120
134
|
return row.refreshAdapter === family.refreshAdapter
|
|
121
135
|
? { kind: 'mine', type: 'oauth' }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/common-auth",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.1",
|
|
4
4
|
"description": "Shared code for the CortexKit auth plugins: account pool, quota and routing, commands and auth menu, OpenCode 2 hooks, Claustrum custody, and plumbing (loopback RPC, file locks, logger, sidebar state, TUI preferences and build).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|