From 7a43601eab4cda357924b522a3e376da97cdf801 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Thu, 19 Feb 2026 16:02:48 +0100 Subject: [PATCH] feat: generate did for cli --- cli/src/declarations/console.d.ts | 32 +++--- cli/src/declarations/console.did | 28 +++-- cli/src/declarations/console.idl.js | 30 ++++-- cli/src/declarations/governance.d.ts | 67 +++++++++++- cli/src/declarations/governance.did | 59 +++++++++- cli/src/declarations/governance.idl.js | 57 ++++++++++ cli/src/declarations/internet_identity.did | 2 +- cli/src/declarations/internet_identity.idl.js | 2 +- cli/src/declarations/observatory.d.ts | 11 +- cli/src/declarations/observatory.did | 11 +- cli/src/declarations/observatory.idl.js | 18 +++- cli/src/declarations/satellite.d.ts | 102 +++++++++++++++--- cli/src/declarations/satellite.did | 89 +++++++++++++-- cli/src/declarations/satellite.idl.js | 98 +++++++++++++++-- 14 files changed, 523 insertions(+), 83 deletions(-) diff --git a/cli/src/declarations/console.d.ts b/cli/src/declarations/console.d.ts index fb47528..a96da6d 100644 --- a/cli/src/declarations/console.d.ts +++ b/cli/src/declarations/console.d.ts @@ -69,7 +69,7 @@ export interface AuthenticationConfigInternetIdentity { } export interface AuthenticationConfigOpenId { observatory_id: [] | [Principal]; - providers: Array<[OpenIdProvider, OpenIdProviderConfig]>; + providers: Array<[OpenIdDelegationProvider, OpenIdAuthProviderConfig]>; } export type AuthenticationError = | { @@ -99,10 +99,12 @@ export interface ConfigMaxMemorySize { export interface Controller { updated_at: bigint; metadata: Array<[string, string]>; + kind: [] | [ControllerKind]; created_at: bigint; scope: ControllerScope; expires_at: [] | [bigint]; } +export type ControllerKind = {Emulator: null} | {Automation: null}; export type ControllerScope = {Write: null} | {Admin: null} | {Submit: null}; export interface CreateMissionControlArgs { subnet_id: [] | [Principal]; @@ -159,7 +161,8 @@ export type GetDelegationError = | {NoSuchDelegation: null} | {JwtVerify: JwtVerifyError} | {GetOrFetchJwks: GetOrRefreshJwksError} - | {DeriveSeedFailed: string}; + | {DeriveSeedFailed: string} + | {InvalidObservatoryId: string}; export type GetOrRefreshJwksError = | {InvalidConfig: string} | {MissingKid: null} @@ -277,9 +280,17 @@ export interface ListSegmentsArgs { } export type Memory = {Heap: null} | {Stable: null}; export interface OpenId { - provider: OpenIdProvider; + provider: OpenIdDelegationProvider; data: OpenIdData; } +export interface OpenIdAuthProviderConfig { + delegation: [] | [OpenIdAuthProviderDelegationConfig]; + client_id: string; +} +export interface OpenIdAuthProviderDelegationConfig { + targets: [] | [Array]; + max_time_to_live: [] | [bigint]; +} export interface OpenIdData { name: [] | [string]; locale: [] | [string]; @@ -287,7 +298,9 @@ export interface OpenIdData { email: [] | [string]; picture: [] | [string]; given_name: [] | [string]; + preferred_username: [] | [string]; } +export type OpenIdDelegationProvider = {GitHub: null} | {Google: null}; export interface OpenIdGetDelegationArgs { jwt: string; session_key: Uint8Array; @@ -299,15 +312,6 @@ export interface OpenIdPrepareDelegationArgs { session_key: Uint8Array; salt: Uint8Array; } -export type OpenIdProvider = {Google: null}; -export interface OpenIdProviderConfig { - delegation: [] | [OpenIdProviderDelegationConfig]; - client_id: string; -} -export interface OpenIdProviderDelegationConfig { - targets: [] | [Array]; - max_time_to_live: [] | [bigint]; -} export type PaymentStatus = {Refunded: null} | {Acknowledged: null} | {Completed: null}; export type PrepareDelegationError = | { @@ -316,7 +320,8 @@ export type PrepareDelegationError = | {GetCachedJwks: null} | {JwtVerify: JwtVerifyError} | {GetOrFetchJwks: GetOrRefreshJwksError} - | {DeriveSeedFailed: string}; + | {DeriveSeedFailed: string} + | {InvalidObservatoryId: string}; export interface PreparedDelegation { user_key: Uint8Array; expiration: bigint; @@ -376,6 +381,7 @@ export interface SetAuthenticationConfig { } export interface SetController { metadata: Array<[string, string]>; + kind: [] | [ControllerKind]; scope: ControllerScope; expires_at: [] | [bigint]; } diff --git a/cli/src/declarations/console.did b/cli/src/declarations/console.did index e58d1e6..d22c37b 100644 --- a/cli/src/declarations/console.did +++ b/cli/src/declarations/console.did @@ -52,7 +52,7 @@ type AuthenticationConfigInternetIdentity = record { }; type AuthenticationConfigOpenId = record { observatory_id : opt principal; - providers : vec record { OpenIdProvider; OpenIdProviderConfig }; + providers : vec record { OpenIdDelegationProvider; OpenIdAuthProviderConfig }; }; type AuthenticationError = variant { PrepareDelegation : PrepareDelegationError; @@ -73,10 +73,12 @@ type ConfigMaxMemorySize = record { stable : opt nat64; heap : opt nat64 }; type Controller = record { updated_at : nat64; metadata : vec record { text; text }; + kind : opt ControllerKind; created_at : nat64; scope : ControllerScope; expires_at : opt nat64; }; +type ControllerKind = variant { Emulator; Automation }; type ControllerScope = variant { Write; Admin; Submit }; type CreateMissionControlArgs = record { subnet_id : opt principal }; type CreateOrbiterArgs = record { @@ -121,6 +123,7 @@ type GetDelegationError = variant { JwtVerify : JwtVerifyError; GetOrFetchJwks : GetOrRefreshJwksError; DeriveSeedFailed : text; + InvalidObservatoryId : text; }; type GetOrRefreshJwksError = variant { InvalidConfig : text; @@ -223,7 +226,15 @@ type ListSegmentsArgs = record { segment_kind : opt StorableSegmentKind; }; type Memory = variant { Heap; Stable }; -type OpenId = record { provider : OpenIdProvider; data : OpenIdData }; +type OpenId = record { provider : OpenIdDelegationProvider; data : OpenIdData }; +type OpenIdAuthProviderConfig = record { + delegation : opt OpenIdAuthProviderDelegationConfig; + client_id : text; +}; +type OpenIdAuthProviderDelegationConfig = record { + targets : opt vec principal; + max_time_to_live : opt nat64; +}; type OpenIdData = record { name : opt text; locale : opt text; @@ -231,7 +242,9 @@ type OpenIdData = record { email : opt text; picture : opt text; given_name : opt text; + preferred_username : opt text; }; +type OpenIdDelegationProvider = variant { GitHub; Google }; type OpenIdGetDelegationArgs = record { jwt : text; session_key : blob; @@ -243,15 +256,6 @@ type OpenIdPrepareDelegationArgs = record { session_key : blob; salt : blob; }; -type OpenIdProvider = variant { Google }; -type OpenIdProviderConfig = record { - delegation : opt OpenIdProviderDelegationConfig; - client_id : text; -}; -type OpenIdProviderDelegationConfig = record { - targets : opt vec principal; - max_time_to_live : opt nat64; -}; type PaymentStatus = variant { Refunded; Acknowledged; Completed }; type PrepareDelegationError = variant { JwtFindProvider : JwtFindProviderError; @@ -259,6 +263,7 @@ type PrepareDelegationError = variant { JwtVerify : JwtVerifyError; GetOrFetchJwks : GetOrRefreshJwksError; DeriveSeedFailed : text; + InvalidObservatoryId : text; }; type PreparedDelegation = record { user_key : blob; expiration : nat64 }; type Proposal = record { @@ -313,6 +318,7 @@ type SetAuthenticationConfig = record { }; type SetController = record { metadata : vec record { text; text }; + kind : opt ControllerKind; scope : ControllerScope; expires_at : opt nat64; }; diff --git a/cli/src/declarations/console.idl.js b/cli/src/declarations/console.idl.js index 4fb47f0..e7cffa9 100644 --- a/cli/src/declarations/console.idl.js +++ b/cli/src/declarations/console.idl.js @@ -24,17 +24,21 @@ export const idlFactory = ({IDL}) => { user_key: IDL.Vec(IDL.Nat8), expiration: IDL.Nat64 }); - const OpenIdProvider = IDL.Variant({Google: IDL.Null}); + const OpenIdDelegationProvider = IDL.Variant({ + GitHub: IDL.Null, + Google: IDL.Null + }); const OpenIdData = IDL.Record({ name: IDL.Opt(IDL.Text), locale: IDL.Opt(IDL.Text), family_name: IDL.Opt(IDL.Text), email: IDL.Opt(IDL.Text), picture: IDL.Opt(IDL.Text), - given_name: IDL.Opt(IDL.Text) + given_name: IDL.Opt(IDL.Text), + preferred_username: IDL.Opt(IDL.Text) }); const OpenId = IDL.Record({ - provider: OpenIdProvider, + provider: OpenIdDelegationProvider, data: OpenIdData }); const Provider = IDL.Variant({ @@ -81,7 +85,8 @@ export const idlFactory = ({IDL}) => { GetCachedJwks: IDL.Null, JwtVerify: JwtVerifyError, GetOrFetchJwks: GetOrRefreshJwksError, - DeriveSeedFailed: IDL.Text + DeriveSeedFailed: IDL.Text, + InvalidObservatoryId: IDL.Text }); const AuthenticationError = IDL.Variant({ PrepareDelegation: PrepareDelegationError, @@ -129,17 +134,17 @@ export const idlFactory = ({IDL}) => { const DeleteProposalAssets = IDL.Record({ proposal_ids: IDL.Vec(IDL.Nat) }); - const OpenIdProviderDelegationConfig = IDL.Record({ + const OpenIdAuthProviderDelegationConfig = IDL.Record({ targets: IDL.Opt(IDL.Vec(IDL.Principal)), max_time_to_live: IDL.Opt(IDL.Nat64) }); - const OpenIdProviderConfig = IDL.Record({ - delegation: IDL.Opt(OpenIdProviderDelegationConfig), + const OpenIdAuthProviderConfig = IDL.Record({ + delegation: IDL.Opt(OpenIdAuthProviderDelegationConfig), client_id: IDL.Text }); const AuthenticationConfigOpenId = IDL.Record({ observatory_id: IDL.Opt(IDL.Principal), - providers: IDL.Vec(IDL.Tuple(OpenIdProvider, OpenIdProviderConfig)) + providers: IDL.Vec(IDL.Tuple(OpenIdDelegationProvider, OpenIdAuthProviderConfig)) }); const AuthenticationConfigInternetIdentity = IDL.Record({ derivation_origin: IDL.Opt(IDL.Text), @@ -211,7 +216,8 @@ export const idlFactory = ({IDL}) => { NoSuchDelegation: IDL.Null, JwtVerify: JwtVerifyError, GetOrFetchJwks: GetOrRefreshJwksError, - DeriveSeedFailed: IDL.Text + DeriveSeedFailed: IDL.Text, + InvalidObservatoryId: IDL.Text }); const Result_1 = IDL.Variant({ Ok: SignedDelegation, @@ -360,6 +366,10 @@ export const idlFactory = ({IDL}) => { items: IDL.Vec(IDL.Tuple(IDL.Text, AssetNoContent)), items_length: IDL.Nat64 }); + const ControllerKind = IDL.Variant({ + Emulator: IDL.Null, + Automation: IDL.Null + }); const ControllerScope = IDL.Variant({ Write: IDL.Null, Admin: IDL.Null, @@ -368,6 +378,7 @@ export const idlFactory = ({IDL}) => { const Controller = IDL.Record({ updated_at: IDL.Nat64, metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + kind: IDL.Opt(ControllerKind), created_at: IDL.Nat64, scope: ControllerScope, expires_at: IDL.Opt(IDL.Nat64) @@ -448,6 +459,7 @@ export const idlFactory = ({IDL}) => { }); const SetController = IDL.Record({ metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + kind: IDL.Opt(ControllerKind), scope: ControllerScope, expires_at: IDL.Opt(IDL.Nat64) }); diff --git a/cli/src/declarations/governance.d.ts b/cli/src/declarations/governance.d.ts index 9d550bf..5fe1bcf 100644 --- a/cli/src/declarations/governance.d.ts +++ b/cli/src/declarations/governance.d.ts @@ -21,9 +21,12 @@ export type Action = | {RegisterKnownNeuron: KnownNeuron} | {FulfillSubnetRentalRequest: FulfillSubnetRentalRequest} | {ManageNeuron: ManageNeuronProposal} + | {LoadCanisterSnapshot: LoadCanisterSnapshot} + | {BlessAlternativeGuestOsVersion: BlessAlternativeGuestOsVersion} | {UpdateCanisterSettings: UpdateCanisterSettings} | {InstallCode: InstallCode} | {DeregisterKnownNeuron: DeregisterKnownNeuron} + | {TakeCanisterSnapshot: TakeCanisterSnapshot} | {StopOrStartCanister: StopOrStartCanister} | {CreateServiceNervousSystem: CreateServiceNervousSystem} | {ExecuteNnsFunction: ExecuteNnsFunction} @@ -56,6 +59,29 @@ export interface BallotInfo { vote: number; proposal_id: [] | [ProposalId]; } +/** + * Declares an approved set of alternative replica virtual machine software for + * disaster recovery purposes. + */ +export interface BlessAlternativeGuestOsVersion { + /** + * Hexadecimal fingerprint of the recovery rootfs. + * Must contain only hexadecimal characters (0-9, A-F, a-f). + */ + rootfs_hash: [] | [string]; + /** + * AMD Secure Processor chip IDs that are allowed to run this software. + * Each chip ID must be exactly 64 bytes. + */ + chip_ids: [] | [Array]; + /** + * The version being replaced by this (alternative version) must match this + * field (or one of the possibilities therein). + * + * (Here, we refer to the version being replaced as the "base" version.) + */ + base_guest_launch_measurements: [] | [GuestLaunchMeasurements]; +} export type By = | {NeuronIdOrSubaccount: {}} | {MemoAndController: ClaimOrRefreshNeuronFromAccount} @@ -359,6 +385,25 @@ export interface GovernanceParameters { proposal_rejection_fee: [] | [Tokens]; voting_reward_parameters: [] | [VotingRewardParameters]; } +export interface GuestLaunchMeasurement { + /** + * Metadata associated with the measurement. + */ + metadata: [] | [GuestLaunchMeasurementMetadata]; + /** + * SEV-SNP measurement (48 bytes). + */ + measurement: [] | [Uint8Array]; +} +export interface GuestLaunchMeasurementMetadata { + /** + * Kernel command line used for this measurement. + */ + kernel_cmdline: [] | [string]; +} +export interface GuestLaunchMeasurements { + guest_launch_measurements: [] | [Array]; +} export interface IdealMatchedParticipationFunction { serialized_representation: [] | [string]; } @@ -394,12 +439,16 @@ export interface KnownNeuron { export interface KnownNeuronData { name: string; /** - * The first `opt` makes it so that the field can be renamed/deprecated in the future, and - * the second `opt` makes it so that an older client not recognizing a new variant can still - * get the rest of the `vec`. + * Topics that the known neuron is committed to always vote on. + * Note regarding the type: the first `opt` makes it so that the field can be renamed/deprecated + * in the future, and the second `opt` makes it so that an older client not recognizing a new + * variant can still get the rest of the `vec`. */ committed_topics: [] | [Array<[] | [TopicToFollow]>]; description: [] | [string]; + /** + * Links related to the known neuron. Can be links to social URLs (OpenChat, X, etc.), or a homepage. + */ links: [] | [Array]; } export interface LedgerParameters { @@ -509,6 +558,10 @@ export interface ListProposalInfoRequest { export interface ListProposalInfoResponse { proposal_info: Array; } +export interface LoadCanisterSnapshot { + canister_id: [] | [Principal]; + snapshot_id: [] | [Uint8Array]; +} export interface MakeProposalRequest { url: string; title: [] | [string]; @@ -945,9 +998,12 @@ export type ProposalActionRequest = | {RegisterKnownNeuron: KnownNeuron} | {FulfillSubnetRentalRequest: FulfillSubnetRentalRequest} | {ManageNeuron: ManageNeuronRequest} + | {LoadCanisterSnapshot: LoadCanisterSnapshot} + | {BlessAlternativeGuestOsVersion: BlessAlternativeGuestOsVersion} | {UpdateCanisterSettings: UpdateCanisterSettings} | {InstallCode: InstallCodeRequest} | {DeregisterKnownNeuron: DeregisterKnownNeuron} + | {TakeCanisterSnapshot: TakeCanisterSnapshot} | {StopOrStartCanister: StopOrStartCanister} | {CreateServiceNervousSystem: CreateServiceNervousSystem} | {ExecuteNnsFunction: ExecuteNnsFunction} @@ -1071,6 +1127,7 @@ export type SelfDescribingValue = | {Map: Array<[string, SelfDescribingValue]>} | {Nat: bigint} | {Blob: Uint8Array} + | {Null: null} | {Text: string} | {Array: Array}; export interface SetDefaultFollowees { @@ -1162,6 +1219,10 @@ export interface SwapParticipationLimits { min_direct_participation_icp_e8s: [] | [bigint]; max_direct_participation_icp_e8s: [] | [bigint]; } +export interface TakeCanisterSnapshot { + replace_snapshot: [] | [Uint8Array]; + canister_id: [] | [Principal]; +} export interface Tally { no: bigint; yes: bigint; diff --git a/cli/src/declarations/governance.did b/cli/src/declarations/governance.did index fecb89a..6c32536 100644 --- a/cli/src/declarations/governance.did +++ b/cli/src/declarations/governance.did @@ -21,6 +21,9 @@ type Action = variant { AddOrRemoveNodeProvider : AddOrRemoveNodeProvider; Motion : Motion; FulfillSubnetRentalRequest : FulfillSubnetRentalRequest; + BlessAlternativeGuestOsVersion : BlessAlternativeGuestOsVersion; + TakeCanisterSnapshot : TakeCanisterSnapshot; + LoadCanisterSnapshot : LoadCanisterSnapshot; }; type AddHotKey = record { @@ -448,10 +451,12 @@ type DeregisterKnownNeuron = record { type KnownNeuronData = record { name : text; description : opt text; + // Links related to the known neuron. Can be links to social URLs (OpenChat, X, etc.), or a homepage. links : opt vec text; - // The first `opt` makes it so that the field can be renamed/deprecated in the future, and - // the second `opt` makes it so that an older client not recognizing a new variant can still - // get the rest of the `vec`. + // Topics that the known neuron is committed to always vote on. + // Note regarding the type: the first `opt` makes it so that the field can be renamed/deprecated + // in the future, and the second `opt` makes it so that an older client not recognizing a new + // variant can still get the rest of the `vec`. committed_topics : opt vec opt TopicToFollow; }; @@ -466,6 +471,11 @@ type ListKnownNeuronsResponse = record { known_neurons : vec KnownNeuron; }; +type LoadCanisterSnapshot = record { + canister_id : opt principal; + snapshot_id : opt blob; +}; + // Parameters of the list_neurons method. type ListNeurons = record { // These fields select neurons to be in the result set. @@ -1027,6 +1037,9 @@ type ProposalActionRequest = variant { AddOrRemoveNodeProvider : AddOrRemoveNodeProvider; Motion : Motion; FulfillSubnetRentalRequest : FulfillSubnetRentalRequest; + BlessAlternativeGuestOsVersion : BlessAlternativeGuestOsVersion; + TakeCanisterSnapshot : TakeCanisterSnapshot; + LoadCanisterSnapshot : LoadCanisterSnapshot; }; // Creates a rented subnet from a rental request (in the Subnet Rental @@ -1061,6 +1074,45 @@ type FulfillSubnetRentalRequest = record { replica_version_id : opt text; }; +// Declares an approved set of alternative replica virtual machine software for +// disaster recovery purposes. +type BlessAlternativeGuestOsVersion = record { + // AMD Secure Processor chip IDs that are allowed to run this software. + // Each chip ID must be exactly 64 bytes. + chip_ids : opt vec blob; + + // Hexadecimal fingerprint of the recovery rootfs. + // Must contain only hexadecimal characters (0-9, A-F, a-f). + rootfs_hash : opt text; + + // The version being replaced by this (alternative version) must match this + // field (or one of the possibilities therein). + // + // (Here, we refer to the version being replaced as the "base" version.) + base_guest_launch_measurements : opt GuestLaunchMeasurements; }; + +type GuestLaunchMeasurements = record { + guest_launch_measurements : opt vec GuestLaunchMeasurement; +}; + +type GuestLaunchMeasurement = record { + // SEV-SNP measurement (48 bytes). + measurement : opt blob; + + // Metadata associated with the measurement. + metadata : opt GuestLaunchMeasurementMetadata; +}; + +type GuestLaunchMeasurementMetadata = record { + // Kernel command line used for this measurement. + kernel_cmdline : opt text; +}; + +type TakeCanisterSnapshot = record { + canister_id : opt principal; + replace_snapshot : opt blob; +}; + type ProposalData = record { id : opt ProposalId; failure_reason : opt GovernanceError; @@ -1441,6 +1493,7 @@ type SelfDescribingValue = variant { Int : int; Array : vec SelfDescribingValue; Map : vec record { text; SelfDescribingValue }; + Null; }; type GetPendingProposalsRequest = record { diff --git a/cli/src/declarations/governance.idl.js b/cli/src/declarations/governance.idl.js index 7007e3c..57bdcac 100644 --- a/cli/src/declarations/governance.idl.js +++ b/cli/src/declarations/governance.idl.js @@ -397,6 +397,25 @@ export const idlFactory = ({IDL}) => { command: IDL.Opt(ManageNeuronProposalCommand), neuron_id_or_subaccount: IDL.Opt(NeuronIdOrSubaccount) }); + const LoadCanisterSnapshot = IDL.Record({ + canister_id: IDL.Opt(IDL.Principal), + snapshot_id: IDL.Opt(IDL.Vec(IDL.Nat8)) + }); + const GuestLaunchMeasurementMetadata = IDL.Record({ + kernel_cmdline: IDL.Opt(IDL.Text) + }); + const GuestLaunchMeasurement = IDL.Record({ + metadata: IDL.Opt(GuestLaunchMeasurementMetadata), + measurement: IDL.Opt(IDL.Vec(IDL.Nat8)) + }); + const GuestLaunchMeasurements = IDL.Record({ + guest_launch_measurements: IDL.Opt(IDL.Vec(GuestLaunchMeasurement)) + }); + const BlessAlternativeGuestOsVersion = IDL.Record({ + rootfs_hash: IDL.Opt(IDL.Text), + chip_ids: IDL.Opt(IDL.Vec(IDL.Vec(IDL.Nat8))), + base_guest_launch_measurements: IDL.Opt(GuestLaunchMeasurements) + }); const Controllers = IDL.Record({controllers: IDL.Vec(IDL.Principal)}); const CanisterSettings = IDL.Record({ freezing_threshold: IDL.Opt(IDL.Nat64), @@ -419,6 +438,10 @@ export const idlFactory = ({IDL}) => { install_mode: IDL.Opt(IDL.Int32) }); const DeregisterKnownNeuron = IDL.Record({id: IDL.Opt(NeuronId)}); + const TakeCanisterSnapshot = IDL.Record({ + replace_snapshot: IDL.Opt(IDL.Vec(IDL.Nat8)), + canister_id: IDL.Opt(IDL.Principal) + }); const StopOrStartCanister = IDL.Record({ action: IDL.Opt(IDL.Int32), canister_id: IDL.Opt(IDL.Principal) @@ -557,9 +580,12 @@ export const idlFactory = ({IDL}) => { RegisterKnownNeuron: KnownNeuron, FulfillSubnetRentalRequest: FulfillSubnetRentalRequest, ManageNeuron: ManageNeuronProposal, + LoadCanisterSnapshot: LoadCanisterSnapshot, + BlessAlternativeGuestOsVersion: BlessAlternativeGuestOsVersion, UpdateCanisterSettings: UpdateCanisterSettings, InstallCode: InstallCode, DeregisterKnownNeuron: DeregisterKnownNeuron, + TakeCanisterSnapshot: TakeCanisterSnapshot, StopOrStartCanister: StopOrStartCanister, CreateServiceNervousSystem: CreateServiceNervousSystem, ExecuteNnsFunction: ExecuteNnsFunction, @@ -579,6 +605,7 @@ export const idlFactory = ({IDL}) => { Map: IDL.Vec(IDL.Tuple(IDL.Text, SelfDescribingValue)), Nat: IDL.Nat, Blob: IDL.Vec(IDL.Nat8), + Null: IDL.Null, Text: IDL.Text, Array: IDL.Vec(SelfDescribingValue) }) @@ -863,9 +890,12 @@ export const idlFactory = ({IDL}) => { RegisterKnownNeuron: KnownNeuron, FulfillSubnetRentalRequest: FulfillSubnetRentalRequest, ManageNeuron: ManageNeuronRequest, + LoadCanisterSnapshot: LoadCanisterSnapshot, + BlessAlternativeGuestOsVersion: BlessAlternativeGuestOsVersion, UpdateCanisterSettings: UpdateCanisterSettings, InstallCode: InstallCodeRequest, DeregisterKnownNeuron: DeregisterKnownNeuron, + TakeCanisterSnapshot: TakeCanisterSnapshot, StopOrStartCanister: StopOrStartCanister, CreateServiceNervousSystem: CreateServiceNervousSystem, ExecuteNnsFunction: ExecuteNnsFunction, @@ -1446,6 +1476,25 @@ export const init = ({IDL}) => { command: IDL.Opt(ManageNeuronProposalCommand), neuron_id_or_subaccount: IDL.Opt(NeuronIdOrSubaccount) }); + const LoadCanisterSnapshot = IDL.Record({ + canister_id: IDL.Opt(IDL.Principal), + snapshot_id: IDL.Opt(IDL.Vec(IDL.Nat8)) + }); + const GuestLaunchMeasurementMetadata = IDL.Record({ + kernel_cmdline: IDL.Opt(IDL.Text) + }); + const GuestLaunchMeasurement = IDL.Record({ + metadata: IDL.Opt(GuestLaunchMeasurementMetadata), + measurement: IDL.Opt(IDL.Vec(IDL.Nat8)) + }); + const GuestLaunchMeasurements = IDL.Record({ + guest_launch_measurements: IDL.Opt(IDL.Vec(GuestLaunchMeasurement)) + }); + const BlessAlternativeGuestOsVersion = IDL.Record({ + rootfs_hash: IDL.Opt(IDL.Text), + chip_ids: IDL.Opt(IDL.Vec(IDL.Vec(IDL.Nat8))), + base_guest_launch_measurements: IDL.Opt(GuestLaunchMeasurements) + }); const Controllers = IDL.Record({controllers: IDL.Vec(IDL.Principal)}); const CanisterSettings = IDL.Record({ freezing_threshold: IDL.Opt(IDL.Nat64), @@ -1468,6 +1517,10 @@ export const init = ({IDL}) => { install_mode: IDL.Opt(IDL.Int32) }); const DeregisterKnownNeuron = IDL.Record({id: IDL.Opt(NeuronId)}); + const TakeCanisterSnapshot = IDL.Record({ + replace_snapshot: IDL.Opt(IDL.Vec(IDL.Nat8)), + canister_id: IDL.Opt(IDL.Principal) + }); const StopOrStartCanister = IDL.Record({ action: IDL.Opt(IDL.Int32), canister_id: IDL.Opt(IDL.Principal) @@ -1606,9 +1659,12 @@ export const init = ({IDL}) => { RegisterKnownNeuron: KnownNeuron, FulfillSubnetRentalRequest: FulfillSubnetRentalRequest, ManageNeuron: ManageNeuronProposal, + LoadCanisterSnapshot: LoadCanisterSnapshot, + BlessAlternativeGuestOsVersion: BlessAlternativeGuestOsVersion, UpdateCanisterSettings: UpdateCanisterSettings, InstallCode: InstallCode, DeregisterKnownNeuron: DeregisterKnownNeuron, + TakeCanisterSnapshot: TakeCanisterSnapshot, StopOrStartCanister: StopOrStartCanister, CreateServiceNervousSystem: CreateServiceNervousSystem, ExecuteNnsFunction: ExecuteNnsFunction, @@ -1628,6 +1684,7 @@ export const init = ({IDL}) => { Map: IDL.Vec(IDL.Tuple(IDL.Text, SelfDescribingValue)), Nat: IDL.Nat, Blob: IDL.Vec(IDL.Nat8), + Null: IDL.Null, Text: IDL.Text, Array: IDL.Vec(SelfDescribingValue) }) diff --git a/cli/src/declarations/internet_identity.did b/cli/src/declarations/internet_identity.did index 22ea667..5c70ac4 100644 --- a/cli/src/declarations/internet_identity.did +++ b/cli/src/declarations/internet_identity.did @@ -1020,5 +1020,5 @@ service : (opt InternetIdentityInit) -> { ) -> (variant { Ok : AccountInfo; Err: SetDefaultAccountError }); // Looks up identity number when called with a recovery phrase - lookup_caller_identity_by_recovery_phrase : () -> (opt IdentityNumber) query; + lookup_caller_identity_by_recovery_phrase : () -> (opt IdentityNumber); }; diff --git a/cli/src/declarations/internet_identity.idl.js b/cli/src/declarations/internet_identity.idl.js index 2d81fdf..1e7509d 100644 --- a/cli/src/declarations/internet_identity.idl.js +++ b/cli/src/declarations/internet_identity.idl.js @@ -722,7 +722,7 @@ export const idlFactory = ({IDL}) => { [IDL.Opt(IdentityNumber)], ['query'] ), - lookup_caller_identity_by_recovery_phrase: IDL.Func([], [IDL.Opt(IdentityNumber)], ['query']), + lookup_caller_identity_by_recovery_phrase: IDL.Func([], [IDL.Opt(IdentityNumber)], []), lookup_device_key: IDL.Func([IDL.Vec(IDL.Nat8)], [IDL.Opt(DeviceKeyWithAnchor)], ['query']), openid_credential_add: IDL.Func( [IdentityNumber, JWT, Salt], diff --git a/cli/src/declarations/observatory.d.ts b/cli/src/declarations/observatory.d.ts index e2c5726..3c42de5 100644 --- a/cli/src/declarations/observatory.d.ts +++ b/cli/src/declarations/observatory.d.ts @@ -13,10 +13,12 @@ import type {Principal} from '@icp-sdk/core/principal'; export interface Controller { updated_at: bigint; metadata: Array<[string, string]>; + kind: [] | [ControllerKind]; created_at: bigint; scope: ControllerScope; expires_at: [] | [bigint]; } +export type ControllerKind = {Emulator: null} | {Automation: null}; export type ControllerScope = {Write: null} | {Admin: null} | {Submit: null}; export interface CyclesBalance { timestamp: bigint; @@ -106,7 +108,7 @@ export interface OpenIdCertificate { created_at: bigint; version: [] | [bigint]; } -export type OpenIdProvider = {Google: null}; +export type OpenIdProvider = {GitHubActions: null} | {Google: null} | {GitHubAuth: null}; export interface RateConfig { max_tokens: bigint; time_per_token_ns: bigint; @@ -120,6 +122,7 @@ export interface Segment { export type SegmentKind = {Orbiter: null} | {MissionControl: null} | {Satellite: null}; export interface SetController { metadata: Array<[string, string]>; + kind: [] | [ControllerKind]; scope: ControllerScope; expires_at: [] | [bigint]; } @@ -131,15 +134,15 @@ export interface _SERVICE { del_controllers: ActorMethod<[DeleteControllersArgs], undefined>; get_notify_status: ActorMethod<[GetNotifications], NotifyStatus>; get_openid_certificate: ActorMethod<[GetOpenIdCertificateArgs], [] | [OpenIdCertificate]>; - is_openid_monitoring_enabled: ActorMethod<[], boolean>; + is_openid_monitoring_enabled: ActorMethod<[OpenIdProvider], boolean>; list_controllers: ActorMethod<[], Array<[Principal, Controller]>>; notify: ActorMethod<[NotifyArgs], undefined>; ping: ActorMethod<[NotifyArgs], undefined>; set_controllers: ActorMethod<[SetControllersArgs], undefined>; set_env: ActorMethod<[Env], undefined>; set_rate_config: ActorMethod<[RateKind, RateConfig], undefined>; - start_openid_monitoring: ActorMethod<[], undefined>; - stop_openid_monitoring: ActorMethod<[], undefined>; + start_openid_monitoring: ActorMethod<[OpenIdProvider], undefined>; + stop_openid_monitoring: ActorMethod<[OpenIdProvider], undefined>; } export declare const idlFactory: IDL.InterfaceFactory; export declare const init: (args: {IDL: typeof IDL}) => IDL.Type[]; diff --git a/cli/src/declarations/observatory.did b/cli/src/declarations/observatory.did index 947a831..f205862 100644 --- a/cli/src/declarations/observatory.did +++ b/cli/src/declarations/observatory.did @@ -1,10 +1,12 @@ type Controller = record { updated_at : nat64; metadata : vec record { text; text }; + kind : opt ControllerKind; created_at : nat64; scope : ControllerScope; expires_at : opt nat64; }; +type ControllerKind = variant { Emulator; Automation }; type ControllerScope = variant { Write; Admin; Submit }; type CyclesBalance = record { timestamp : nat64; amount : nat }; type DeleteControllersArgs = record { controllers : vec principal }; @@ -68,7 +70,7 @@ type OpenIdCertificate = record { created_at : nat64; version : opt nat64; }; -type OpenIdProvider = variant { Google }; +type OpenIdProvider = variant { GitHubActions; Google; GitHubAuth }; type RateConfig = record { max_tokens : nat64; time_per_token_ns : nat64 }; type RateKind = variant { OpenIdCertificateRequests }; type Segment = record { @@ -79,6 +81,7 @@ type Segment = record { type SegmentKind = variant { Orbiter; MissionControl; Satellite }; type SetController = record { metadata : vec record { text; text }; + kind : opt ControllerKind; scope : ControllerScope; expires_at : opt nat64; }; @@ -92,13 +95,13 @@ service : () -> { get_openid_certificate : (GetOpenIdCertificateArgs) -> ( opt OpenIdCertificate, ); - is_openid_monitoring_enabled : () -> (bool); + is_openid_monitoring_enabled : (OpenIdProvider) -> (bool); list_controllers : () -> (vec record { principal; Controller }) query; notify : (NotifyArgs) -> (); ping : (NotifyArgs) -> (); set_controllers : (SetControllersArgs) -> (); set_env : (Env) -> (); set_rate_config : (RateKind, RateConfig) -> (); - start_openid_monitoring : () -> (); - stop_openid_monitoring : () -> (); + start_openid_monitoring : (OpenIdProvider) -> (); + stop_openid_monitoring : (OpenIdProvider) -> (); } diff --git a/cli/src/declarations/observatory.idl.js b/cli/src/declarations/observatory.idl.js index 8d11407..ee2de03 100644 --- a/cli/src/declarations/observatory.idl.js +++ b/cli/src/declarations/observatory.idl.js @@ -20,7 +20,11 @@ export const idlFactory = ({IDL}) => { sent: IDL.Nat64, failed: IDL.Nat64 }); - const OpenIdProvider = IDL.Variant({Google: IDL.Null}); + const OpenIdProvider = IDL.Variant({ + GitHubActions: IDL.Null, + Google: IDL.Null, + GitHubAuth: IDL.Null + }); const GetOpenIdCertificateArgs = IDL.Record({provider: OpenIdProvider}); const JwkType = IDL.Variant({ EC: IDL.Null, @@ -55,6 +59,10 @@ export const idlFactory = ({IDL}) => { created_at: IDL.Nat64, version: IDL.Opt(IDL.Nat64) }); + const ControllerKind = IDL.Variant({ + Emulator: IDL.Null, + Automation: IDL.Null + }); const ControllerScope = IDL.Variant({ Write: IDL.Null, Admin: IDL.Null, @@ -63,6 +71,7 @@ export const idlFactory = ({IDL}) => { const Controller = IDL.Record({ updated_at: IDL.Nat64, metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + kind: IDL.Opt(ControllerKind), created_at: IDL.Nat64, scope: ControllerScope, expires_at: IDL.Opt(IDL.Nat64) @@ -111,6 +120,7 @@ export const idlFactory = ({IDL}) => { }); const SetController = IDL.Record({ metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + kind: IDL.Opt(ControllerKind), scope: ControllerScope, expires_at: IDL.Opt(IDL.Nat64) }); @@ -129,15 +139,15 @@ export const idlFactory = ({IDL}) => { del_controllers: IDL.Func([DeleteControllersArgs], [], []), get_notify_status: IDL.Func([GetNotifications], [NotifyStatus], ['query']), get_openid_certificate: IDL.Func([GetOpenIdCertificateArgs], [IDL.Opt(OpenIdCertificate)], []), - is_openid_monitoring_enabled: IDL.Func([], [IDL.Bool], []), + is_openid_monitoring_enabled: IDL.Func([OpenIdProvider], [IDL.Bool], []), list_controllers: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], ['query']), notify: IDL.Func([NotifyArgs], [], []), ping: IDL.Func([NotifyArgs], [], []), set_controllers: IDL.Func([SetControllersArgs], [], []), set_env: IDL.Func([Env], [], []), set_rate_config: IDL.Func([RateKind, RateConfig], [], []), - start_openid_monitoring: IDL.Func([], [], []), - stop_openid_monitoring: IDL.Func([], [], []) + start_openid_monitoring: IDL.Func([OpenIdProvider], [], []), + stop_openid_monitoring: IDL.Func([OpenIdProvider], [], []) }); }; diff --git a/cli/src/declarations/satellite.d.ts b/cli/src/declarations/satellite.d.ts index e5196cd..e9e921c 100644 --- a/cli/src/declarations/satellite.d.ts +++ b/cli/src/declarations/satellite.d.ts @@ -34,12 +34,27 @@ export interface AssetNoContent { export interface AssetsUpgradeOptions { clear_existing_assets: [] | [boolean]; } +export type AuthenticateAutomationArgs = { + OpenId: OpenIdPrepareAutomationArgs; +}; +export type AuthenticateAutomationResultResponse = + | { + Ok: [Principal, AutomationController]; + } + | {Err: AuthenticationAutomationError}; export type AuthenticateResultResponse = {Ok: Authentication} | {Err: AuthenticationError}; export interface Authentication { doc: Doc; delegation: PreparedDelegation; } export type AuthenticationArgs = {OpenId: OpenIdPrepareDelegationArgs}; +export type AuthenticationAutomationError = + | { + PrepareAutomation: PrepareAutomationError; + } + | {RegisterController: string} + | {SaveWorkflowMetadata: string} + | {SaveUniqueJtiToken: string}; export interface AuthenticationConfig { updated_at: [] | [bigint]; openid: [] | [AuthenticationConfigOpenId]; @@ -54,7 +69,7 @@ export interface AuthenticationConfigInternetIdentity { } export interface AuthenticationConfigOpenId { observatory_id: [] | [Principal]; - providers: Array<[OpenIdProvider, OpenIdProviderConfig]>; + providers: Array<[OpenIdDelegationProvider, OpenIdAuthProviderConfig]>; } export type AuthenticationError = | { @@ -64,6 +79,21 @@ export type AuthenticationError = export interface AuthenticationRules { allowed_callers: Array; } +export interface AutomationConfig { + updated_at: [] | [bigint]; + openid: [] | [AutomationConfigOpenId]; + created_at: [] | [bigint]; + version: [] | [bigint]; +} +export interface AutomationConfigOpenId { + observatory_id: [] | [Principal]; + providers: Array<[OpenIdAutomationProvider, OpenIdAutomationProviderConfig]>; +} +export interface AutomationController { + scope: AutomationScope; + expires_at: bigint; +} +export type AutomationScope = {Write: null} | {Submit: null}; export type CollectionType = {Db: null} | {Storage: null}; export interface CommitBatch { batch_id: bigint; @@ -78,6 +108,7 @@ export interface Config { db: [] | [DbConfig]; authentication: [] | [AuthenticationConfig]; storage: StorageConfig; + automation: [] | [AutomationConfig]; } export interface ConfigMaxMemorySize { stable: [] | [bigint]; @@ -86,10 +117,12 @@ export interface ConfigMaxMemorySize { export interface Controller { updated_at: bigint; metadata: Array<[string, string]>; + kind: [] | [ControllerKind]; created_at: bigint; scope: ControllerScope; expires_at: [] | [bigint]; } +export type ControllerKind = {Emulator: null} | {Automation: null}; export type ControllerScope = {Write: null} | {Admin: null} | {Submit: null}; export interface CustomDomain { updated_at: bigint; @@ -139,7 +172,8 @@ export type GetDelegationError = | {NoSuchDelegation: null} | {JwtVerify: JwtVerifyError} | {GetOrFetchJwks: GetOrRefreshJwksError} - | {DeriveSeedFailed: string}; + | {DeriveSeedFailed: string} + | {InvalidObservatoryId: string}; export type GetDelegationResultResponse = {Ok: SignedDelegation} | {Err: GetDelegationError}; export type GetOrRefreshJwksError = | {InvalidConfig: string} @@ -259,27 +293,54 @@ export interface MemorySize { stable: bigint; heap: bigint; } +export interface OpenIdAuthProviderConfig { + delegation: [] | [OpenIdAuthProviderDelegationConfig]; + client_id: string; +} +export interface OpenIdAuthProviderDelegationConfig { + targets: [] | [Array]; + max_time_to_live: [] | [bigint]; +} +export type OpenIdAutomationProvider = {GitHub: null}; +export interface OpenIdAutomationProviderConfig { + controller: [] | [OpenIdAutomationProviderControllerConfig]; + repositories: Array<[RepositoryKey, OpenIdAutomationRepositoryConfig]>; +} +export interface OpenIdAutomationProviderControllerConfig { + scope: [] | [AutomationScope]; + max_time_to_live: [] | [bigint]; +} +export interface OpenIdAutomationRepositoryConfig { + refs: [] | [Array]; +} +export type OpenIdDelegationProvider = {GitHub: null} | {Google: null}; export interface OpenIdGetDelegationArgs { jwt: string; session_key: Uint8Array; salt: Uint8Array; expiration: bigint; } +export interface OpenIdPrepareAutomationArgs { + jwt: string; + salt: Uint8Array; +} export interface OpenIdPrepareDelegationArgs { jwt: string; session_key: Uint8Array; salt: Uint8Array; } -export type OpenIdProvider = {Google: null}; -export interface OpenIdProviderConfig { - delegation: [] | [OpenIdProviderDelegationConfig]; - client_id: string; -} -export interface OpenIdProviderDelegationConfig { - targets: [] | [Array]; - max_time_to_live: [] | [bigint]; -} export type Permission = {Controllers: null} | {Private: null} | {Public: null} | {Managed: null}; +export type PrepareAutomationError = + | { + JwtFindProvider: JwtFindProviderError; + } + | {InvalidController: string} + | {GetCachedJwks: null} + | {JwtVerify: JwtVerifyError} + | {GetOrFetchJwks: GetOrRefreshJwksError} + | {ControllerAlreadyExists: null} + | {InvalidObservatoryId: string} + | {TooManyControllers: string}; export type PrepareDelegationError = | { JwtFindProvider: JwtFindProviderError; @@ -287,7 +348,8 @@ export type PrepareDelegationError = | {GetCachedJwks: null} | {JwtVerify: JwtVerifyError} | {GetOrFetchJwks: GetOrRefreshJwksError} - | {DeriveSeedFailed: string}; + | {DeriveSeedFailed: string} + | {InvalidObservatoryId: string}; export interface PreparedDelegation { user_key: Uint8Array; expiration: bigint; @@ -319,6 +381,10 @@ export interface RateConfig { max_tokens: bigint; time_per_token_ns: bigint; } +export interface RepositoryKey { + owner: string; + name: string; +} export interface Rule { max_capacity: [] | [number]; memory: [] | [Memory]; @@ -343,8 +409,13 @@ export interface SetAuthenticationConfig { internet_identity: [] | [AuthenticationConfigInternetIdentity]; rules: [] | [AuthenticationRules]; } +export interface SetAutomationConfig { + openid: [] | [AutomationConfigOpenId]; + version: [] | [bigint]; +} export interface SetController { metadata: Array<[string, string]>; + kind: [] | [ControllerKind]; scope: ControllerScope; expires_at: [] | [bigint]; } @@ -436,6 +507,10 @@ export interface UploadChunkResult { } export interface _SERVICE { authenticate: ActorMethod<[AuthenticationArgs], AuthenticateResultResponse>; + authenticate_automation: ActorMethod< + [AuthenticateAutomationArgs], + AuthenticateAutomationResultResponse + >; commit_asset_upload: ActorMethod<[CommitBatch], undefined>; commit_proposal: ActorMethod<[CommitProposal], null>; commit_proposal_asset_upload: ActorMethod<[CommitBatch], undefined>; @@ -447,6 +522,7 @@ export interface _SERVICE { count_proposals: ActorMethod<[], bigint>; del_asset: ActorMethod<[string, string], undefined>; del_assets: ActorMethod<[string], undefined>; + del_controller_self: ActorMethod<[], undefined>; del_controllers: ActorMethod<[DeleteControllersArgs], Array<[Principal, Controller]>>; del_custom_domain: ActorMethod<[string], undefined>; del_doc: ActorMethod<[string, string, DelDoc], undefined>; @@ -460,6 +536,7 @@ export interface _SERVICE { deposit_cycles: ActorMethod<[DepositCyclesArgs], undefined>; get_asset: ActorMethod<[string, string], [] | [AssetNoContent]>; get_auth_config: ActorMethod<[], [] | [AuthenticationConfig]>; + get_automation_config: ActorMethod<[], [] | [AutomationConfig]>; get_config: ActorMethod<[], Config>; get_db_config: ActorMethod<[], [] | [DbConfig]>; get_delegation: ActorMethod<[GetDelegationArgs], GetDelegationResultResponse>; @@ -491,6 +568,7 @@ export interface _SERVICE { reject_proposal: ActorMethod<[CommitProposal], null>; set_asset_token: ActorMethod<[string, string, [] | [string]], undefined>; set_auth_config: ActorMethod<[SetAuthenticationConfig], AuthenticationConfig>; + set_automation_config: ActorMethod<[SetAutomationConfig], AutomationConfig>; set_controllers: ActorMethod<[SetControllersArgs], Array<[Principal, Controller]>>; set_custom_domain: ActorMethod<[string, [] | [string]], undefined>; set_db_config: ActorMethod<[SetDbConfig], DbConfig>; diff --git a/cli/src/declarations/satellite.did b/cli/src/declarations/satellite.did index dab97df..98f714f 100644 --- a/cli/src/declarations/satellite.did +++ b/cli/src/declarations/satellite.did @@ -22,12 +22,25 @@ type AssetNoContent = record { version : opt nat64; }; type AssetsUpgradeOptions = record { clear_existing_assets : opt bool }; +type AuthenticateAutomationArgs = variant { + OpenId : OpenIdPrepareAutomationArgs; +}; +type AuthenticateAutomationResultResponse = variant { + Ok : record { principal; AutomationController }; + Err : AuthenticationAutomationError; +}; type AuthenticateResultResponse = variant { Ok : Authentication; Err : AuthenticationError; }; type Authentication = record { doc : Doc; delegation : PreparedDelegation }; type AuthenticationArgs = variant { OpenId : OpenIdPrepareDelegationArgs }; +type AuthenticationAutomationError = variant { + PrepareAutomation : PrepareAutomationError; + RegisterController : text; + SaveWorkflowMetadata : text; + SaveUniqueJtiToken : text; +}; type AuthenticationConfig = record { updated_at : opt nat64; openid : opt AuthenticationConfigOpenId; @@ -42,13 +55,31 @@ type AuthenticationConfigInternetIdentity = record { }; type AuthenticationConfigOpenId = record { observatory_id : opt principal; - providers : vec record { OpenIdProvider; OpenIdProviderConfig }; + providers : vec record { OpenIdDelegationProvider; OpenIdAuthProviderConfig }; }; type AuthenticationError = variant { PrepareDelegation : PrepareDelegationError; RegisterUser : text; }; type AuthenticationRules = record { allowed_callers : vec principal }; +type AutomationConfig = record { + updated_at : opt nat64; + openid : opt AutomationConfigOpenId; + created_at : opt nat64; + version : opt nat64; +}; +type AutomationConfigOpenId = record { + observatory_id : opt principal; + providers : vec record { + OpenIdAutomationProvider; + OpenIdAutomationProviderConfig; + }; +}; +type AutomationController = record { + scope : AutomationScope; + expires_at : nat64; +}; +type AutomationScope = variant { Write; Submit }; type CollectionType = variant { Db; Storage }; type CommitBatch = record { batch_id : nat; @@ -60,15 +91,18 @@ type Config = record { db : opt DbConfig; authentication : opt AuthenticationConfig; storage : StorageConfig; + automation : opt AutomationConfig; }; type ConfigMaxMemorySize = record { stable : opt nat64; heap : opt nat64 }; type Controller = record { updated_at : nat64; metadata : vec record { text; text }; + kind : opt ControllerKind; created_at : nat64; scope : ControllerScope; expires_at : opt nat64; }; +type ControllerKind = variant { Emulator; Automation }; type ControllerScope = variant { Write; Admin; Submit }; type CustomDomain = record { updated_at : nat64; @@ -108,6 +142,7 @@ type GetDelegationError = variant { JwtVerify : JwtVerifyError; GetOrFetchJwks : GetOrRefreshJwksError; DeriveSeedFailed : text; + InvalidObservatoryId : text; }; type GetDelegationResultResponse = variant { Ok : SignedDelegation; @@ -212,33 +247,55 @@ type ListRulesResults = record { }; type Memory = variant { Heap; Stable }; type MemorySize = record { stable : nat64; heap : nat64 }; +type OpenIdAuthProviderConfig = record { + delegation : opt OpenIdAuthProviderDelegationConfig; + client_id : text; +}; +type OpenIdAuthProviderDelegationConfig = record { + targets : opt vec principal; + max_time_to_live : opt nat64; +}; +type OpenIdAutomationProvider = variant { GitHub }; +type OpenIdAutomationProviderConfig = record { + controller : opt OpenIdAutomationProviderControllerConfig; + repositories : vec record { RepositoryKey; OpenIdAutomationRepositoryConfig }; +}; +type OpenIdAutomationProviderControllerConfig = record { + scope : opt AutomationScope; + max_time_to_live : opt nat64; +}; +type OpenIdAutomationRepositoryConfig = record { refs : opt vec text }; +type OpenIdDelegationProvider = variant { GitHub; Google }; type OpenIdGetDelegationArgs = record { jwt : text; session_key : blob; salt : blob; expiration : nat64; }; +type OpenIdPrepareAutomationArgs = record { jwt : text; salt : blob }; type OpenIdPrepareDelegationArgs = record { jwt : text; session_key : blob; salt : blob; }; -type OpenIdProvider = variant { Google }; -type OpenIdProviderConfig = record { - delegation : opt OpenIdProviderDelegationConfig; - client_id : text; -}; -type OpenIdProviderDelegationConfig = record { - targets : opt vec principal; - max_time_to_live : opt nat64; -}; type Permission = variant { Controllers; Private; Public; Managed }; +type PrepareAutomationError = variant { + JwtFindProvider : JwtFindProviderError; + InvalidController : text; + GetCachedJwks; + JwtVerify : JwtVerifyError; + GetOrFetchJwks : GetOrRefreshJwksError; + ControllerAlreadyExists; + InvalidObservatoryId : text; + TooManyControllers : text; +}; type PrepareDelegationError = variant { JwtFindProvider : JwtFindProviderError; GetCachedJwks; JwtVerify : JwtVerifyError; GetOrFetchJwks : GetOrRefreshJwksError; DeriveSeedFailed : text; + InvalidObservatoryId : text; }; type PreparedDelegation = record { user_key : blob; expiration : nat64 }; type Proposal = record { @@ -265,6 +322,7 @@ type ProposalType = variant { SegmentsDeployment : SegmentsDeploymentOptions; }; type RateConfig = record { max_tokens : nat64; time_per_token_ns : nat64 }; +type RepositoryKey = record { owner : text; name : text }; type Rule = record { max_capacity : opt nat32; memory : opt Memory; @@ -289,8 +347,13 @@ type SetAuthenticationConfig = record { internet_identity : opt AuthenticationConfigInternetIdentity; rules : opt AuthenticationRules; }; +type SetAutomationConfig = record { + openid : opt AutomationConfigOpenId; + version : opt nat64; +}; type SetController = record { metadata : vec record { text; text }; + kind : opt ControllerKind; scope : ControllerScope; expires_at : opt nat64; }; @@ -375,6 +438,9 @@ type UploadChunk = record { type UploadChunkResult = record { chunk_id : nat }; service : (InitSatelliteArgs) -> { authenticate : (AuthenticationArgs) -> (AuthenticateResultResponse); + authenticate_automation : (AuthenticateAutomationArgs) -> ( + AuthenticateAutomationResultResponse, + ); commit_asset_upload : (CommitBatch) -> (); commit_proposal : (CommitProposal) -> (null); commit_proposal_asset_upload : (CommitBatch) -> (); @@ -386,6 +452,7 @@ service : (InitSatelliteArgs) -> { count_proposals : () -> (nat64) query; del_asset : (text, text) -> (); del_assets : (text) -> (); + del_controller_self : () -> (); del_controllers : (DeleteControllersArgs) -> ( vec record { principal; Controller }, ); @@ -401,6 +468,7 @@ service : (InitSatelliteArgs) -> { deposit_cycles : (DepositCyclesArgs) -> (); get_asset : (text, text) -> (opt AssetNoContent) query; get_auth_config : () -> (opt AuthenticationConfig) query; + get_automation_config : () -> (opt AutomationConfig) query; get_config : () -> (Config); get_db_config : () -> (opt DbConfig) query; get_delegation : (GetDelegationArgs) -> (GetDelegationResultResponse) query; @@ -434,6 +502,7 @@ service : (InitSatelliteArgs) -> { reject_proposal : (CommitProposal) -> (null); set_asset_token : (text, text, opt text) -> (); set_auth_config : (SetAuthenticationConfig) -> (AuthenticationConfig); + set_automation_config : (SetAutomationConfig) -> (AutomationConfig); set_controllers : (SetControllersArgs) -> ( vec record { principal; Controller }, ); diff --git a/cli/src/declarations/satellite.idl.js b/cli/src/declarations/satellite.idl.js index 204b45a..f3d1132 100644 --- a/cli/src/declarations/satellite.idl.js +++ b/cli/src/declarations/satellite.idl.js @@ -65,7 +65,8 @@ export const idlFactory = ({IDL}) => { GetCachedJwks: IDL.Null, JwtVerify: JwtVerifyError, GetOrFetchJwks: GetOrRefreshJwksError, - DeriveSeedFailed: IDL.Text + DeriveSeedFailed: IDL.Text, + InvalidObservatoryId: IDL.Text }); const AuthenticationError = IDL.Variant({ PrepareDelegation: PrepareDelegationError, @@ -75,6 +76,41 @@ export const idlFactory = ({IDL}) => { Ok: Authentication, Err: AuthenticationError }); + const OpenIdPrepareAutomationArgs = IDL.Record({ + jwt: IDL.Text, + salt: IDL.Vec(IDL.Nat8) + }); + const AuthenticateAutomationArgs = IDL.Variant({ + OpenId: OpenIdPrepareAutomationArgs + }); + const AutomationScope = IDL.Variant({ + Write: IDL.Null, + Submit: IDL.Null + }); + const AutomationController = IDL.Record({ + scope: AutomationScope, + expires_at: IDL.Nat64 + }); + const PrepareAutomationError = IDL.Variant({ + JwtFindProvider: JwtFindProviderError, + InvalidController: IDL.Text, + GetCachedJwks: IDL.Null, + JwtVerify: JwtVerifyError, + GetOrFetchJwks: GetOrRefreshJwksError, + ControllerAlreadyExists: IDL.Null, + InvalidObservatoryId: IDL.Text, + TooManyControllers: IDL.Text + }); + const AuthenticationAutomationError = IDL.Variant({ + PrepareAutomation: PrepareAutomationError, + RegisterController: IDL.Text, + SaveWorkflowMetadata: IDL.Text, + SaveUniqueJtiToken: IDL.Text + }); + const AuthenticateAutomationResultResponse = IDL.Variant({ + Ok: IDL.Tuple(IDL.Principal, AutomationController), + Err: AuthenticationAutomationError + }); const CommitBatch = IDL.Record({ batch_id: IDL.Nat, headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), @@ -115,6 +151,10 @@ export const idlFactory = ({IDL}) => { const DeleteControllersArgs = IDL.Record({ controllers: IDL.Vec(IDL.Principal) }); + const ControllerKind = IDL.Variant({ + Emulator: IDL.Null, + Automation: IDL.Null + }); const ControllerScope = IDL.Variant({ Write: IDL.Null, Admin: IDL.Null, @@ -123,6 +163,7 @@ export const idlFactory = ({IDL}) => { const Controller = IDL.Record({ updated_at: IDL.Nat64, metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + kind: IDL.Opt(ControllerKind), created_at: IDL.Nat64, scope: ControllerScope, expires_at: IDL.Opt(IDL.Nat64) @@ -158,18 +199,21 @@ export const idlFactory = ({IDL}) => { created_at: IDL.Nat64, version: IDL.Opt(IDL.Nat64) }); - const OpenIdProvider = IDL.Variant({Google: IDL.Null}); - const OpenIdProviderDelegationConfig = IDL.Record({ + const OpenIdDelegationProvider = IDL.Variant({ + GitHub: IDL.Null, + Google: IDL.Null + }); + const OpenIdAuthProviderDelegationConfig = IDL.Record({ targets: IDL.Opt(IDL.Vec(IDL.Principal)), max_time_to_live: IDL.Opt(IDL.Nat64) }); - const OpenIdProviderConfig = IDL.Record({ - delegation: IDL.Opt(OpenIdProviderDelegationConfig), + const OpenIdAuthProviderConfig = IDL.Record({ + delegation: IDL.Opt(OpenIdAuthProviderDelegationConfig), client_id: IDL.Text }); const AuthenticationConfigOpenId = IDL.Record({ observatory_id: IDL.Opt(IDL.Principal), - providers: IDL.Vec(IDL.Tuple(OpenIdProvider, OpenIdProviderConfig)) + providers: IDL.Vec(IDL.Tuple(OpenIdDelegationProvider, OpenIdAuthProviderConfig)) }); const AuthenticationConfigInternetIdentity = IDL.Record({ derivation_origin: IDL.Opt(IDL.Text), @@ -186,6 +230,29 @@ export const idlFactory = ({IDL}) => { internet_identity: IDL.Opt(AuthenticationConfigInternetIdentity), rules: IDL.Opt(AuthenticationRules) }); + const OpenIdAutomationProvider = IDL.Variant({GitHub: IDL.Null}); + const OpenIdAutomationProviderControllerConfig = IDL.Record({ + scope: IDL.Opt(AutomationScope), + max_time_to_live: IDL.Opt(IDL.Nat64) + }); + const RepositoryKey = IDL.Record({owner: IDL.Text, name: IDL.Text}); + const OpenIdAutomationRepositoryConfig = IDL.Record({ + refs: IDL.Opt(IDL.Vec(IDL.Text)) + }); + const OpenIdAutomationProviderConfig = IDL.Record({ + controller: IDL.Opt(OpenIdAutomationProviderControllerConfig), + repositories: IDL.Vec(IDL.Tuple(RepositoryKey, OpenIdAutomationRepositoryConfig)) + }); + const AutomationConfigOpenId = IDL.Record({ + observatory_id: IDL.Opt(IDL.Principal), + providers: IDL.Vec(IDL.Tuple(OpenIdAutomationProvider, OpenIdAutomationProviderConfig)) + }); + const AutomationConfig = IDL.Record({ + updated_at: IDL.Opt(IDL.Nat64), + openid: IDL.Opt(AutomationConfigOpenId), + created_at: IDL.Opt(IDL.Nat64), + version: IDL.Opt(IDL.Nat64) + }); const ConfigMaxMemorySize = IDL.Record({ stable: IDL.Opt(IDL.Nat64), heap: IDL.Opt(IDL.Nat64) @@ -223,7 +290,8 @@ export const idlFactory = ({IDL}) => { const Config = IDL.Record({ db: IDL.Opt(DbConfig), authentication: IDL.Opt(AuthenticationConfig), - storage: StorageConfig + storage: StorageConfig, + automation: IDL.Opt(AutomationConfig) }); const OpenIdGetDelegationArgs = IDL.Record({ jwt: IDL.Text, @@ -247,7 +315,8 @@ export const idlFactory = ({IDL}) => { NoSuchDelegation: IDL.Null, JwtVerify: JwtVerifyError, GetOrFetchJwks: GetOrRefreshJwksError, - DeriveSeedFailed: IDL.Text + DeriveSeedFailed: IDL.Text, + InvalidObservatoryId: IDL.Text }); const GetDelegationResultResponse = IDL.Variant({ Ok: SignedDelegation, @@ -396,8 +465,13 @@ export const idlFactory = ({IDL}) => { internet_identity: IDL.Opt(AuthenticationConfigInternetIdentity), rules: IDL.Opt(AuthenticationRules) }); + const SetAutomationConfig = IDL.Record({ + openid: IDL.Opt(AutomationConfigOpenId), + version: IDL.Opt(IDL.Nat64) + }); const SetController = IDL.Record({ metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + kind: IDL.Opt(ControllerKind), scope: ControllerScope, expires_at: IDL.Opt(IDL.Nat64) }); @@ -443,6 +517,11 @@ export const idlFactory = ({IDL}) => { return IDL.Service({ authenticate: IDL.Func([AuthenticationArgs], [AuthenticateResultResponse], []), + authenticate_automation: IDL.Func( + [AuthenticateAutomationArgs], + [AuthenticateAutomationResultResponse], + [] + ), commit_asset_upload: IDL.Func([CommitBatch], [], []), commit_proposal: IDL.Func([CommitProposal], [IDL.Null], []), commit_proposal_asset_upload: IDL.Func([CommitBatch], [], []), @@ -454,6 +533,7 @@ export const idlFactory = ({IDL}) => { count_proposals: IDL.Func([], [IDL.Nat64], ['query']), del_asset: IDL.Func([IDL.Text, IDL.Text], [], []), del_assets: IDL.Func([IDL.Text], [], []), + del_controller_self: IDL.Func([], [], []), del_controllers: IDL.Func( [DeleteControllersArgs], [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], @@ -471,6 +551,7 @@ export const idlFactory = ({IDL}) => { deposit_cycles: IDL.Func([DepositCyclesArgs], [], []), get_asset: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(AssetNoContent)], ['query']), get_auth_config: IDL.Func([], [IDL.Opt(AuthenticationConfig)], ['query']), + get_automation_config: IDL.Func([], [IDL.Opt(AutomationConfig)], ['query']), get_config: IDL.Func([], [Config], []), get_db_config: IDL.Func([], [IDL.Opt(DbConfig)], ['query']), get_delegation: IDL.Func([GetDelegationArgs], [GetDelegationResultResponse], ['query']), @@ -512,6 +593,7 @@ export const idlFactory = ({IDL}) => { reject_proposal: IDL.Func([CommitProposal], [IDL.Null], []), set_asset_token: IDL.Func([IDL.Text, IDL.Text, IDL.Opt(IDL.Text)], [], []), set_auth_config: IDL.Func([SetAuthenticationConfig], [AuthenticationConfig], []), + set_automation_config: IDL.Func([SetAutomationConfig], [AutomationConfig], []), set_controllers: IDL.Func( [SetControllersArgs], [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],