// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import * as KeyQuorumsAPI from './key-quorums'; import * as SharedAPI from './shared'; import * as PoliciesAPI from './policies/policies'; import * as WalletsAPI from './wallets/wallets'; export class Intents extends APIResource {} /** * Common fields for intent action execution results. */ export interface BaseActionResult { /** * Unix timestamp when the action was executed */ executed_at: number; /** * HTTP status code from the action execution */ status_code: number; /** * Display name of the key quorum that authorized execution */ authorized_by_display_name?: string; /** * ID of the key quorum that authorized execution */ authorized_by_id?: string; } /** * Common fields shared by all intent response types. */ export interface BaseIntentResponse { /** * Detailed authorization information including key quorum members, thresholds, and * signature status */ authorization_details: Array; /** * Unix timestamp when the intent was created */ created_at: number; /** * Display name of the user who created the intent */ created_by_display_name: string; /** * Whether this intent has a custom expiry time set by the client. If false, the * intent expires after a default duration. */ custom_expiry: boolean; /** * Unix timestamp when the intent expires */ expires_at: number; /** * Unique ID for the intent */ intent_id: string; /** * ID of the resource being modified (wallet_id, policy_id, etc) */ resource_id: string; /** * Current status of an intent. */ status: IntentStatus; /** * ID of the user who created the intent. If undefined, the intent was created * using the app secret */ created_by_id?: string; /** * Human-readable reason for dismissal, present when status is 'dismissed' */ dismissal_reason?: string; /** * Unix timestamp when the intent was dismissed, present when status is 'dismissed' */ dismissed_at?: number; /** * Unix timestamp when the intent was rejected, present when status is 'rejected' */ rejected_at?: number; } /** * Response for a condition set delete intent */ export interface ConditionSetDeleteIntentResponse extends BaseIntentResponse { intent_type: 'CONDITION_SET'; /** * Request details for deleting a condition set via intent. */ request_details: ConditionSetIntentDeleteRequestDetails; /** * Result of condition set execution (only present if status is 'executed' or * 'failed') */ action_result?: BaseActionResult; /** * A condition set for grouping related condition values. */ current_resource_data?: PoliciesAPI.ConditionSet; } /** * Empty request body for a condition set delete intent. */ export interface ConditionSetIntentDeleteRequestBody {} /** * Request details for deleting a condition set via intent. */ export interface ConditionSetIntentDeleteRequestDetails { method: 'DELETE'; url: string; /** * Empty request body for a condition set delete intent. */ body?: ConditionSetIntentDeleteRequestBody; } /** * Response for a condition set intent */ export interface ConditionSetIntentResponse extends BaseIntentResponse { intent_type: 'CONDITION_SET'; /** * Request details for deleting a condition set via intent. */ request_details: ConditionSetIntentDeleteRequestDetails; /** * Result of condition set execution (only present if status is 'executed' or * 'failed') */ action_result?: BaseActionResult; /** * A condition set for grouping related condition values. */ current_resource_data?: PoliciesAPI.ConditionSet; } /** * Response for an intent that deletes a condition set item */ export interface ConditionSetItemDeleteIntentResponse extends BaseIntentResponse { intent_type: 'CONDITION_SET_ITEM'; /** * Request details for deleting a condition set item via intent. */ request_details: ConditionSetItemIntentDeleteRequestDetails; /** * Result of condition set item execution (only present if status is 'executed' or * 'failed') */ action_result?: BaseActionResult; /** * A condition set for grouping related condition values. */ condition_set?: PoliciesAPI.ConditionSet; /** * A single item in a condition set. */ current_resource_data?: PoliciesAPI.ConditionSetItem; } /** * Request details for adding items to a condition set via intent. */ export interface ConditionSetItemIntentCreateRequestDetails { /** * Array of values to add to the condition set. Maximum 100 items per request. */ body: PoliciesAPI.ConditionSetItemsRequestBody; method: 'POST'; url: string; } /** * Empty request body for a condition set item delete intent. */ export interface ConditionSetItemIntentDeleteRequestBody {} /** * Request details for deleting a condition set item via intent. */ export interface ConditionSetItemIntentDeleteRequestDetails { method: 'DELETE'; url: string; /** * Empty request body for a condition set item delete intent. */ body?: ConditionSetItemIntentDeleteRequestBody; } /** * The original condition set item request. Method is POST (add items), PUT * (replace items), or DELETE (delete an item) */ export type ConditionSetItemIntentRequestDetails = | ConditionSetItemIntentCreateRequestDetails | ConditionSetItemIntentUpdateRequestDetails | ConditionSetItemIntentDeleteRequestDetails; /** * Response for a condition set item intent */ export interface ConditionSetItemIntentResponse extends BaseIntentResponse { intent_type: 'CONDITION_SET_ITEM'; /** * The original condition set item request. Method is POST (add items), PUT * (replace items), or DELETE (delete an item) */ request_details: ConditionSetItemIntentRequestDetails; /** * Result of condition set item execution (only present if status is 'executed' or * 'failed') */ action_result?: BaseActionResult; /** * A condition set for grouping related condition values. */ condition_set?: PoliciesAPI.ConditionSet; /** * A single item in a condition set. */ current_resource_data?: PoliciesAPI.ConditionSetItem; } /** * Request details for replacing the items of a condition set via intent. */ export interface ConditionSetItemIntentUpdateRequestDetails { /** * Array of values to add to the condition set. Maximum 100 items per request. */ body: PoliciesAPI.ConditionSetItemsRequestBody; method: 'PUT'; url: string; } /** * Response for an intent that adds or replaces condition set items */ export interface ConditionSetItemMutateIntentResponse extends BaseIntentResponse { intent_type: 'CONDITION_SET_ITEM'; /** * The original condition set item request. Method is POST (add items), PUT * (replace items), or DELETE (delete an item) */ request_details: ConditionSetItemIntentRequestDetails; /** * Result of condition set item execution (only present if status is 'executed' or * 'failed') */ action_result?: BaseActionResult; /** * A condition set for grouping related condition values. */ condition_set?: PoliciesAPI.ConditionSet; /** * A single item in a condition set. */ current_resource_data?: PoliciesAPI.ConditionSetItem; } /** * Authorization quorum for an intent */ export interface IntentAuthorization { /** * Members in this authorization quorum */ members: Array; /** * Number of signatures required to satisfy this quorum */ threshold: number; /** * Display name of the key quorum */ display_name?: string; } /** * A key member of an intent authorization quorum. */ export interface IntentAuthorizationKeyMember { /** * Public key of the key quorum member */ public_key: string; /** * Unix timestamp when this member signed, or null if not yet signed. */ signed_at: number | null; type: 'key'; } /** * A nested key quorum member of an intent authorization quorum. */ export interface IntentAuthorizationKeyQuorum { /** * ID of the child key quorum member */ key_quorum_id: string; /** * Members of this child quorum */ members: Array; /** * Number of signatures required from this child quorum */ threshold: number; /** * Whether this child key quorum has met its signature threshold */ threshold_met: boolean; type: 'key_quorum'; /** * Display name for the child key quorum (if any) */ display_name?: string; } /** * A leaf member (user or key) of a nested key quorum in an intent authorization. */ export type IntentAuthorizationKeyQuorumMember = IntentAuthorizationUserMember | IntentAuthorizationKeyMember; /** * A member of an intent authorization quorum. Can be a user, key, or nested key * quorum. */ export type IntentAuthorizationMember = | IntentAuthorizationUserMember | IntentAuthorizationKeyMember | IntentAuthorizationKeyQuorum; /** * A user member of an intent authorization quorum. */ export interface IntentAuthorizationUserMember { /** * Unix timestamp when this member signed, or null if not yet signed. */ signed_at: number | null; type: 'user'; /** * User ID of the key quorum member */ user_id: string; } /** * Request body for authorizing an intent. */ export interface IntentAuthorizeInput { /** * Signature authorizing the intent. */ signature: string; /** * Unix timestamp (in milliseconds) when the signature was created. Used to verify * the signature was created when the signing key was valid. */ timestamp: number; } /** * Headers required to create an intent. */ export interface IntentCreationHeaders { /** * ID of your Privy app. */ 'privy-app-id': string; /** * Request expiry. Value is a Unix timestamp in milliseconds representing the * deadline by which the request must be processed. */ 'privy-request-expiry'?: string; } /** * Response for an intent object */ export type IntentResponse = | RpcIntentResponse | TransferIntentResponse | RawSignIntentResponse | WalletIntentResponse | PolicyIntentResponse | RuleIntentResponse | KeyQuorumIntentResponse | ConditionSetIntentResponse | ConditionSetItemIntentResponse; /** * Current status of an intent. */ export type IntentStatus = | 'pending' | 'processing' | 'executed' | 'failed' | 'expired' | 'rejected' | 'dismissed'; /** * Type of intent. */ export type IntentType = | 'CONDITION_SET' | 'CONDITION_SET_ITEM' | 'KEY_QUORUM' | 'POLICY' | 'RAW_SIGN' | 'RULE' | 'RPC' | 'TRANSFER' | 'WALLET' | (string & {}); /** * Response for a key quorum delete intent */ export interface KeyQuorumDeleteIntentResponse extends BaseIntentResponse { intent_type: 'KEY_QUORUM'; /** * Request details for deleting a key quorum via intent. */ request_details: KeyQuorumIntentDeleteRequestDetails; /** * Result of key quorum delete execution (only present if status is 'executed' or * 'failed') */ action_result?: BaseActionResult; /** * A key quorum for authorizing wallet operations. */ current_resource_data?: KeyQuorumsAPI.KeyQuorum; } /** * Empty request body for a key quorum delete intent. */ export interface KeyQuorumIntentDeleteRequestBody {} /** * Request details for deleting a key quorum via intent. */ export interface KeyQuorumIntentDeleteRequestDetails { method: 'DELETE'; url: string; /** * Empty request body for a key quorum delete intent. */ body?: KeyQuorumIntentDeleteRequestBody; } /** * Request details for a key quorum intent. */ export interface KeyQuorumIntentRequestDetails { /** * Request input for updating an existing key quorum. At least one field must be * provided. */ body: KeyQuorumsAPI.KeyQuorumUpdateRequestBody; method: 'PATCH'; url: string; } /** * The original key quorum request. Method is PATCH (update) or DELETE (delete). */ export type KeyQuorumIntentRequestDetailsUnion = | KeyQuorumIntentRequestDetails | KeyQuorumIntentDeleteRequestDetails; /** * Response for a key quorum intent */ export interface KeyQuorumIntentResponse extends BaseIntentResponse { intent_type: 'KEY_QUORUM'; /** * The original key quorum request. Method is PATCH (update) or DELETE (delete). */ request_details: KeyQuorumIntentRequestDetailsUnion; /** * Result of key quorum execution (only present if status is 'executed' or * 'failed') */ action_result?: BaseActionResult; /** * A key quorum for authorizing wallet operations. */ current_resource_data?: KeyQuorumsAPI.KeyQuorum; } /** * Response for a key quorum update intent */ export interface KeyQuorumUpdateIntentResponse extends BaseIntentResponse { intent_type: 'KEY_QUORUM'; /** * Request details for a key quorum intent. */ request_details: KeyQuorumIntentRequestDetails; /** * Result of key quorum update execution (only present if status is 'executed' or * 'failed') */ action_result?: BaseActionResult; /** * A key quorum for authorizing wallet operations. */ current_resource_data?: KeyQuorumsAPI.KeyQuorum; } /** * Response for a policy delete intent */ export interface PolicyDeleteIntentResponse extends BaseIntentResponse { intent_type: 'POLICY'; /** * Request details for deleting a policy via intent. */ request_details: PolicyIntentDeleteRequestDetails; /** * Result of policy delete execution (only present if status is 'executed' or * 'failed') */ action_result?: BaseActionResult; /** * A policy for controlling wallet operations. */ current_resource_data?: PoliciesAPI.Policy; } /** * Empty request body for a policy delete intent. */ export interface PolicyIntentDeleteRequestBody {} /** * Request details for deleting a policy via intent. */ export interface PolicyIntentDeleteRequestDetails { method: 'DELETE'; url: string; /** * Empty request body for a policy delete intent. */ body?: PolicyIntentDeleteRequestBody; } /** * Request details for a policy intent. */ export interface PolicyIntentRequestDetails { body: PolicyIntentRequestDetails.Body; method: 'PATCH'; url: string; } export namespace PolicyIntentRequestDetails { export interface Body { /** * Name to assign to the policy, up to 100 characters. */ name?: string; /** * The owner of the resource, specified as a Privy user ID, a P-256 public key, or * null to remove the current owner. */ owner?: SharedAPI.OwnerInput | null; /** * The key quorum ID to set as the owner of the resource. If you provide this, do * not specify an owner. */ owner_id?: SharedAPI.OwnerIDInput | null; rules?: Array; } } /** * The original policy request. Method is PATCH (update) or DELETE (delete). */ export type PolicyIntentRequestDetailsUnion = PolicyIntentRequestDetails | PolicyIntentDeleteRequestDetails; /** * Response for a policy intent */ export interface PolicyIntentResponse extends BaseIntentResponse { intent_type: 'POLICY'; /** * The original policy request. Method is PATCH (update) or DELETE (delete). */ request_details: PolicyIntentRequestDetailsUnion; /** * Result of policy execution (only present if status is 'executed' or 'failed') */ action_result?: BaseActionResult; /** * A policy for controlling wallet operations. */ current_resource_data?: PoliciesAPI.Policy; } /** * Response for a policy update intent */ export interface PolicyUpdateIntentResponse extends BaseIntentResponse { intent_type: 'POLICY'; /** * Request details for a policy intent. */ request_details: PolicyIntentRequestDetails; /** * Result of policy update execution (only present if status is 'executed' or * 'failed') */ action_result?: BaseActionResult; /** * A policy for controlling wallet operations. */ current_resource_data?: PoliciesAPI.Policy; } /** * Request details for a raw sign intent. */ export interface RawSignIntentRequestDetails { /** * Provide either `hash` (to sign a pre-computed hash) OR `bytes`, `encoding`, and * `hash_function` (to hash and then sign). These options are mutually exclusive. */ body: WalletsAPI.RawSignInput; method: 'POST'; url: string; } /** * Response for a raw sign intent */ export interface RawSignIntentResponse extends BaseIntentResponse { intent_type: 'RAW_SIGN'; /** * The original raw sign request that would be sent to the wallet endpoint */ request_details: RawSignIntentResponse.RequestDetails; /** * Result of raw sign execution (only present if status is 'executed' or 'failed') */ action_result?: BaseActionResult; /** * A wallet managed by Privy's wallet infrastructure. */ current_resource_data?: WalletsAPI.Wallet; } export namespace RawSignIntentResponse { /** * The original raw sign request that would be sent to the wallet endpoint */ export interface RequestDetails { /** * Provide either `hash` (to sign a pre-computed hash) OR `bytes`, `encoding`, and * `hash_function` (to hash and then sign). These options are mutually exclusive. */ body: WalletsAPI.RawSignInput; method: 'POST'; url: string; } } /** * Request details for an RPC intent. */ export interface RpcIntentRequestDetails { /** * Request body for wallet RPC operations, discriminated by method. */ body: WalletsAPI.WalletRpcRequestBody; method: 'POST'; url: string; } /** * Response for an RPC intent */ export interface RpcIntentResponse extends BaseIntentResponse { intent_type: 'RPC'; /** * The original RPC request that would be sent to the wallet endpoint */ request_details: RpcIntentResponse.RequestDetails; /** * Result of RPC execution (only present if status is 'executed' or 'failed') */ action_result?: BaseActionResult; /** * A wallet managed by Privy's wallet infrastructure. */ current_resource_data?: WalletsAPI.Wallet; } export namespace RpcIntentResponse { /** * The original RPC request that would be sent to the wallet endpoint */ export interface RequestDetails { /** * Request body for wallet RPC operations, discriminated by method. */ body: WalletsAPI.WalletRpcRequestBody; method: 'POST'; url: string; } } /** * Response for a delete rule intent */ export interface RuleDeleteIntentResponse extends BaseIntentResponse { intent_type: 'RULE'; /** * Request details for deleting a rule via intent. */ request_details: RuleIntentDeleteRequestDetails; /** * Result of rule execution (only present if status is 'executed' or 'failed') */ action_result?: BaseActionResult; /** * A rule that defines the conditions and action to take if the conditions are * true. */ current_resource_data?: PoliciesAPI.PolicyRuleResponse; /** * A policy for controlling wallet operations. */ policy?: PoliciesAPI.Policy; } /** * Request details for creating a rule via intent. */ export interface RuleIntentCreateRequestDetails { /** * The rules that apply to each method the policy covers. */ body: PoliciesAPI.PolicyRuleRequestBody; method: 'POST'; url: string; } /** * Empty request body for a rule delete intent. */ export interface RuleIntentDeleteRequestBody {} /** * Request details for deleting a rule via intent. */ export interface RuleIntentDeleteRequestDetails { method: 'DELETE'; url: string; /** * Empty request body for a rule delete intent. */ body?: RuleIntentDeleteRequestBody; } /** * The original rule request. Method is POST (create), PATCH (update), or DELETE * (delete) */ export type RuleIntentRequestDetails = | RuleIntentCreateRequestDetails | RuleIntentUpdateRequestDetails | RuleIntentDeleteRequestDetails; /** * Response for a rule intent */ export interface RuleIntentResponse extends BaseIntentResponse { intent_type: 'RULE'; /** * The original rule request. Method is POST (create), PATCH (update), or DELETE * (delete) */ request_details: RuleIntentRequestDetails; /** * Result of rule execution (only present if status is 'executed' or 'failed') */ action_result?: BaseActionResult; /** * A rule that defines the conditions and action to take if the conditions are * true. */ current_resource_data?: PoliciesAPI.PolicyRuleResponse; /** * A policy for controlling wallet operations. */ policy?: PoliciesAPI.Policy; } /** * Request details for updating a rule via intent. */ export interface RuleIntentUpdateRequestDetails { /** * The rules that apply to each method the policy covers. */ body: PoliciesAPI.PolicyRuleRequestBody; method: 'PATCH'; url: string; } /** * Response for a create or update rule intent */ export interface RuleMutateIntentResponse extends BaseIntentResponse { intent_type: 'RULE'; /** * The original rule request. Method is POST (create), PATCH (update), or DELETE * (delete) */ request_details: RuleIntentRequestDetails; /** * Result of rule execution (only present if status is 'executed' or 'failed') */ action_result?: BaseActionResult; /** * A rule that defines the conditions and action to take if the conditions are * true. */ current_resource_data?: PoliciesAPI.PolicyRuleResponse; /** * A policy for controlling wallet operations. */ policy?: PoliciesAPI.Policy; } /** * Request details for a transfer intent. */ export interface TransferIntentRequestDetails { /** * Request body for initiating a sponsored token transfer from an embedded wallet. */ body: WalletsAPI.TransferRequestBody; method: 'POST'; url: string; } /** * Response for a transfer intent */ export interface TransferIntentResponse extends BaseIntentResponse { intent_type: 'TRANSFER'; /** * The original transfer request that would be sent to the wallet transfer endpoint */ request_details: TransferIntentResponse.RequestDetails; /** * Result of transfer execution (only present if intent status is 'executed' or * 'failed') */ action_result?: BaseActionResult; /** * A wallet managed by Privy's wallet infrastructure. */ current_resource_data?: WalletsAPI.Wallet; } export namespace TransferIntentResponse { /** * The original transfer request that would be sent to the wallet transfer endpoint */ export interface RequestDetails { /** * Request body for initiating a sponsored token transfer from an embedded wallet. */ body: WalletsAPI.TransferRequestBody; method: 'POST'; url: string; } } /** * Response for a wallet intent */ export interface WalletIntentResponse extends BaseIntentResponse { intent_type: 'WALLET'; /** * The original wallet update request that would be sent to the wallet endpoint */ request_details: WalletIntentResponse.RequestDetails; /** * Result of wallet update execution (only present if status is 'executed' or * 'failed') */ action_result?: BaseActionResult; /** * A wallet managed by Privy's wallet infrastructure. */ current_resource_data?: WalletsAPI.Wallet; } export namespace WalletIntentResponse { /** * The original wallet update request that would be sent to the wallet endpoint */ export interface RequestDetails { /** * Request body for updating a wallet. `owner` and `owner_id` are mutually * exclusive. */ body: WalletsAPI.WalletUpdateRequestBody; method: 'PATCH'; url: string; } } export declare namespace Intents { export { type BaseActionResult as BaseActionResult, type BaseIntentResponse as BaseIntentResponse, type ConditionSetDeleteIntentResponse as ConditionSetDeleteIntentResponse, type ConditionSetIntentDeleteRequestBody as ConditionSetIntentDeleteRequestBody, type ConditionSetIntentDeleteRequestDetails as ConditionSetIntentDeleteRequestDetails, type ConditionSetIntentResponse as ConditionSetIntentResponse, type ConditionSetItemDeleteIntentResponse as ConditionSetItemDeleteIntentResponse, type ConditionSetItemIntentCreateRequestDetails as ConditionSetItemIntentCreateRequestDetails, type ConditionSetItemIntentDeleteRequestBody as ConditionSetItemIntentDeleteRequestBody, type ConditionSetItemIntentDeleteRequestDetails as ConditionSetItemIntentDeleteRequestDetails, type ConditionSetItemIntentRequestDetails as ConditionSetItemIntentRequestDetails, type ConditionSetItemIntentResponse as ConditionSetItemIntentResponse, type ConditionSetItemIntentUpdateRequestDetails as ConditionSetItemIntentUpdateRequestDetails, type ConditionSetItemMutateIntentResponse as ConditionSetItemMutateIntentResponse, type IntentAuthorization as IntentAuthorization, type IntentAuthorizationKeyMember as IntentAuthorizationKeyMember, type IntentAuthorizationKeyQuorum as IntentAuthorizationKeyQuorum, type IntentAuthorizationKeyQuorumMember as IntentAuthorizationKeyQuorumMember, type IntentAuthorizationMember as IntentAuthorizationMember, type IntentAuthorizationUserMember as IntentAuthorizationUserMember, type IntentAuthorizeInput as IntentAuthorizeInput, type IntentCreationHeaders as IntentCreationHeaders, type IntentResponse as IntentResponse, type IntentStatus as IntentStatus, type IntentType as IntentType, type KeyQuorumDeleteIntentResponse as KeyQuorumDeleteIntentResponse, type KeyQuorumIntentDeleteRequestBody as KeyQuorumIntentDeleteRequestBody, type KeyQuorumIntentDeleteRequestDetails as KeyQuorumIntentDeleteRequestDetails, type KeyQuorumIntentRequestDetails as KeyQuorumIntentRequestDetails, type KeyQuorumIntentRequestDetailsUnion as KeyQuorumIntentRequestDetailsUnion, type KeyQuorumIntentResponse as KeyQuorumIntentResponse, type KeyQuorumUpdateIntentResponse as KeyQuorumUpdateIntentResponse, type PolicyDeleteIntentResponse as PolicyDeleteIntentResponse, type PolicyIntentDeleteRequestBody as PolicyIntentDeleteRequestBody, type PolicyIntentDeleteRequestDetails as PolicyIntentDeleteRequestDetails, type PolicyIntentRequestDetails as PolicyIntentRequestDetails, type PolicyIntentRequestDetailsUnion as PolicyIntentRequestDetailsUnion, type PolicyIntentResponse as PolicyIntentResponse, type PolicyUpdateIntentResponse as PolicyUpdateIntentResponse, type RawSignIntentRequestDetails as RawSignIntentRequestDetails, type RawSignIntentResponse as RawSignIntentResponse, type RpcIntentRequestDetails as RpcIntentRequestDetails, type RpcIntentResponse as RpcIntentResponse, type RuleDeleteIntentResponse as RuleDeleteIntentResponse, type RuleIntentCreateRequestDetails as RuleIntentCreateRequestDetails, type RuleIntentDeleteRequestBody as RuleIntentDeleteRequestBody, type RuleIntentDeleteRequestDetails as RuleIntentDeleteRequestDetails, type RuleIntentRequestDetails as RuleIntentRequestDetails, type RuleIntentResponse as RuleIntentResponse, type RuleIntentUpdateRequestDetails as RuleIntentUpdateRequestDetails, type RuleMutateIntentResponse as RuleMutateIntentResponse, type TransferIntentRequestDetails as TransferIntentRequestDetails, type TransferIntentResponse as TransferIntentResponse, type WalletIntentResponse as WalletIntentResponse, }; }