openvibers/openvibe.network Commits
Network: AI may use project secrets (network.secret.use) for an app's own provider key (#201)
Changes
@@@ -446,6 +446,9 @@ const DEFAULT_GRANTS = [// Watch reveals a source credential to its source's origin, and signs a webhook action, with a project secret its// watch names (Contracts 0.179.0); each secret's project grant decides.['watch', 'network.secret.use', SELF_AUDIENCE, []],++ // AI reveals a project's own provider key to that provider's origin for one run of an app that names it on++ // /v1/chat/completions (x_openvibe.provider, AI#74); each secret's project grant decides.++ ['ai', 'network.secret.use', SELF_AUDIENCE, []],];// Grants withdrawn by decision; applied at every boot so an old default can't come back.@@@ -36,6 +36,8 @@ for (const [client, cap, aud] of principals.DEFAULT_GRANTS) {assert.strictEqual(aud, `openvibe.${c.owner}`, `default grant ${client} ${cap} → ${aud}`);}// Trade's scripts/subscribe.js (Trade #9) manages its Events subscriptions like the other publishers.++assert.deepStrictEqual(principals.DEFAULT_GRANTS.filter(([, cap]) => cap === 'network.secret.use').map(([client, , aud]) => [client, aud]).sort(),++ [['actor', principals.SELF_AUDIENCE], ['ai', principals.SELF_AUDIENCE], ['watch', principals.SELF_AUDIENCE]], 'project secrets: Actor signs, Watch and AI (an app\'s own provider, AI#74) use them');assert.ok(principals.DEFAULT_GRANTS.some(([client, cap, aud, scopes]) => client === 'trade' && cap === 'events.subscription.manage' && aud === 'openvibe.events' && Array.isArray(scopes) && !scopes.length), 'Trade holds events.subscription.manage on openvibe.events');assert.strictEqual((await events()).length, 0, 'the seed is not announced');
@@ -446,6 +446,9 @@ const DEFAULT_GRANTS = [
@@ -446,6 +446,9 @@ const DEFAULT_GRANTS = [
// Watch reveals a source credential to its source's origin, and signs a webhook action, with a project secret its
// Watch reveals a source credential to its source's origin, and signs a webhook action, with a project secret its
// watch names (Contracts 0.179.0); each secret's project grant decides.
// watch names (Contracts 0.179.0); each secret's project grant decides.
['watch', 'network.secret.use', SELF_AUDIENCE, []],
['watch', 'network.secret.use', SELF_AUDIENCE, []],
+ // AI reveals a project's own provider key to that provider's origin for one run of an app that names it on
+ // /v1/chat/completions (x_openvibe.provider, AI#74); each secret's project grant decides.
+ ['ai', 'network.secret.use', SELF_AUDIENCE, []],
];
];
// Grants withdrawn by decision; applied at every boot so an old default can't come back.
// Grants withdrawn by decision; applied at every boot so an old default can't come back.
@@ -36,6 +36,8 @@ for (const [client, cap, aud] of principals.DEFAULT_GRANTS) {
@@ -36,6 +36,8 @@ for (const [client, cap, aud] of principals.DEFAULT_GRANTS) {
assert.strictEqual(aud, `openvibe.${c.owner}`, `default grant ${client} ${cap} → ${aud}`);
assert.strictEqual(aud, `openvibe.${c.owner}`, `default grant ${client} ${cap} → ${aud}`);
}
}
// Trade's scripts/subscribe.js (Trade #9) manages its Events subscriptions like the other publishers.
// Trade's scripts/subscribe.js (Trade #9) manages its Events subscriptions like the other publishers.
+assert.deepStrictEqual(principals.DEFAULT_GRANTS.filter(([, cap]) => cap === 'network.secret.use').map(([client, , aud]) => [client, aud]).sort(),
+ [['actor', principals.SELF_AUDIENCE], ['ai', principals.SELF_AUDIENCE], ['watch', principals.SELF_AUDIENCE]], 'project secrets: Actor signs, Watch and AI (an app\'s own provider, AI#74) use them');
assert.ok(principals.DEFAULT_GRANTS.some(([client, cap, aud, scopes]) => client === 'trade' && cap === 'events.subscription.manage' && aud === 'openvibe.events' && Array.isArray(scopes) && !scopes.length), 'Trade holds events.subscription.manage on openvibe.events');
assert.ok(principals.DEFAULT_GRANTS.some(([client, cap, aud, scopes]) => client === 'trade' && cap === 'events.subscription.manage' && aud === 'openvibe.events' && Array.isArray(scopes) && !scopes.length), 'Trade holds events.subscription.manage on openvibe.events');
assert.strictEqual((await events()).length, 0, 'the seed is not announced');
assert.strictEqual((await events()).length, 0, 'the seed is not announced');