@lit-protocol/types
Advanced tools
Comparing version 2.1.115 to 2.1.116
{ | ||
"name": "@lit-protocol/types", | ||
"version": "2.1.115", | ||
"version": "2.1.116", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
export * from './lib/types'; | ||
export * from './lib/interfaces'; | ||
export * from './lib/ILitNodeClient'; | ||
export { NodeErrorV0 } from './lib/interfaces'; |
@@ -286,3 +286,3 @@ import { SupportedJsonRequests } from './types'; | ||
*/ | ||
saveEncryptionKey(params: JsonSaveEncryptionKeyRequest): Promise<Uint8Array>; | ||
saveEncryptionKey(params: JsonSaveEncryptionKeyRequest): Promise<Uint8Array | undefined>; | ||
/** | ||
@@ -289,0 +289,0 @@ * |
/** ---------- Access Control Conditions Interfaces ---------- */ | ||
import { AcceptedFileType, AccessControlConditions, Chain, ConditionType, EncryptedSymmetricKey, EvmContractConditions, IRelayAuthStatus, JsonRequest, LIT_NETWORKS_KEYS, SolRpcConditions, SymmetricKey, UnifiedAccessControlConditions } from './types'; | ||
import { AcceptedFileType, AccessControlConditions, Chain, ConditionType, EncryptedSymmetricKey, EvmContractConditions, JsonRequest, LIT_NETWORKS_KEYS, SolRpcConditions, SymmetricKey, UnifiedAccessControlConditions } from './types'; | ||
import { ILitNodeClient } from './ILitNodeClient'; | ||
import { AuthMethodType } from './enums'; | ||
export interface AccsOperatorParams { | ||
@@ -55,16 +54,16 @@ operator: string; | ||
/** ---------- Auth Sig ---------- */ | ||
export interface JsonAuthSig { | ||
sig: string; | ||
export interface AuthSig { | ||
sig: any; | ||
derivedVia: string; | ||
signedMessage: string; | ||
address: string; | ||
capabilities?: []; | ||
algo?: []; | ||
} | ||
export interface CheckAndSignAuthParams { | ||
export declare type CosmosWalletType = 'keplr' | 'leap'; | ||
export interface AuthCallbackParams { | ||
chain: Chain; | ||
resources?: any[]; | ||
switchChain?: boolean; | ||
expiration?: any; | ||
expiration?: string; | ||
uri?: string; | ||
cosmosWalletType?: CosmosWalletType; | ||
} | ||
@@ -132,3 +131,3 @@ /** ---------- Web3 ---------- */ | ||
connectTimeout: number; | ||
defaultAuthCallback?: (authSigParams: CheckAndSignAuthParams) => Promise<JsonAuthSig>; | ||
defaultAuthCallback?: (authSigParams: AuthCallbackParams) => Promise<AuthSig>; | ||
} | ||
@@ -149,3 +148,3 @@ export interface CustomNetwork { | ||
export interface JsonExecutionRequest { | ||
authSig: JsonAuthSig; | ||
authSig: AuthSig; | ||
jsParams: any; | ||
@@ -199,3 +198,3 @@ code?: string; | ||
resourceId?: JsonSigningResourceId; | ||
authSig?: JsonAuthSig; | ||
authSig?: AuthSig; | ||
sessionSigs?: object; | ||
@@ -245,3 +244,3 @@ } | ||
permanent?: number; | ||
authSig?: JsonAuthSig; | ||
authSig?: AuthSig; | ||
sessionSigs?: object; | ||
@@ -273,3 +272,3 @@ } | ||
unifiedAccessControlConditions?: UnifiedAccessControlConditions; | ||
authSig?: JsonAuthSig; | ||
authSig?: AuthSig; | ||
chain: Chain; | ||
@@ -286,3 +285,3 @@ symmetricKey: SymmetricKey; | ||
solRpcConditions: undefined; | ||
auth_sig: JsonAuthSig; | ||
auth_sig: AuthSig; | ||
chain: Chain; | ||
@@ -427,3 +426,3 @@ iat: number; | ||
chain: Chain; | ||
auth_sig: JsonAuthSig; | ||
auth_sig: AuthSig; | ||
} | ||
@@ -440,3 +439,3 @@ export interface HandshakeWithSgx { | ||
export interface EncryptToIpfsProps { | ||
authSig?: JsonAuthSig; | ||
authSig?: AuthSig; | ||
sessionSigs?: any; | ||
@@ -455,3 +454,3 @@ accessControlConditions?: AccessControlConditions; | ||
export interface DecryptFromIpfsProps { | ||
authSig?: JsonAuthSig; | ||
authSig?: AuthSig; | ||
sessionSigs?: any; | ||
@@ -462,3 +461,3 @@ ipfsCid: string; | ||
export interface EncryptFileAndZipWithMetadataProps { | ||
authSig?: JsonAuthSig; | ||
authSig?: AuthSig; | ||
sessionSigs?: any; | ||
@@ -475,3 +474,3 @@ accessControlConditions?: AccessControlConditions; | ||
export interface DecryptZipFileWithMetadataProps { | ||
authSig?: JsonAuthSig; | ||
authSig?: AuthSig; | ||
sessionSigs?: any; | ||
@@ -516,3 +515,3 @@ file: File | Blob; | ||
export interface AuthMethod { | ||
authMethodType: AuthMethodType; | ||
authMethodType: number; | ||
accessToken: string; | ||
@@ -524,3 +523,3 @@ } | ||
pkpPublicKey?: string; | ||
authSig?: JsonAuthSig; | ||
authSig?: AuthSig; | ||
expiration: string; | ||
@@ -533,3 +532,3 @@ resources: any; | ||
pkpPublicKey: string; | ||
authSig: JsonAuthSig; | ||
authSig: AuthSig; | ||
} | ||
@@ -545,5 +544,15 @@ export interface GetSignSessionKeySharesProp { | ||
switchChain?: any; | ||
authNeededCallback?: any; | ||
authNeededCallback?: AuthCallback; | ||
sessionKey?: any; | ||
} | ||
export interface AuthCallback { | ||
(params: AuthCallbackParams): Promise<AuthSig>; | ||
} | ||
export interface SessionSig { | ||
sig: string; | ||
derivedVia: string; | ||
signedMessage: string; | ||
address: string; | ||
algo?: string; | ||
} | ||
export interface SessionRequestBody { | ||
@@ -553,8 +562,12 @@ sessionKey: string; | ||
pkpPublicKey?: string; | ||
authSig?: JsonAuthSig; | ||
authSig?: AuthSig; | ||
siweMessage: string; | ||
} | ||
export interface WalletSig { | ||
signedMessage: string; | ||
sig: any; | ||
export interface GetWalletSigProps { | ||
authNeededCallback?: AuthCallback; | ||
chain: string; | ||
capabilities: Array<any>; | ||
switchChain: boolean; | ||
expiration: string; | ||
sessionKeyUri: string; | ||
} | ||
@@ -582,276 +595,1 @@ export interface SessionSigningTemplate { | ||
export declare type AuthenticatorAttachment = 'cross-platform' | 'platform'; | ||
/** | ||
* ========== PKP ========== | ||
*/ | ||
export interface PKPBaseProp { | ||
pkpPubKey: string; | ||
rpc?: string; | ||
rpcs?: RPCUrls; | ||
controllerAuthSig?: JsonAuthSig; | ||
controllerSessionSigs?: SessionSigs; | ||
sessionSigsExpiration?: string; | ||
litNetwork?: any; | ||
debug?: boolean; | ||
litActionCode?: string; | ||
litActionIPFS?: string; | ||
litActionJsParams?: any; | ||
} | ||
export interface RPCUrls { | ||
eth?: string; | ||
cosmos?: string; | ||
btc?: string; | ||
} | ||
export interface PKPEthersWalletProp extends PKPBaseProp { | ||
} | ||
export interface PKPCosmosWalletProp extends PKPBaseProp { | ||
addressPrefix: string | 'cosmos'; | ||
} | ||
export interface PKPClientProp extends PKPBaseProp { | ||
cosmosAddressPrefix?: string | 'cosmos'; | ||
} | ||
export interface PKPBaseDefaultParams { | ||
toSign: Uint8Array; | ||
publicKey: Uint8Array; | ||
sigName: string; | ||
} | ||
export interface PKPClientHelpers { | ||
handleRequest: (request: any) => Promise<any>; | ||
setRpc: (rpc: string) => void; | ||
getRpc: () => string; | ||
} | ||
export interface SessionSigs { | ||
/** | ||
* Map of Lit node urls to session signatures | ||
*/ | ||
[key: string]: SessionSig; | ||
} | ||
export interface SessionSig { | ||
sig: string; | ||
derivedVia: string; | ||
signedMessage: string; | ||
address: string; | ||
algo: string; | ||
} | ||
/** | ||
* ========== LitAuthClient ========== | ||
*/ | ||
export interface LitAuthClientOptions { | ||
/** | ||
* Domain of the app using LitAuthClient | ||
*/ | ||
domain: string; | ||
/** | ||
* The redirect URI that Lit's login server should send the user back to | ||
*/ | ||
redirectUri: string; | ||
/** | ||
* API key for Lit's relay server | ||
*/ | ||
litRelayApiKey?: string; | ||
/** | ||
* Pass in a custom relay server | ||
*/ | ||
customRelay?: IRelay; | ||
} | ||
export interface SignInWithEthWalletParams { | ||
/** | ||
* Ethereum wallet address | ||
*/ | ||
address: string; | ||
/** | ||
* Function to sign message | ||
* | ||
* @param {string} message - Message to sign | ||
* | ||
* @returns {Promise<string>} - Raw signature of message | ||
*/ | ||
signMessage: (message: string) => Promise<string>; | ||
/** | ||
* Origin of signing request | ||
*/ | ||
origin?: string; | ||
/** | ||
* Name of chain to use for signature | ||
*/ | ||
chain?: string; | ||
/** | ||
* When the auth signature expires | ||
*/ | ||
expiration?: string; | ||
} | ||
export interface LoginUrlParams { | ||
/** | ||
* Auth method name | ||
*/ | ||
provider: string | null; | ||
/** | ||
* Access token | ||
*/ | ||
accessToken: string | null; | ||
/** | ||
* ID token | ||
*/ | ||
idToken: string | null; | ||
/** | ||
* OAuth state param | ||
*/ | ||
state: string | null; | ||
/** | ||
* Error codes from Lit's login server | ||
*/ | ||
error: string | null; | ||
} | ||
export interface IRelay { | ||
/** | ||
* Mint a new PKP for the given auth method | ||
* | ||
* @param {number} authMethodType - Auth method type | ||
* @param {string} body - Body of the request | ||
* | ||
* @returns {Promise<IRelayMintResponse>} Response from the relay server | ||
*/ | ||
mintPKP(authMethodType: number, body: string): Promise<IRelayMintResponse>; | ||
/** | ||
* Poll the relay server for status of minting request | ||
* | ||
* @param {string} requestId - Request ID to poll, likely the minting transaction hash | ||
* | ||
* @returns {Promise<IRelayPollStatusResponse>} Response from the relay server | ||
*/ | ||
pollRequestUntilTerminalState(requestId: string): Promise<IRelayPollStatusResponse>; | ||
/** | ||
* Fetch PKPs associated with the given auth method | ||
* | ||
* @param {number} authMethodType - Auth method type | ||
* @param {string} body - Body of the request | ||
* | ||
* @returns {Promise<IRelayFetchResponse>} Response from the relay server | ||
*/ | ||
fetchPKPs(authMethodType: number, body: string): Promise<IRelayFetchResponse>; | ||
} | ||
export interface LitRelayConfig { | ||
/** | ||
* API key for Lit's relay server | ||
*/ | ||
relayApiKey: string; | ||
} | ||
export interface IRelayMintResponse { | ||
/** | ||
* Transaction hash of PKP being minted | ||
*/ | ||
requestId?: string; | ||
/** | ||
* Error from relay server | ||
*/ | ||
error?: string; | ||
} | ||
export interface IRelayFetchResponse { | ||
/** | ||
* Fetched PKPs | ||
*/ | ||
pkps?: IRelayPKP[]; | ||
/** | ||
* Error from relay server | ||
*/ | ||
error?: string; | ||
} | ||
export interface IRelayPollingEvent { | ||
/** | ||
* Polling count | ||
*/ | ||
pollCount: number; | ||
/** | ||
* Transaction hash of PKP being minted | ||
*/ | ||
requestId: string; | ||
} | ||
export interface IRelayPollStatusResponse { | ||
/** | ||
* Polling status | ||
*/ | ||
status?: IRelayAuthStatus; | ||
/** | ||
* Token ID of PKP being minted | ||
*/ | ||
pkpTokenId?: string; | ||
/** | ||
* Eth address of new PKP | ||
*/ | ||
pkpEthAddress?: string; | ||
/** | ||
* Public key of new PKP | ||
*/ | ||
pkpPublicKey?: string; | ||
/** | ||
* Polling error | ||
*/ | ||
error?: string; | ||
} | ||
export interface IRelayPKP { | ||
/** | ||
* PKP token ID | ||
*/ | ||
tokenId: string; | ||
/** | ||
* PKP public key | ||
*/ | ||
publicKey: string; | ||
/** | ||
* PKP Eth address | ||
*/ | ||
ethAddress: string; | ||
} | ||
export interface SocialAuthNeededCallbackParams { | ||
/** | ||
* Auth methods to use | ||
*/ | ||
authMethods: AuthMethod[]; | ||
/** | ||
* Public key of the PKP to use for signing | ||
*/ | ||
pkpPublicKey: string; | ||
} | ||
export interface EthWalletAuthNeededCallbackParams { | ||
/** | ||
* Domain that is requesting the signing | ||
*/ | ||
domain: string; | ||
/** | ||
* Ethereum address to sign with | ||
*/ | ||
address: string; | ||
/** | ||
* Function to sign message | ||
* | ||
* @param {string} message - Message to sign | ||
* | ||
* @returns {Promise<string>} - Raw signature of message | ||
*/ | ||
signMessage: (message: string) => Promise<string>; | ||
/** | ||
* Copy to show user before signing | ||
*/ | ||
statement?: string; | ||
} | ||
export interface DefaultAuthNeededCallbackParams { | ||
/** | ||
* Chain to use | ||
*/ | ||
chainId: number; | ||
/** | ||
* Resources that will be signed with session key | ||
*/ | ||
resources: string[]; | ||
/** | ||
* Expiration date for when sigs will expire | ||
*/ | ||
expiration: string; | ||
/** | ||
* Session key to sign | ||
*/ | ||
uri: string; | ||
/** | ||
* Client to connect to Lit nodes | ||
*/ | ||
litNodeClient: any; | ||
} |
@@ -59,3 +59,1 @@ import { AccsCOSMOSParams, AccsDefaultParams, AccsEVMParams, AccsOperatorParams, AccsRegularParams, AccsSOLV2Params, JsonEncryptionRetrieveRequest, JsonExecutionRequest, JsonSignChainDataRequest, JsonSigningRetrieveRequest } from './interfaces'; | ||
export declare type AcceptedFileType = File | Blob; | ||
export declare type IRelayAuthStatus = 'InProgress' | 'Succeeded' | 'Failed'; | ||
export declare type SignInWithSocialOpts = 'google' | 'discord'; |
30341
14
969