@cubist-labs/cubesigner-sdk 0.4.259 → 0.4.260

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/role.ts CHANGED
@@ -484,8 +484,30 @@ export type NamedPolicyReference = {
484
484
  Reference: PolicyReference;
485
485
  };
486
486
 
487
+ /** Explicit "permit" vs "deny" policy outcome, with or without a descriptive message. */
488
+ export type Const = ConstOutcome | { outcome: ConstOutcome; message: string };
489
+
490
+ /** Explicit "permit" vs "deny" policy outcome. */
491
+ export type ConstOutcome = "Permit" | "Deny";
492
+
493
+ /**
494
+ * A {@link https://github.com/google/cel-spec Common Expression Language}
495
+ * policy to evaluate against the following context:
496
+ *
497
+ * ```json
498
+ * {
499
+ * "operation": OperationKind,
500
+ * "identity": <UserOrRoleId>,
501
+ * "body": <RequestBodyJson>
502
+ * }
503
+ * ```
504
+ */
505
+ export type Cel = { Cel: string };
506
+
487
507
  /** Key policies that restrict the requests that the signing endpoints accept */
488
508
  export type KeyDenyPolicy =
509
+ | Const
510
+ | Cel
489
511
  | OperationAllowlist
490
512
  | TxReceiver
491
513
  | TxDeposit
@@ -508,6 +530,7 @@ export type KeyDenyPolicy =
508
530
  | PolicyAnd
509
531
  | PolicyOr
510
532
  | PolicyNot
533
+ | PolicyIte
511
534
  | NamedPolicyReference;
512
535
 
513
536
  /**
@@ -545,6 +568,30 @@ export type RolePolicy = RolePolicyRule[];
545
568
 
546
569
  export type RolePolicyRule = KeyDenyPolicy | PolicyReference;
547
570
 
571
+ /** Conditional policy */
572
+ export type Conditional = {
573
+ /** The condition to evaluate first. */
574
+ if: KeyDenyPolicy;
575
+
576
+ /** The policy to apply when the condition evaluates to 'Permit'. */
577
+ then: KeyDenyPolicy;
578
+ };
579
+
580
+ /** One or more conditional policies */
581
+ export type Conditionals =
582
+ | Conditional
583
+ | {
584
+ conditionals: Conditional[];
585
+ };
586
+
587
+ /** If-then-else policy */
588
+ export type PolicyIte = {
589
+ IfThenElse: Conditionals & {
590
+ /** The policy to apply when none of the conditionals apply. */
591
+ else: KeyDenyPolicy;
592
+ };
593
+ };
594
+
548
595
  export type PolicyAnd = {
549
596
  And: KeyDenyPolicy[];
550
597
  };