@@ -2715,14 +2715,6 @@ type MeResult = variant {
27152715 Err : Error;
27162716};
27172717
2718- // The admin that is created in the station during the init process.
2719- type AdminInitInput = record {
2720- // The name of the user.
2721- name : text;
2722- // The identity of the admin.
2723- identity : principal;
2724- };
2725-
27262718// An input type for configuring the upgrader canister.
27272719type SystemUpgraderInput = variant {
27282720 // An existing upgrader canister.
@@ -2752,10 +2744,32 @@ type InitAccountInput = record {
27522744 metadata : vec AccountMetadata;
27532745};
27542746
2747+ // The permissions for the account.
2748+ type InitAccountPermissionsInput = record {
2749+ // Who can read the account information.
2750+ read_permission : Allow;
2751+ // Who can request updates to the account.
2752+ configs_permission : Allow;
2753+ // Who can request transfers from the account.
2754+ transfer_permission : Allow;
2755+ // The approval policy for updates to the account.
2756+ configs_request_policy : opt RequestPolicyRule;
2757+ // The approval policy for transfers from the account.
2758+ transfer_request_policy : opt RequestPolicyRule;
2759+ };
2760+
2761+ // The initial account to create when initializing the canister for the first time.
2762+ type InitAccountWithPermissionsInput = record {
2763+ // The initial account to create.
2764+ account_init : InitAccountInput;
2765+ // The permissions for the account.
2766+ permissions : InitAccountPermissionsInput;
2767+ };
2768+
27552769// The initial assets to create when initializing the canister for the first time, e.g., after disaster recovery.
27562770type InitAssetInput = record {
27572771 // The UUID of the asset, if not provided a new UUID will be generated.
2758- id : UUID;
2772+ id : opt UUID;
27592773 // The name of the asset.
27602774 name : text;
27612775 // The blockchain identifier (e.g., `ethereum`, `bitcoin`, `icp`, etc.)
@@ -2770,24 +2784,133 @@ type InitAssetInput = record {
27702784 metadata : vec AssetMetadata;
27712785};
27722786
2773- // The init configuration for the canister.
2787+ // The input type for creating a user group when initializing the canister for the first time.
2788+ type InitUserGroupInput = record {
2789+ // The id of the user group, if not provided a new UUID will be generated.
2790+ id : opt UUID;
2791+ // The name of the user group, must be unique.
2792+ name : text;
2793+ };
2794+
2795+ // The input type for adding identities to a user.
2796+ type UserIdentityInput = record {
2797+ // The identity of the user.
2798+ identity : principal;
2799+ };
2800+
2801+ // The users to create when initializing the canister for the first time.
2802+ type InitUserInput = record {
2803+ // The id of the user, if not provided a new UUID will be generated.
2804+ id : opt UUID;
2805+ // The name of the user.
2806+ name : text;
2807+ // The identities of the user.
2808+ identities : vec UserIdentityInput;
2809+ // The user groups to associate with the user (optional).
2810+ // If not provided it defaults to the [`Admin`,`Operator`] groups if default user groups are created,
2811+ // i.e., when the field `initial_config` in `SystemInit` has the form of `WithAllDefaults` or `WithDefaultPolicies`.
2812+ groups : opt vec UUID;
2813+ // The status of the user (e.g. `Active`).
2814+ status : UserStatus;
2815+ };
2816+
2817+ // The init type for initializing the permissions when first creating the canister.
2818+ type InitPermissionInput = record {
2819+ // The resource that the permission is for.
2820+ resource : Resource;
2821+ // The allow rules for who can access the resource.
2822+ allow : Allow;
2823+ };
2824+
2825+ // The init type for adding a request approval policy when initializing the canister for the first time.
2826+ type InitRequestPolicyInput = record {
2827+ // The id of the request policy, if not provided a new UUID will be generated.
2828+ id : opt UUID;
2829+ // The request specifier that identifies what operation this policy is for (e.g. "transfer").
2830+ specifier : RequestSpecifier;
2831+ // The rule to use for the request approval evaluation (e.g. "quorum").
2832+ rule : RequestPolicyRule;
2833+ };
2834+
2835+ // The init type for adding a named rule when initializing the canister for the first time.
2836+ type InitNamedRuleInput = record {
2837+ // The id of the named rule, if not provided a new UUID will be generated.
2838+ id : opt UUID;
2839+ // The name of the named rule.
2840+ name : text;
2841+ // The description of the named rule.
2842+ description : opt text;
2843+ // The rule to use for the named rule.
2844+ rule : RequestPolicyRule;
2845+ };
2846+
2847+ // The initial configuration for the station.
2848+ //
2849+ // Unless the `Complete` variant is used, the station will be initialized with default user
2850+ // groups, named rules (aka. approval rules), request policies, permissions, and assets.
27742851//
2775- // Only used when installing the canister for the first time.
2852+ // The default user groups for the station will be:
2853+ // - `Admin` with the UUID "00000000-0000-4000-8000-000000000000"
2854+ // - `Operator` with the UUID "00000000-0000-4000-8000-000000000001"
2855+ //
2856+ // The default named rules for the station will be:
2857+ // - `Admin approval` with a specified admin quorum
2858+ // - `Operator approval` with a specified operator and admin quorum
2859+ //
2860+ type InitialConfig = variant {
2861+ // Initialize the station with default user groups, named rules, policies, permissions, and assets.
2862+ // This does not create an initial account.
2863+ WithAllDefaults : record {
2864+ // The initial users to create.
2865+ users : vec InitUserInput;
2866+ // The initial admin quorum in the admin level approval rule.
2867+ admin_quorum : nat16;
2868+ // The initial operator quorum in the operator level approval rule.
2869+ operator_quorum : nat16;
2870+ };
2871+ // Initialize the station with default user groups, named rules, policies, permissions.
2872+ WithDefaultPolicies : record {
2873+ // The initial users to create.
2874+ users : vec InitUserInput;
2875+ // The initial accounts to create.
2876+ accounts : vec InitAccountInput;
2877+ // The initial assets to create.
2878+ assets : vec InitAssetInput;
2879+ // The initial admin quorum in the admin level approval rule.
2880+ admin_quorum : nat16;
2881+ // The initial operator quorum in the operator level approval rule.
2882+ operator_quorum : nat16;
2883+ };
2884+ // Initialize the station with all custom entries.
2885+ Complete : record {
2886+ // The initial users to create.
2887+ users : vec InitUserInput;
2888+ // The initial user groups to create.
2889+ user_groups : vec InitUserGroupInput;
2890+ // The initial permissions to create.
2891+ permissions : vec InitPermissionInput;
2892+ // The initial request policies to create.
2893+ request_policies : vec InitRequestPolicyInput;
2894+ // The initial named rules to create.
2895+ named_rules : vec InitNamedRuleInput;
2896+ // The initial accounts to create.
2897+ accounts : vec InitAccountWithPermissionsInput;
2898+ // The initial assets to create.
2899+ assets : vec InitAssetInput;
2900+ // The initial disaster recovery committee to create.
2901+ disaster_recovery_committee : opt DisasterRecoveryCommittee;
2902+ };
2903+ };
2904+
27762905type SystemInit = record {
27772906 // The name of the station.
27782907 name : text;
2779- // The list of admin principals to be associated with the station.
2780- admins : vec AdminInitInput;
2781- // Quorum of admins for initial policies.
2782- quorum : opt nat16;
27832908 // The upgrader configuration.
27842909 upgrader : SystemUpgraderInput;
2785- // An optional additional controller of the station and upgrader canisters.
2910+ // An additional controller of the station and upgrader canisters (optional) .
27862911 fallback_controller : opt principal;
2787- // Optional initial accounts to create.
2788- accounts : opt vec InitAccountInput;
2789- // Optional initial assets to create.
2790- assets : opt vec InitAssetInput;
2912+ // The initial configuration to apply.
2913+ initial_config: InitialConfig;
27912914};
27922915
27932916// The upgrade configuration for the canister.
0 commit comments