export { fromEmail }; export function list({ agent }: { agent: API.Agent; }, { account }?: { account?: `did:mailto:${string}` | undefined; }): Record<`did:mailto:${string}:${string}`, Account>; export function login({ agent }: { agent: API.Agent; }, email: EmailAddress, options?: { signal?: AbortSignal | undefined; } | undefined): Promise>; export function externalLogin({ agent }: { agent: API.Agent; }, { request, expiration, ...options }: { request: API.Link; expiration: API.UTCUnixTimestamp; signal?: AbortSignal | undefined; receiptsEndpoint?: string | undefined; }): Promise>; /** * @typedef {object} Model * @property {API.DidMailto} id * @property {API.Agent} agent * @property {API.Delegation[]} proofs */ export class Account { /** * @param {Model} model */ constructor(model: Model); model: Model; plan: AccountPlan; get agent(): API.Agent; get proofs(): API.Delegation[]; did(): `did:mailto:${string}:${string}`; toEmail(): `${string}@${string}`; /** * @param {API.Delegation} proof */ addProof(proof: API.Delegation): void; toJSON(): { id: `did:mailto:${string}:${string}`; proofs: API.DelegationJSON>[]; }; /** * Provisions given `space` with this account. * * @param {API.SpaceDID} space * @param {object} input * @param {API.ProviderDID} [input.provider] * @param {API.Agent} [input.agent] */ provision(space: API.SpaceDID, input?: { provider?: `did:web:${string}` | undefined; agent?: API.Agent | undefined; }): Promise>; /** * Saves account in the agent store so it can be accessed across sessions. * * @param {object} input * @param {API.Agent} [input.agent] */ save({ agent }?: { agent?: API.Agent | undefined; }): Promise>; } export class AccountPlan { /** * @param {Model} model */ constructor(model: Model); model: Model; /** * Gets information about the plan associated with this account. * * @param {object} [options] * @param {string} [options.nonce] */ get(options?: { nonce?: string | undefined; } | undefined): Promise>; /** * Sets the plan associated with this account. * * @param {import('@ucanto/interface').DID} productDID * @param {object} [options] * @param {string} [options.nonce] */ set(productDID: import('@ucanto/interface').DID, options?: { nonce?: string | undefined; } | undefined): Promise>; /** * Waits for a payment plan to be selected. * This method continuously checks the account's payment plan status * at a specified interval until a valid plan is selected, or when the timeout is reached, * or when the abort signal is aborted. * * @param {object} [options] * @param {number} [options.interval] - The polling interval in milliseconds (default is 1000ms). * @param {number} [options.timeout] - The maximum time to wait in milliseconds before throwing a timeout error (default is 15 minutes). * @param {AbortSignal} [options.signal] - An optional AbortSignal to cancel the waiting process. * @returns {Promise} - Resolves once a payment plan is selected within the timeout. * @throws {Error} - Throws an error if there is an issue retrieving the payment plan or if the timeout is exceeded. */ wait(options?: { interval?: number | undefined; timeout?: number | undefined; signal?: AbortSignal | undefined; } | undefined): Promise; /** * * @param {import('@web3-storage/access').AccountDID} accountDID * @param {string} returnURL * @param {object} [options] * @param {string} [options.nonce] */ createAdminSession(accountDID: import('@web3-storage/access').AccountDID, returnURL: string, options?: { nonce?: string | undefined; } | undefined): Promise>; /** * * @param {object} [options] * @param {string} [options.nonce] */ subscriptions(options?: { nonce?: string | undefined; } | undefined): Promise>; } export type EmailAddress = import('@web3-storage/did-mailto').EmailAddress; export type Model = { id: API.DidMailto; agent: API.Agent; proofs: API.Delegation[]; }; import { fromEmail } from '@web3-storage/did-mailto'; import * as API from './types.js'; import { Delegation } from '@web3-storage/access/agent'; //# sourceMappingURL=account.d.ts.map