Prepare verified laboratory 6 implementation and evidence

This commit is contained in:
rey
2026-11-17 17:32:06 +03:00
parent 470d9d6f1e
commit 7d56e52fd0
335 changed files with 31206 additions and 72 deletions
+5
View File
@@ -0,0 +1,5 @@
import{test,expect}from'bun:test';import{createGrafanaCredentialBootstrap}from'../scripts/lib/grafana-credential';
const value='Aa1!synthetic-fixture-credential';
test('archives and verifies a new owner credential before publishing the runtime file',async()=>{const order:string[]=[];await createGrafanaCredentialBootstrap({read:async()=>undefined,generate:()=>value,archive:async v=>{expect(v).toBe(value);order.push('archive')},publish:async()=>{order.push('publish')}})();expect(order).toEqual(['archive','publish'])});
test('does not publish a credential when encrypted archival fails',async()=>{let published=0;await expect(createGrafanaCredentialBootstrap({read:async()=>undefined,generate:()=>value,archive:async()=>{throw Error('archive failed')},publish:async()=>{published++}})()).rejects.toThrow();expect(published).toBe(0)});
test('preserves the existing owner and archives it without rotating or rewriting',async()=>{let generated=0,published=0,archived='';await createGrafanaCredentialBootstrap({read:async()=>value,generate:()=>{generated++;return value},archive:async v=>{archived=v},publish:async()=>{published++}})();expect(archived).toBe(value);expect(generated).toBe(0);expect(published).toBe(0)});