UNPKG

kalp-pkg

Version:

KALP blockchain SDK for cryptographic operations and blockchain interactions

126 lines (124 loc) 6.3 kB
/** * Environment variable for the network you need to connect . */ declare const Network: { readonly Stagenet: "STAGENET"; readonly Testnet: "TESTNET"; readonly Mainnet: "MAINNET"; readonly IntegrationMainnet: "INTEGRATIONMAINNET"; }; type NetworkType = typeof Network[keyof typeof Network]; /** * getSeedPhrase */ declare function getSeedPhrase(): Promise<string>; /** * getKeyPairFromSeedPhrase * @param {string} seedPhrase - Need to give seedphrase. */ declare function getKeyPairFromSeedPhrase(seedPhrase: any): Promise<{ pemPrivateKey: any; pemPublicKey: string; }>; /** * getKeyPair */ declare function getKeyPair(): Promise<{ pemPrivateKey: string; pemPublicKey: string; }>; /** * getEnrollmentId * @param {string} publicKey - Provide PEM format public key. */ declare function getEnrollmentId(publicKey: string): Promise<string>; /** * createCsr * @param {string} enrollmentID - provide enrollment id in string. * @param {string} privateKeyPem - Provide PEM format private key. * @param {string} publicKey - Provide PEM format public key. */ declare function createCsr(enrollmentID: string, privateKeyPem: string, publicKeyPem: string): string; /** * registerAndEnrollUser * @param {string} network - provide network to which you want to register to. * @param {string} enrollmentID - provide enrollment id in string. * @param {string} csr - Provide certificate. */ declare function registerAndEnrollUser(network: NetworkType, nglURL: string | null, channelName: string | null, enrollmentID: string, csr: string): Promise<string>; /** * register * @param {string} network - provide network to which you want to register to. * @param {string} enrollmentID - provide enrollment id in string format. * @param {string} encryptedWord - provide secret in string format. */ declare function register(network: NetworkType, nglURL: string | null, channelName: string | null, enrollmentID: string, encryptedWord: string): Promise<string>; /** * enrollCsr * @param {string} network - provide network to which you want to register to. * @param {string} enrollmentID - provide enrollment id in string format. * @param {string} encryptedWord - provide secret in string format. * @param {string} csr - Provide certificate. */ declare function enrollCsr(network: NetworkType, nglURL: string | null, channelName: string | null, enrollmentID: string, encryptedWord: string, csr: string): Promise<string>; /** * getSecret * @param {string} enrollmentID - provide enrollment id in string format. */ declare function getSecret(enrollmentID: string): Promise<string>; /** * submitTransaction * @param {string} network - provide network to which you want to submit transaction. * @param {string} enrollmentID - provide enrollment id in string. * @param {string} pemPrivateKey - Provide PEM format private key. * @param {string} cert - Provide certificate. * @param {string} channelName - provide channelName in string. * @param {string} chainCodeName - provide chainCodeName in string. * @param {string} transactionName - provide transactionName in string. * @param {Array} transactionParams - Provide transactionParams in an array. */ declare function submitTransaction(network: NetworkType, gatewayURL: string | null, enrollmentID: string, pemPrivateKey: string, cert: string, channelName: string, chainCodeName: string, transactionName: string, transactionParams: string[]): Promise<string>; /** * evaluateTransaction * @param {string} network - provide network to which you want to evaluate transaction. * @param {string} enrollmentID - provide enrollment id in string. * @param {string} privateKeyString - Provide PEM format private key. * @param {string} cert - Provide certificate. * @param {string} channelName - provide channelName in string. * @param {string} chainCodeName - provide chainCodeName in string. * @param {string} transactionName - provide transactionName in string. * @param {Array} transactionParams - Provide transactionParams in an array. */ declare function evaluateTransaction(network: NetworkType, gatewayURL: string | null, enrollmentID: string, privateKeyString: string, cert: string, channelName: string, chainCodeName: string, transactionName: string, transactionParams: string[]): Promise<any>; /** * evaluateBalance * @param {string} network - provide network to which you want to evaluate balance for. * @param {string} enrollmentID - provide enrollment id in string. * @param {string} privateKeyString - Provide PEM format private key. * @param {string} cert - Provide certificate. * @param {string} channelName - provide channelName in string. * @param {string} chainCodeName - provide chainCodeName in string. * @param {string} transactionName - provide transactionName in string. * @param {Array} transactionParams - Provide transactionParams (enrollment id) in an array. */ declare const evaluateBalance: (network: NetworkType, gatewayURL: string | null, enrollmentID: string, privateKeyString: string, cert: string, channelName: string, chainCodeName: string, transactionNameBalance: string, transactionParamsBalance: string[]) => Promise<any>; declare function signUsingElliptic(privateKeyString: string, hashedBytesArray: Uint8Array): Promise<[string, string]>; /** * createRandSUsingPrivateKey * @param {string} privateKeyString - Provide PEM format private key. * @param {string} proposal - Proposal in string format. */ declare function getRandSvalue(privateKeyString: string, proposal: string): Promise<[string, string]>; /** * getKeyPairFromPemPrivateKey * @param {string} pemPrivateKey - PEM-encoded EC private key * @returns {{ pemPrivateKey: string, pemPublicKey: string }} */ declare function getKeyPairFromPemPrivateKey(pemPrivateKey: string): Promise<{ pemPrivateKey: string; pemPublicKey: string; }>; declare function encryptText(text: string): string; declare function decryptText(ciphertext: string): string; export { Network, createCsr, decryptText, encryptText, enrollCsr, evaluateBalance, evaluateTransaction, getEnrollmentId, getKeyPair, getKeyPairFromPemPrivateKey, getKeyPairFromSeedPhrase, getRandSvalue, getSecret, getSeedPhrase, register, registerAndEnrollUser, signUsingElliptic, submitTransaction }; export type { NetworkType };