export function generate = API.Service>({ name, access, agent }: { name: string; access?: API.SpaceAccessType | undefined; agent?: API.Agent | undefined; }): Promise>; export function fromMnemonic(mnemonic: string, { name, access, agent }: { name: string; access?: API.SpaceAccessType | undefined; agent?: API.Agent | undefined; }): Promise>; export function toMnemonic({ signer }: { signer: ED25519.EdSigner; }): string; export function createRecovery = API.Service>(space: Model, account: API.AccountDID): Promise>; export const SESSION_LIFETIME: number; export function createAuthorization = API.Service>({ signer, name, access }: Model, { audience, access: spaceAccess, expiration, }: { audience: API.Principal; access?: API.Access | undefined; expiration?: number | undefined; }): Promise>; /** * Represents an owned space, meaning a space for which we have a private key * and consequently have full authority over. * * @template {Record} [S=API.Service] */ export class OwnedSpace = API.Service> { /** * @param {Model} model */ constructor(model: Model); model: Model; get signer(): ED25519.EdSigner; get name(): string; get access(): API.PublicAccess | API.PrivateAccess; did(): `did:key:${string}`; /** * Creates a renamed version of this space. * * @param {string} name */ withName(name: string): API.OwnedSpace; /** * Saves account in the agent store so it can be accessed across sessions. * * @param {object} input * @param {API.Agent} [input.agent] * @returns {Promise>} */ save({ agent }?: { agent?: API.Agent | undefined; }): Promise>; /** * @param {Authorization} authorization * @param {object} options * @param {API.Agent} [options.agent] */ provision({ proofs }: Authorization, { agent }?: { agent?: API.Agent | undefined; }): Promise> | { error: ED25519.Failure; ok?: undefined; }; /** * Creates a (UCAN) delegation that gives full access to the space to the * specified `account`. At the moment we only allow `did:mailto` principal * to be used as an `account`. * * @param {API.AccountDID} account */ createRecovery(account: API.AccountDID): Promise>; /** * Creates (UCAN) delegation that gives specified `agent` an access to * specified ability (passed as `access.can` field) on the this space. * Optionally, you can specify `access.expiration` field to set the * * @param {API.Principal} principal * @param {object} [input] * @param {API.Access} [input.access] * @param {API.UCAN.UTCUnixTimestamp} [input.expiration] */ createAuthorization(principal: API.Principal, input?: { access?: API.Access | undefined; expiration?: number | undefined; }): Promise>; /** * Derives BIP39 mnemonic that can be used to recover the space. * * @returns {string} */ toMnemonic(): string; } export function fromDelegation(delegation: API.Delegation): API.SharedSpace; export function provision = API.Service>(space: Space, { proofs, agent }: { proofs: API.Delegation[]; agent: API.Agent; }): Promise>; /** * Represents a shared space, meaning a space for which we have a delegation * and consequently have limited authority over. */ export class SharedSpace { /** * @typedef {object} SharedSpaceModel * @property {API.SpaceDID} id * @property {API.Delegation} delegation * @property {{name?:string, access?:API.SpaceAccessType}} meta * @property {API.Agent} [agent] * * @param {SharedSpaceModel} model */ constructor(model: { id: API.SpaceDID; delegation: API.Delegation; meta: { name?: string; access?: API.SpaceAccessType; }; agent?: API.Agent | undefined; }); model: { id: API.SpaceDID; delegation: API.Delegation; meta: { name?: string; access?: API.SpaceAccessType; }; agent?: API.Agent | undefined; }; get delegation(): ED25519.Delegation; get meta(): { name?: string; access?: API.SpaceAccessType; }; get name(): string; get access(): API.PublicAccess | API.PrivateAccess; did(): `did:key:${string}`; /** * @param {string} name */ withName(name: string): API.SharedSpace; } /** * Data model for the (owned) space. */ export type Model = API.Service> = { signer: ED25519.EdSigner; name: string; access?: API.SpaceAccessType; agent?: API.Agent; }; export type Authorization = { proofs: API.Delegation[]; }; export type Space = { did: () => API.SpaceDID; }; import * as API from './types.js'; import * as ED25519 from '@ucanto/principal/ed25519'; //# sourceMappingURL=space.d.ts.map