UNPKG

@lit-protocol/auth-helpers

Version:

Advanced authentication utilities for managing blockchain resource permissions and capabilities within the Lit Protocol ecosystem. Built on top of SIWE (Sign-In with Ethereum) and SIWE-RECAP for robust authentication flows.

60 lines (59 loc) 2.61 kB
import { LIT_ABILITY_VALUES, LIT_RESOURCE_PREFIX_VALUES } from '@lit-protocol/constants'; import { AccessControlConditions, ILitResource } from '@lit-protocol/types'; declare abstract class LitResourceBase { abstract resourcePrefix: LIT_RESOURCE_PREFIX_VALUES; readonly resource: string; constructor(resource: string); getResourceKey(): string; toString(): string; } export declare class LitAccessControlConditionResource extends LitResourceBase implements ILitResource { readonly resourcePrefix: "lit-accesscontrolcondition"; /** * Creates a new LitAccessControlConditionResource. * @param resource The identifier for the resource. This should be the * hashed key value of the access control condition. */ constructor(resource: string); isValidLitAbility(litAbility: LIT_ABILITY_VALUES): boolean; /** * Composes a resource string by hashing access control conditions and appending a data hash. * * @param {AccessControlConditions} accs - The access control conditions to hash. * @param {string} dataToEncryptHash - The hash of the data to encrypt. * @returns {Promise<string>} The composed resource string in the format 'hashedAccs/dataToEncryptHash'. */ static generateResourceString(accs: AccessControlConditions, dataToEncryptHash: string): Promise<string>; } export declare class LitPKPResource extends LitResourceBase implements ILitResource { readonly resourcePrefix: "lit-pkp"; /** * Creates a new LitPKPResource. * @param resource The identifier for the resource. This should be the * PKP token ID. */ constructor(resource: string); isValidLitAbility(litAbility: LIT_ABILITY_VALUES): boolean; } export declare class LitRLIResource extends LitResourceBase implements ILitResource { readonly resourcePrefix: "lit-ratelimitincrease"; /** * Creates a new LitRLIResource. * @param resource The identifier for the resource. This should be the * RLI token ID. */ constructor(resource: string); isValidLitAbility(litAbility: LIT_ABILITY_VALUES): boolean; } export declare class LitActionResource extends LitResourceBase implements ILitResource { readonly resourcePrefix: "lit-litaction"; /** * Creates a new LitActionResource. * @param resource The identifier for the resource. This should be the * Lit Action IPFS CID. */ constructor(resource: string); isValidLitAbility(litAbility: LIT_ABILITY_VALUES): boolean; } export declare function parseLitResource(resourceKey: string): ILitResource; export {};