Type Alias PolicyConfigLifecycleFunction<AbilityParams, UserParams, AllowResult, DenyResult>
Type Parameters
- AbilityParams extends z.ZodType
- UserParams extends z.ZodType = z.ZodUndefined
- AllowResult extends z.ZodType = z.ZodUndefined
- DenyResult extends z.ZodType = z.ZodUndefined
Type declaration
- (
args: {
abilityParams: z.infer<AbilityParams>;
userParams: z.infer<UserParams>;
},
ctx: PolicyContext<AllowResult, DenyResult>,
): Promise<
EnforcePolicyResponse<
| (
AllowResult extends z.ZodUndefined
? ContextAllowResponseNoResult
: ContextAllowResponse<z.infer<AllowResult>>
)
| (
DenyResult extends z.ZodUndefined
? ContextDenyResponseNoResult
: ContextDenyResponse<z.infer<DenyResult>>
),
>,
> Parameters
- args: { abilityParams: z.infer<AbilityParams>; userParams: z.infer<UserParams> }
- ctx: PolicyContext<AllowResult, DenyResult>
allow: AllowSchema extends ZodUndefined
? () => ContextAllowResponseNoResult
: (
result: TypeOf<AllowSchema>,
) => ContextAllowResponse<TypeOf<AllowSchema>>
deny: DenySchema extends ZodUndefined
? () => ContextDenyResponseNoResult
: (
result: TypeOf<DenySchema>,
runtimeError?: string,
) => ContextDenyResponse<TypeOf<DenySchema>>
abilityIpfsCid: string
appId: number
appVersion: number
delegation: {
delegateeAddress: string;
delegatorPkpInfo: {
tokenId: string;
ethAddress: string;
publicKey: string;
};
}
Returns Promise<
EnforcePolicyResponse<
| (
AllowResult extends z.ZodUndefined
? ContextAllowResponseNoResult
: ContextAllowResponse<z.infer<AllowResult>>
)
| (
DenyResult extends z.ZodUndefined
? ContextDenyResponseNoResult
: ContextDenyResponse<z.infer<DenyResult>>
),
>,
>
evaluate()
andprecheck()
functions that you define when usingcreateVincentPolicy()
will match this function signature. Note that the arguments and return types are inferred based on the ZOD schemas that you pass tocreateVincentPolicy