@lit-protocol/types
Advanced tools
Comparing version 2.1.114 to 2.1.115
{ | ||
"name": "@lit-protocol/types", | ||
"version": "2.1.114", | ||
"version": "2.1.115", | ||
"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 | undefined>; | ||
saveEncryptionKey(params: JsonSaveEncryptionKeyRequest): Promise<Uint8Array>; | ||
/** | ||
@@ -289,0 +289,0 @@ * |
/** ---------- Access Control Conditions Interfaces ---------- */ | ||
import { AcceptedFileType, AccessControlConditions, Chain, ConditionType, EncryptedSymmetricKey, EvmContractConditions, JsonRequest, LIT_NETWORKS_KEYS, SolRpcConditions, SymmetricKey, UnifiedAccessControlConditions } from './types'; | ||
import { AcceptedFileType, AccessControlConditions, Chain, ConditionType, EncryptedSymmetricKey, EvmContractConditions, IRelayAuthStatus, JsonRequest, LIT_NETWORKS_KEYS, SolRpcConditions, SymmetricKey, UnifiedAccessControlConditions } from './types'; | ||
import { ILitNodeClient } from './ILitNodeClient'; | ||
import { AuthMethodType } from './enums'; | ||
export interface AccsOperatorParams { | ||
@@ -54,16 +55,16 @@ operator: string; | ||
/** ---------- Auth Sig ---------- */ | ||
export interface AuthSig { | ||
sig: any; | ||
export interface JsonAuthSig { | ||
sig: string; | ||
derivedVia: string; | ||
signedMessage: string; | ||
address: string; | ||
capabilities?: []; | ||
algo?: []; | ||
} | ||
export declare type CosmosWalletType = 'keplr' | 'leap'; | ||
export interface AuthCallbackParams { | ||
export interface CheckAndSignAuthParams { | ||
chain: Chain; | ||
resources?: any[]; | ||
switchChain?: boolean; | ||
expiration?: string; | ||
expiration?: any; | ||
uri?: string; | ||
cosmosWalletType?: CosmosWalletType; | ||
} | ||
@@ -131,3 +132,3 @@ /** ---------- Web3 ---------- */ | ||
connectTimeout: number; | ||
defaultAuthCallback?: (authSigParams: AuthCallbackParams) => Promise<AuthSig>; | ||
defaultAuthCallback?: (authSigParams: CheckAndSignAuthParams) => Promise<JsonAuthSig>; | ||
} | ||
@@ -148,3 +149,3 @@ export interface CustomNetwork { | ||
export interface JsonExecutionRequest { | ||
authSig: AuthSig; | ||
authSig: JsonAuthSig; | ||
jsParams: any; | ||
@@ -198,3 +199,3 @@ code?: string; | ||
resourceId?: JsonSigningResourceId; | ||
authSig?: AuthSig; | ||
authSig?: JsonAuthSig; | ||
sessionSigs?: object; | ||
@@ -244,3 +245,3 @@ } | ||
permanent?: number; | ||
authSig?: AuthSig; | ||
authSig?: JsonAuthSig; | ||
sessionSigs?: object; | ||
@@ -272,3 +273,3 @@ } | ||
unifiedAccessControlConditions?: UnifiedAccessControlConditions; | ||
authSig?: AuthSig; | ||
authSig?: JsonAuthSig; | ||
chain: Chain; | ||
@@ -285,3 +286,3 @@ symmetricKey: SymmetricKey; | ||
solRpcConditions: undefined; | ||
auth_sig: AuthSig; | ||
auth_sig: JsonAuthSig; | ||
chain: Chain; | ||
@@ -426,3 +427,3 @@ iat: number; | ||
chain: Chain; | ||
auth_sig: AuthSig; | ||
auth_sig: JsonAuthSig; | ||
} | ||
@@ -439,3 +440,3 @@ export interface HandshakeWithSgx { | ||
export interface EncryptToIpfsProps { | ||
authSig?: AuthSig; | ||
authSig?: JsonAuthSig; | ||
sessionSigs?: any; | ||
@@ -454,3 +455,3 @@ accessControlConditions?: AccessControlConditions; | ||
export interface DecryptFromIpfsProps { | ||
authSig?: AuthSig; | ||
authSig?: JsonAuthSig; | ||
sessionSigs?: any; | ||
@@ -461,3 +462,3 @@ ipfsCid: string; | ||
export interface EncryptFileAndZipWithMetadataProps { | ||
authSig?: AuthSig; | ||
authSig?: JsonAuthSig; | ||
sessionSigs?: any; | ||
@@ -474,3 +475,3 @@ accessControlConditions?: AccessControlConditions; | ||
export interface DecryptZipFileWithMetadataProps { | ||
authSig?: AuthSig; | ||
authSig?: JsonAuthSig; | ||
sessionSigs?: any; | ||
@@ -515,3 +516,3 @@ file: File | Blob; | ||
export interface AuthMethod { | ||
authMethodType: number; | ||
authMethodType: AuthMethodType; | ||
accessToken: string; | ||
@@ -523,3 +524,3 @@ } | ||
pkpPublicKey?: string; | ||
authSig?: AuthSig; | ||
authSig?: JsonAuthSig; | ||
expiration: string; | ||
@@ -532,3 +533,3 @@ resources: any; | ||
pkpPublicKey: string; | ||
authSig: AuthSig; | ||
authSig: JsonAuthSig; | ||
} | ||
@@ -544,15 +545,5 @@ export interface GetSignSessionKeySharesProp { | ||
switchChain?: any; | ||
authNeededCallback?: AuthCallback; | ||
authNeededCallback?: any; | ||
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 { | ||
@@ -562,12 +553,8 @@ sessionKey: string; | ||
pkpPublicKey?: string; | ||
authSig?: AuthSig; | ||
authSig?: JsonAuthSig; | ||
siweMessage: string; | ||
} | ||
export interface GetWalletSigProps { | ||
authNeededCallback?: AuthCallback; | ||
chain: string; | ||
capabilities: Array<any>; | ||
switchChain: boolean; | ||
expiration: string; | ||
sessionKeyUri: string; | ||
export interface WalletSig { | ||
signedMessage: string; | ||
sig: any; | ||
} | ||
@@ -595,1 +582,276 @@ 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,1 +59,3 @@ 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'; |
38079
17
1265