@zendfi/sdk 0.8.1 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +18 -8
- package/dist/index.mjs +18 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2408,7 +2408,7 @@ var DeviceBoundSessionKey = class _DeviceBoundSessionKey {
|
|
|
2408
2408
|
}
|
|
2409
2409
|
};
|
|
2410
2410
|
async function encryptKeypairWithLit(keypair, options) {
|
|
2411
|
-
const network = options?.network || "datil
|
|
2411
|
+
const network = options?.network || "datil";
|
|
2412
2412
|
const debug = options?.debug || false;
|
|
2413
2413
|
if (debug) {
|
|
2414
2414
|
console.log("[Lit] Encrypting keypair with Lit Protocol...");
|
|
@@ -2424,15 +2424,23 @@ async function encryptKeypairWithLit(keypair, options) {
|
|
|
2424
2424
|
console.log(`[Lit] Connected to ${network}`);
|
|
2425
2425
|
}
|
|
2426
2426
|
try {
|
|
2427
|
-
const
|
|
2427
|
+
const evmContractConditions = [
|
|
2428
2428
|
{
|
|
2429
2429
|
contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
2430
2430
|
// USDC on Ethereum
|
|
2431
|
-
|
|
2431
|
+
functionName: "balanceOf",
|
|
2432
|
+
functionParams: [":userAddress"],
|
|
2433
|
+
functionAbi: {
|
|
2434
|
+
constant: true,
|
|
2435
|
+
inputs: [{ name: "account", type: "address" }],
|
|
2436
|
+
name: "balanceOf",
|
|
2437
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
2438
|
+
stateMutability: "view",
|
|
2439
|
+
type: "function"
|
|
2440
|
+
},
|
|
2432
2441
|
chain: "ethereum",
|
|
2433
|
-
method: "balanceOf",
|
|
2434
|
-
parameters: [":userAddress"],
|
|
2435
2442
|
returnValueTest: {
|
|
2443
|
+
key: "",
|
|
2436
2444
|
comparator: ">=",
|
|
2437
2445
|
value: "0"
|
|
2438
2446
|
}
|
|
@@ -2440,10 +2448,10 @@ async function encryptKeypairWithLit(keypair, options) {
|
|
|
2440
2448
|
];
|
|
2441
2449
|
const dataToEncrypt = keypair.secretKey;
|
|
2442
2450
|
if (debug) {
|
|
2443
|
-
console.log("[Lit] Encrypting keypair bytes...");
|
|
2451
|
+
console.log("[Lit] Encrypting keypair bytes with evmContractConditions...");
|
|
2444
2452
|
}
|
|
2445
2453
|
const encryptResult = await litClient.encrypt({
|
|
2446
|
-
|
|
2454
|
+
evmContractConditions,
|
|
2447
2455
|
dataToEncrypt
|
|
2448
2456
|
});
|
|
2449
2457
|
if (debug) {
|
|
@@ -2535,7 +2543,9 @@ var SessionKeysAPI = class {
|
|
|
2535
2543
|
try {
|
|
2536
2544
|
this.debug(`Encrypting session key with Lit Protocol (attempt ${attempt}/${maxRetries})...`);
|
|
2537
2545
|
litEncryption = await encryptKeypairWithLit(sessionKey.getKeypair(), {
|
|
2538
|
-
|
|
2546
|
+
// CRITICAL: Must match backend LIT_NETWORK (Datil = mainnet)
|
|
2547
|
+
// datil-dev encryption cannot be decrypted by datil backend!
|
|
2548
|
+
network: options.litNetwork || "datil",
|
|
2539
2549
|
debug: this.debugMode
|
|
2540
2550
|
});
|
|
2541
2551
|
this.debug("Lit Protocol encryption successful - autonomous signing enabled");
|
package/dist/index.mjs
CHANGED
|
@@ -1941,7 +1941,7 @@ var DeviceBoundSessionKey = class _DeviceBoundSessionKey {
|
|
|
1941
1941
|
}
|
|
1942
1942
|
};
|
|
1943
1943
|
async function encryptKeypairWithLit(keypair, options) {
|
|
1944
|
-
const network = options?.network || "datil
|
|
1944
|
+
const network = options?.network || "datil";
|
|
1945
1945
|
const debug = options?.debug || false;
|
|
1946
1946
|
if (debug) {
|
|
1947
1947
|
console.log("[Lit] Encrypting keypair with Lit Protocol...");
|
|
@@ -1957,15 +1957,23 @@ async function encryptKeypairWithLit(keypair, options) {
|
|
|
1957
1957
|
console.log(`[Lit] Connected to ${network}`);
|
|
1958
1958
|
}
|
|
1959
1959
|
try {
|
|
1960
|
-
const
|
|
1960
|
+
const evmContractConditions = [
|
|
1961
1961
|
{
|
|
1962
1962
|
contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
1963
1963
|
// USDC on Ethereum
|
|
1964
|
-
|
|
1964
|
+
functionName: "balanceOf",
|
|
1965
|
+
functionParams: [":userAddress"],
|
|
1966
|
+
functionAbi: {
|
|
1967
|
+
constant: true,
|
|
1968
|
+
inputs: [{ name: "account", type: "address" }],
|
|
1969
|
+
name: "balanceOf",
|
|
1970
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
1971
|
+
stateMutability: "view",
|
|
1972
|
+
type: "function"
|
|
1973
|
+
},
|
|
1965
1974
|
chain: "ethereum",
|
|
1966
|
-
method: "balanceOf",
|
|
1967
|
-
parameters: [":userAddress"],
|
|
1968
1975
|
returnValueTest: {
|
|
1976
|
+
key: "",
|
|
1969
1977
|
comparator: ">=",
|
|
1970
1978
|
value: "0"
|
|
1971
1979
|
}
|
|
@@ -1973,10 +1981,10 @@ async function encryptKeypairWithLit(keypair, options) {
|
|
|
1973
1981
|
];
|
|
1974
1982
|
const dataToEncrypt = keypair.secretKey;
|
|
1975
1983
|
if (debug) {
|
|
1976
|
-
console.log("[Lit] Encrypting keypair bytes...");
|
|
1984
|
+
console.log("[Lit] Encrypting keypair bytes with evmContractConditions...");
|
|
1977
1985
|
}
|
|
1978
1986
|
const encryptResult = await litClient.encrypt({
|
|
1979
|
-
|
|
1987
|
+
evmContractConditions,
|
|
1980
1988
|
dataToEncrypt
|
|
1981
1989
|
});
|
|
1982
1990
|
if (debug) {
|
|
@@ -2068,7 +2076,9 @@ var SessionKeysAPI = class {
|
|
|
2068
2076
|
try {
|
|
2069
2077
|
this.debug(`Encrypting session key with Lit Protocol (attempt ${attempt}/${maxRetries})...`);
|
|
2070
2078
|
litEncryption = await encryptKeypairWithLit(sessionKey.getKeypair(), {
|
|
2071
|
-
|
|
2079
|
+
// CRITICAL: Must match backend LIT_NETWORK (Datil = mainnet)
|
|
2080
|
+
// datil-dev encryption cannot be decrypted by datil backend!
|
|
2081
|
+
network: options.litNetwork || "datil",
|
|
2072
2082
|
debug: this.debugMode
|
|
2073
2083
|
});
|
|
2074
2084
|
this.debug("Lit Protocol encryption successful - autonomous signing enabled");
|