Skip to content

Commit 3224675

Browse files
authored
Merge branch 'naga' into fix/ci-lint-issue
2 parents d9e65d2 + 2465d4b commit 3224675

File tree

8 files changed

+42
-35
lines changed

8 files changed

+42
-35
lines changed

bun.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "@lit-protocol/js-sdk",
66
"dependencies": {
77
"@dotenvx/dotenvx": "^1.6.4",
8-
"@lit-protocol/contracts": "^0.5.0",
8+
"@lit-protocol/contracts": "0.5.1",
99
"@lit-protocol/nacl": "7.1.1",
1010
"@lit-protocol/uint8arrays": "7.1.1",
1111
"@metamask/eth-sig-util": "5.0.2",
@@ -151,7 +151,7 @@
151151
"@elysiajs/cors": "^1.2.0",
152152
"@elysiajs/static": "^1.3.0",
153153
"@elysiajs/swagger": "^1.2.0",
154-
"@lit-protocol/contracts": "^0.5.0",
154+
"@lit-protocol/contracts": "^0.5.1",
155155
"@simplewebauthn/server": "6.2.1",
156156
"@simplewebauthn/typescript-types": "^8.3.4",
157157
"@t3-oss/env-core": "^0.12.0",
@@ -222,7 +222,7 @@
222222
"name": "@lit-protocol/networks",
223223
"version": "8.0.0-beta.1",
224224
"dependencies": {
225-
"@lit-protocol/contracts": "^0.5.0",
225+
"@lit-protocol/contracts": "^0.5.1",
226226
"@lit-protocol/nacl": "7.1.1",
227227
"@noble/curves": "^1.8.1",
228228
"@wagmi/core": "^2.17.1",

e2e/src/init.ts

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,17 @@ export const init = async (
181181
});
182182
console.log('✅ Master Payment Balance:', masterPaymentBalance);
183183

184+
async function masterDepositForUser(userAddress: string) {
185+
await masterPaymentManager.depositForUser({
186+
userAddress: userAddress,
187+
amountInEth: LIVE_NETWORK_LEDGER_DEPOSIT_AMOUNT,
188+
});
189+
console.log(
190+
`✅ New ${userAddress} Ledger Balance:`,
191+
await masterPaymentManager.getBalance({ userAddress: userAddress })
192+
);
193+
}
194+
184195
/**
185196
* ====================================
186197
* Initialise the AuthManager
@@ -237,6 +248,14 @@ export const init = async (
237248

238249
const eveViemAccountPkp = pkpData.data;
239250

251+
// Making sure all signers have sufficient ledger balance before calling the signSessionKey endpoint
252+
await masterDepositForUser(aliceViemAccount.address);
253+
await masterDepositForUser(bobViemAccount.address);
254+
await masterDepositForUser(aliceViemAccountPkp.ethAddress);
255+
await masterDepositForUser(bobViemAccountPkp.ethAddress);
256+
await masterDepositForUser(eveViemAccount.address);
257+
await masterDepositForUser(eveViemAccountPkp.ethAddress);
258+
240259
/**
241260
* ====================================
242261
* Create the auth context
@@ -299,35 +318,9 @@ export const init = async (
299318
* ====================================
300319
*/
301320

302-
async function masterDepositForUser(userAddress: string) {
303-
await masterPaymentManager.depositForUser({
304-
userAddress: userAddress,
305-
amountInEth: LIVE_NETWORK_LEDGER_DEPOSIT_AMOUNT,
306-
});
307-
console.log(
308-
`✅ New ${userAddress} Ledger Balance:`,
309-
await masterPaymentManager.getBalance({ userAddress: userAddress })
310-
);
311-
}
312-
313-
// Deposit to the Alice EOA Ledger
314-
await masterDepositForUser(aliceViemAccount.address);
315-
316-
// Deposit to the PKP Ledger
321+
// Deposit to the PKP Viem account Ledger
317322
await masterDepositForUser(alicePkpViemAccount.address);
318323

319-
// Deposit to the Bob EOA Ledger
320-
await masterDepositForUser(bobViemAccount.address);
321-
322-
// Deposit to the Bob PKP Ledger
323-
await masterDepositForUser(bobViemAccountPkp.ethAddress);
324-
325-
// Deposit to the Eve EOA Ledger
326-
await masterDepositForUser(eveViemAccount.address);
327-
328-
// Deposit to the Eve PKP Ledger
329-
await masterDepositForUser(eveViemAccountPkp.ethAddress);
330-
331324
// const alicePkpViemAccountPermissionsManager = await litClient.getPKPPermissionsManager({
332325
// pkpIdentifier: {
333326
// tokenId: aliceViemAccountPkp.tokenId,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"private": true,
3636
"dependencies": {
3737
"@dotenvx/dotenvx": "^1.6.4",
38-
"@lit-protocol/contracts": "^0.5.0",
38+
"@lit-protocol/contracts": "0.5.1",
3939
"@lit-protocol/nacl": "7.1.1",
4040
"@lit-protocol/uint8arrays": "7.1.1",
4141
"@metamask/eth-sig-util": "5.0.2",

packages/auth-services/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@elysiajs/cors": "^1.2.0",
2121
"@elysiajs/static": "^1.3.0",
2222
"@elysiajs/swagger": "^1.2.0",
23-
"@lit-protocol/contracts": "^0.5.0",
23+
"@lit-protocol/contracts": "^0.5.1",
2424
"@simplewebauthn/server": "6.2.1",
2525
"@simplewebauthn/typescript-types": "^8.3.4",
2626
"@t3-oss/env-core": "^0.12.0",

packages/networks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"directory": "../../dist/packages/networks"
1919
},
2020
"dependencies": {
21-
"@lit-protocol/contracts": "^0.5.0",
21+
"@lit-protocol/contracts": "^0.5.1",
2222
"@lit-protocol/nacl": "7.1.1",
2323
"@noble/curves": "^1.8.1",
2424
"@wagmi/core": "^2.17.1",

packages/networks/src/networks/vNaga/envs/naga-staging/naga-staging.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { ExpectedAccountOrWalletClient } from '../../shared/managers/contra
55

66
const nagaStaging = createBaseModule({
77
networkConfig: nagaStagingEnvironment.getConfig(),
8-
moduleName: 'naga-staging',
8+
moduleName: nagaStagingEnvironment.getNetworkName(),
99
createChainManager: (account: ExpectedAccountOrWalletClient) =>
1010
createChainManager(account),
1111
});

packages/networks/src/networks/vNaga/shared/factories/BaseModuleFactory.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,14 @@ export function createBaseModule<T, M>(config: BaseModuleConfig<T, M>) {
905905
jitContext: NagaJitContext,
906906
requestId?: string
907907
) => {
908+
if (!result.success) {
909+
E2EERequestManager.handleEncryptedError(
910+
result,
911+
jitContext,
912+
'Sign Custom Session Key'
913+
);
914+
}
915+
908916
const decryptedValues = E2EERequestManager.decryptBatchResponse(
909917
result,
910918
jitContext,

packages/wasm/rust/src/sev_snp.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,27 @@ fn get_expected_report_data(
130130
) -> JsResult<[u8; 64]> {
131131
let mut hasher = Sha512::new();
132132
hasher.update("noonce");
133+
hasher.update(&(challenge.len() as u64).to_be_bytes());
133134
hasher.update(challenge);
134135

135136
hasher.update("data");
137+
hasher.update(&(data.len() as u64).to_be_bytes());
136138
for (key, value) in data {
139+
hasher.update(&(key.len() as u64).to_be_bytes());
137140
hasher.update(key);
141+
hasher.update(&(value.len() as u64).to_be_bytes());
138142
hasher.update(value);
139143
}
140144

141145
if !signatures.is_empty() {
142146
hasher.update("signatures");
147+
hasher.update(&(signatures.len() as u64).to_be_bytes());
143148

144-
for idx in 0..((signatures.len() - 1) as usize) {
149+
for idx in 0..=((signatures.len() - 1) as usize) {
145150
let sig = signatures.get(idx);
146151
match sig {
147152
Some(s) => {
153+
hasher.update(&(s.len() as u64).to_be_bytes());
148154
hasher.update(s.clone());
149155
}
150156
None => {

0 commit comments

Comments
 (0)