import type { Capabilities, ConnectionView, Fact, Failure, Phantom, Principal, RequestEncoder, Resource, ResponseDecoder, ServiceMethod, InferInvokedCapability, CapabilityParser, Match, Ability, UnknownMatch, Delegation, DID, Signer, SignerArchive, SigAlg, Caveats, Unit } from '@ucanto/interface'; export type { UTCUnixTimestamp } from '@ipld/dag-ucan'; import type { Abilities, SpaceInfo, AccessAuthorize, AccessAuthorizeSuccess, AccessDelegate, AccessDelegateFailure, AccessDelegateSuccess, AccessClaim, AccessClaimSuccess, AccessClaimFailure, ProviderAdd, ProviderAddSuccess, ProviderAddFailure, AccessConfirm, AccessConfirmSuccess, AccessConfirmFailure, UCANRevoke, UCANRevokeSuccess, UCANRevokeFailure, UCANConclude, UCANConcludeSuccess, UCANConcludeFailure, AccountDID, ProviderDID, SpaceDID, PlanGet, PlanGetSuccess, PlanGetFailure, SubscriptionList, SubscriptionListSuccess, SubscriptionListFailure, PlanSet, PlanSetSuccess, PlanSetFailure, PlanCreateAdminSession, PlanCreateAdminSessionSuccess, PlanCreateAdminSessionFailure, PlanCreateCheckoutSession, PlanCreateCheckoutSessionSuccess, PlanCreateCheckoutSessionFailure } from '@storacha/capabilities/types'; import type { SetRequired } from 'type-fest'; import { Driver } from './drivers/types.js'; import { SpaceUnknown } from './errors.js'; export * from '@ucanto/interface'; export * from '@storacha/capabilities/types'; export * from './errors.js'; export * from '@storacha/did-mailto'; export type { Agent } from './agent.js'; export type { OwnedSpace, SharedSpace } from './space.js'; export interface SpaceInfoResult { did: DID<'key'>; providers: Array>; } export interface CapabilityQuery { can: Ability; with: ResourceQuery; nb?: unknown; } export type { AccountDID, ProviderDID, SpaceDID }; /** * Describes level of access to a resource. */ export type Access = Record, Unit> & { ['*']?: Unit; }; export type ResourceQuery = Resource | RegExp; /** * Access api service definition type */ export interface Service { access: { authorize: ServiceMethod; claim: ServiceMethod; confirm: ServiceMethod; delegate: ServiceMethod; }; provider: { add: ServiceMethod; }; space: { info: ServiceMethod; }; subscription: { list: ServiceMethod; }; ucan: { revoke: ServiceMethod; conclude: ServiceMethod; }; plan: { get: ServiceMethod; set: ServiceMethod; 'create-admin-session': ServiceMethod; 'create-checkout-session': ServiceMethod; }; } /** * Schema types * * Interfaces for data structures used in the client * */ export type CIDString = string; /** * Data schema used internally by the agent. */ export interface AgentDataModel { meta: AgentMeta; principal: Signer>; /** @deprecated */ currentSpace?: DID<'key'>; /** @deprecated */ spaces: Map; delegations: Map; } /** * Agent data that is safe to pass to structuredClone() and persisted by stores. */ export type AgentDataExport = Pick & { principal: SignerArchive; delegations: Map; }>; }; /** * Agent metadata used to describe an agent ("audience") * with a more human and UI friendly data */ export interface AgentMeta { name: string; description?: string; url?: URL; image?: URL; type: 'device' | 'app' | 'service'; } /** * Delegation metadata */ export interface DelegationMeta { /** * Audience metadata to be easier to build UIs with human readable data * Normally used with delegations issued to third parties or other devices. */ audience?: AgentMeta; } /** * Base encryption provider interface */ export interface EncryptionProvider { provider: string; algorithm: string; } /** * Google KMS encryption provider */ export interface GoogleKMSEncryptionProvider extends EncryptionProvider { provider: 'google-kms'; } /** * Public access type for spaces */ export interface PublicAccess { type: 'public'; } /** * Private access type for spaces */ export interface PrivateAccess

{ type: 'private'; encryption: P; } /** * Access type for spaces - determines client-side encryption behavior */ export type SpaceAccessType = PublicAccess | PrivateAccess; /** * Space metadata */ export interface SpaceMeta { /** * Human readable name for the space */ name: string; /** * Access type for the space - determines client-side encryption behavior */ access?: SpaceAccessType; } /** * Agent class types */ export interface AgentOptions> { url?: URL; connection?: ConnectionView; servicePrincipal?: Principal; /** * DIDs the service is known by, including the primary. They are used by * `invoke` and `invokeAndExecute` to scope session proofs to just the service * DID or it's aliases. */ serviceIdentities?: DID[]; } export interface AgentDataOptions { store?: Driver; } export type InvokeOptions>> = UCANBasicOptions & Omit, 'can' | 'with'> & { /** * Resource for the capability, normally a Space DID * Defaults to the current selected Space */ with?: R; /** * Extra proofs to be added to the invocation */ proofs?: Delegation[]; }; export type DelegationOptions = SetRequired & { /** * Abilities to delegate */ abilities: Abilities[]; /** * Metadata about the audience */ audienceMeta: AgentMeta; }; /** * Utility types */ export interface UCANBasicOptions { /** * Audience Principal (DID), * Defaults to "Access service DID" * * @see {@link https://github.com/ucan-wg/spec#321-principals Spec} */ audience?: Principal; /** * UCAN lifetime in seconds */ lifetimeInSeconds?: number; /** * Unix timestamp when the UCAN is no longer valid * * Expiration overrides `lifetimeInSeconds` * * @see {@link https://github.com/ucan-wg/spec#322-time-bounds Spec} */ expiration?: number; /** * Unix timestamp when the UCAN becomas valid * * @see {@link https://github.com/ucan-wg/spec#322-time-bounds Spec} */ notBefore?: number; /** * Nonce, a randomly generated string, used to ensure the uniqueness of the UCAN. * * @see {@link https://github.com/ucan-wg/spec#323-nonce Spec} */ nonce?: string; /** * Facts, an array of extra facts or information to attach to the UCAN * * @see {@link https://github.com/ucan-wg/spec#324-facts Spec} */ facts?: Fact[]; } /** * Given an inferred capability infers if the nb field is optional or not */ export type InferNb | undefined> = keyof C extends never ? { nb?: never; } : { /** * Non-normative fields for the capability * * Check the capability definition for more details on the `nb` field. * * @see {@link https://github.com/ucan-wg/spec#241-nb-non-normative-fields Spec} */ nb: C; }; export interface ClientCodec extends RequestEncoder, ResponseDecoder { } export type EncodedDelegation = string & Phantom; export type BytesDelegation = Uint8Array & Phantom>; export declare enum AppName { BskyBackups = "bsky-backups", TGMiniapp = "tg-miniapp", Console = "console" } /** * SSO auth parameters that are used to trigger the SSO authorization flow. */ export type SSORequestParams = { /** * The SSO auth provider. */ authProvider: string; /** * The external user ID of the user that is requesting access. */ externalUserId: string; /** * The external session token of the user that is requesting access. */ externalSessionToken: string; }; //# sourceMappingURL=types.d.ts.map