feat(domain): project verified runtime policy to desktop
This commit is contained in:
parent
fbff657d88
commit
683e135f5e
12 changed files with 224 additions and 25 deletions
|
|
@ -1,6 +1,16 @@
|
|||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { projectDomainConnectionSteps, projectDomainTrustSource } from './domain-connection.js';
|
||||
import { projectDomainConnectionSteps, projectDomainRuntimePolicyReceipt, projectDomainTrustSource } from './domain-connection.js';
|
||||
|
||||
const verifiedRuntimePolicy = {
|
||||
allowedSessionScopes: ['domain:enter', 'knowledge:read'],
|
||||
forbiddenDataScopes: ['private:relationship-core'],
|
||||
manifestDigest: 'a'.repeat(64),
|
||||
permissionPolicyRef: 'policy://origin-domain/default',
|
||||
routeRef: 'domain-route://origin-domain/runtime',
|
||||
themeOwner: 'fifth-domain' as const,
|
||||
themePackageRef: 'theme://origin-domain/lake-reflects-stars',
|
||||
};
|
||||
|
||||
test('code-channel account absence cannot be projected as a domain runtime login', () => {
|
||||
const steps = projectDomainConnectionSteps({
|
||||
|
|
@ -32,10 +42,29 @@ test('verified account and node remain identity-only without domain handoff evid
|
|||
});
|
||||
|
||||
test('runtime-ready requires all four verified steps', () => {
|
||||
const steps = projectDomainConnectionSteps({ blockers: [], runtimeReady: true, stage: 'runtime-ready' });
|
||||
const steps = projectDomainConnectionSteps({ blockers: [], runtimePolicy: verifiedRuntimePolicy, runtimeReady: true, stage: 'runtime-ready' });
|
||||
assert.ok(steps.every(step => step.state === 'verified'));
|
||||
});
|
||||
|
||||
test('a runtime-ready access projects only a compact verified policy receipt', () => {
|
||||
const rows = projectDomainRuntimePolicyReceipt({
|
||||
blockers: [],
|
||||
runtimePolicy: verifiedRuntimePolicy,
|
||||
runtimeReady: true,
|
||||
stage: 'runtime-ready',
|
||||
});
|
||||
assert.deepEqual(rows.map(row => row.label), ['主题包', '运行路线', '权限策略', '允许会话', '禁止数据', '清单摘要']);
|
||||
assert.match(rows[0].value, /^theme:\/\/origin-domain\//);
|
||||
assert.match(rows.at(-1)?.value ?? '', /^a{12}…a{8}$/);
|
||||
assert.doesNotMatch(JSON.stringify(rows), /signature|signer|repository|publicKey/i);
|
||||
assert.deepEqual(projectDomainRuntimePolicyReceipt({
|
||||
blockers: ['matching_connection_receipt_missing'],
|
||||
runtimePolicy: verifiedRuntimePolicy,
|
||||
runtimeReady: false,
|
||||
stage: 'identity-verified',
|
||||
}), []);
|
||||
});
|
||||
|
||||
test('a current empty signer registry is projected as a real manifest blocker', () => {
|
||||
const access = {
|
||||
blockers: ['verified_domain_manifest_missing'],
|
||||
|
|
|
|||
Loading…
Reference in a new issue