mirror of
https://github.com/block/buzz.git
synced 2026-10-30 05:51:46 +00:00
12 lines
610 B
TypeScript
12 lines
610 B
TypeScript
import { dirname } from 'node:path';
|
|
import { createGenesis } from '../src/assignment.ts';
|
|
import { publicKey } from '../src/protocol.ts';
|
|
import { provision, validateSetup, setupOwner } from '../src/host.ts';
|
|
|
|
/** Fresh fixture keys are explicitly enrolled once, just like local new-key setup. */
|
|
export function provisionSetup(path: string, value: unknown): void {
|
|
const setup = validateSetup(value);
|
|
if (setup.agentSecret === undefined) throw Error('Fixture setup requires its agent key');
|
|
provision(dirname(path), setup, createGenesis(setupOwner(setup), publicKey(setup.agentSecret), setup.host));
|
|
}
|