Skip to content

Commit

Permalink
add no-dpki flag
Browse files Browse the repository at this point in the history
  • Loading branch information
JettTech committed Aug 26, 2024
1 parent a9e7422 commit d696d99
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions ts/src/local/conductor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@ export class Conductor implements IConductor {
if (options?.bootstrapServerUrl) {
args.push("--bootstrap", options.bootstrapServerUrl.href);
}
// if (options?.noDpki) {
// args.push("--dpki", options.noDpki.href);
// }
// add "no-dpki" flag when passed as true
if (options?.noDpki) {
args.push("--no-dpki");
}
args.push(networkType);
if (networkType === NetworkType.WebRtc) {
args.push(signalingServerUrl.href);
Expand Down
3 changes: 2 additions & 1 deletion ts/src/local/scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ export class Scenario {
*
* @returns The newly added conductor instance.
*/
async addConductor() {
async addConductor(noDpki = false) {
await this.ensureLocalServices();
assert(this.serviceProcess);
assert(this.signalingServerUrl);
const conductor = await createConductor(this.signalingServerUrl, {
timeout: this.timeout,
bootstrapServerUrl: this.bootstrapServerUrl,
noDpki
});
this.conductors.push(conductor);
return conductor;
Expand Down
18 changes: 14 additions & 4 deletions ts/src/trycp/conductor/conductor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const HOLO_SIGNALING_SERVER = new URL("wss://sbd-0.main.infra.holo.host");
const HOLO_BOOTSTRAP_SERVEr = new URL("https://devnet-bootstrap.holo.host");
const BOOTSTRAP_SERVER_PLACEHOLDER = "<bootstrap_server_url>";
const SIGNALING_SERVER_PLACEHOLDER = "<signaling_server_url>";
const DPKI_CONFIG_DEFAULT = "~"

/**
* The default partial config for a TryCP conductor.
Expand All @@ -103,7 +104,7 @@ const SIGNALING_SERVER_PLACEHOLDER = "<signaling_server_url>";
export const DEFAULT_PARTIAL_PLAYER_CONFIG = `signing_service_uri: ~
encryption_service_uri: ~
decryption_service_uri: ~
dpki: ~
dpki: ${DPKI_CONFIG_DEFAULT}
network:
network_type: "quic_bootstrap"
bootstrap_service: ${BOOTSTRAP_SERVER_PLACEHOLDER}
Expand Down Expand Up @@ -170,7 +171,7 @@ export const createTryCpConductor = async (
const conductor = new TryCpConductor(tryCpClient, options?.id);
if (options?.startup !== false) {
// configure and startup conductor by default
await conductor.configure(options?.partialConfig);
await conductor.configure(options?.partialConfig, options?.noDpki);
await conductor.startUp({ logLevel: options?.logLevel });
}
return conductor;
Expand All @@ -196,7 +197,7 @@ export class TryCpConductor implements IConductor {
* @param partialConfig - The configuration to add to the default configuration.
* @returns An empty success response.
*/
async configure(partialConfig?: string) {
async configure(partialConfig?: string, noDpki: boolean = false) {
if (!partialConfig) {
partialConfig = DEFAULT_PARTIAL_PLAYER_CONFIG.replace(
BOOTSTRAP_SERVER_PLACEHOLDER,
Expand All @@ -205,11 +206,20 @@ export class TryCpConductor implements IConductor {
SIGNALING_SERVER_PLACEHOLDER,
(this.tryCpClient.signalingServerUrl || HOLO_SIGNALING_SERVER).href
);
if (noDpki) {
partialConfig = DEFAULT_PARTIAL_PLAYER_CONFIG.replace(
DPKI_CONFIG_DEFAULT,
`
dna_path: None
device_seed_lair_tag: "disabled"
no_dpki: true`)
}
}

const response = await this.tryCpClient.call({
type: "configure_player",
id: this.id,
partial_config: partialConfig,
partial_config: partialConfig
});
assert(response === TRYCP_SUCCESS_RESPONSE);
return response;
Expand Down

0 comments on commit d696d99

Please sign in to comment.