Skip to content

Commit f27e6e7

Browse files
authored
Merge branch 'master' into feat/add-ipfs-hash-helper
2 parents a5295b7 + 6514a07 commit f27e6e7

File tree

35 files changed

+132
-34
lines changed

35 files changed

+132
-34
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ jobs:
2525
node-version: '20'
2626
cache: 'yarn'
2727
- name: Install rust
28-
uses: dtolnay/[email protected]
28+
uses: actions-rs/toolchain@v1
29+
with:
30+
toolchain: 1.83.0
31+
override: true
32+
components: rust-std
2933
- uses: jetli/[email protected]
3034
with:
3135
# Optional version of wasm-pack to install(eg. 'v0.9.1', 'latest')

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
33
"useNx": true,
44
"useWorkspaces": true,
5-
"version": "7.0.4"
5+
"version": "7.0.6"
66
}

local-tests/setup/session-sigs/get-pkp-session-sigs.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export const getPkpSessionSigs = async (
1212
devEnv: TinnyEnvironment,
1313
alice: TinnyPerson,
1414
resourceAbilityRequests?: LitResourceAbilityRequest[],
15-
expiration?: string
15+
expiration?: string,
16+
domain?: string
1617
) => {
1718
const centralisation =
1819
CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork];
@@ -39,6 +40,7 @@ export const getPkpSessionSigs = async (
3940
pkpPublicKey: alice.authMethodOwnedPkp.publicKey,
4041
authMethods: [alice.authMethod],
4142
expiration,
43+
domain,
4244
resourceAbilityRequests: _resourceAbilityRequests,
4345

4446
...(centralisation === 'decentralised' && {

local-tests/test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import { ethers } from 'ethers';
2+
3+
import { log } from '@lit-protocol/misc';
4+
import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs';
15
import { TinnyEnvironment } from './setup/tinny-environment';
26
import { runInBand, runTestsParallel } from './setup/tinny-operations';
37
// import { testBundleSpeed } from './tests/test-bundle-speed';
@@ -109,6 +113,7 @@ import { testFailBatchGeneratePrivateKeysAtomic } from './tests/wrapped-keys/tes
109113

110114
import { setLitActionsCodeToLocal } from './tests/wrapped-keys/util';
111115
import { testUseEoaSessionSigsToRequestSingleResponse } from './tests/testUseEoaSessionSigsToRequestSingleResponse';
116+
import { testPkpSessionSigsDomain } from './tests/testPkpSessionSigsDomain';
112117

113118
// Use the current LIT action code to test against
114119
setLitActionsCodeToLocal();
@@ -185,6 +190,7 @@ setLitActionsCodeToLocal();
185190
testUsePkpSessionSigsToExecuteJsConsoleLog,
186191
testUsePkpSessionSigsToEncryptDecryptString,
187192
testUsePkpSessionSigsToEncryptDecryptFile,
193+
testPkpSessionSigsDomain,
188194
};
189195

190196
const litActionSessionSigsTests = {
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { log } from '@lit-protocol/misc';
2+
import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs';
3+
import { TinnyEnvironment } from 'local-tests/setup/tinny-environment';
4+
5+
/**
6+
* Test Commands:
7+
* ✅ NETWORK=datil-dev yarn test:local --filter=testPkpSessionSigsDomain
8+
* ✅ NETWORK=datil-test yarn test:local --filter=testPkpSessionSigsDomain
9+
* ✅ NETWORK=custom yarn test:local --filter=testPkpSessionSigsDomain
10+
*/
11+
export const testPkpSessionSigsDomain = async (devEnv: TinnyEnvironment) => {
12+
const alice = await devEnv.createRandomPerson();
13+
const testDomain = 'test.domain.com';
14+
15+
// AuthNeededCallback props:
16+
// props: {
17+
// chain: 'ethereum',
18+
// statement: 'I further authorize the stated URI to perform the following actions on my behalf:',
19+
// resources: [ 'urn:recap:eyJhdHQiOnt9LCJwcmYiOltdfQ' ],
20+
// expiration: '2025-02-01T16:51:50.358Z',
21+
// uri: 'lit:session:e43c4bdff81bb83e7bedf079f5546f237d6e1344c9981735fe8d3a0bbc07c371',
22+
// sessionKey: {
23+
// publicKey: 'e43c4bdff81bb83e7bedf079f5546f237d6e1344c9981735fe8d3a0bbc07c371',
24+
// secretKey: 'a5f43862612394a59f64708a847825255d66839fd6972d3538cb5dffce7228aee43c4bdff81bb83e7bedf079f5546f237d6e1344c9981735fe8d3a0bbc07c371'
25+
// },
26+
// nonce: '0x53e14ac177c02e4b460432ef2bd639519c589137f16136027505c58793608ef7',
27+
// domain: 'test.domain.com',
28+
// resourceAbilityRequests: [
29+
// { resource: [LitPKPResource], ability: 'pkp-signing' },
30+
// { resource: [LitActionResource], ability: 'lit-action-execution' }
31+
// ]
32+
// }
33+
const pkpSessionSigs = await getPkpSessionSigs(
34+
devEnv,
35+
alice,
36+
undefined,
37+
undefined,
38+
testDomain
39+
);
40+
41+
// Get the first session sig to verify
42+
const firstNodeAddress = Object.keys(pkpSessionSigs)[0];
43+
const firstSessionSig = pkpSessionSigs[firstNodeAddress];
44+
45+
// Parse the signed message to verify domain
46+
const signedMessage = firstSessionSig.signedMessage;
47+
48+
// Verify that the domain is present in the signed message
49+
if (!signedMessage.includes(testDomain)) {
50+
throw new Error(
51+
`Expected domain "${testDomain}" in signed message, but it was not found. Signed message: ${signedMessage}`
52+
);
53+
}
54+
55+
log('✅ Domain parameter successfully passed through in sessionSigs');
56+
57+
// Clean up
58+
devEnv.releasePrivateKeyFromUser(alice);
59+
};

packages/access-control-conditions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"tags": [
2222
"universal"
2323
],
24-
"version": "7.0.4",
24+
"version": "7.0.6",
2525
"main": "./dist/src/index.js",
2626
"typings": "./dist/src/index.d.ts"
2727
}

packages/auth-browser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"tags": [
3232
"browser"
3333
],
34-
"version": "7.0.4",
34+
"version": "7.0.6",
3535
"main": "./dist/src/index.js",
3636
"typings": "./dist/src/index.d.ts"
3737
}

packages/auth-helpers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"crypto": false,
2626
"stream": false
2727
},
28-
"version": "7.0.4",
28+
"version": "7.0.6",
2929
"main": "./dist/src/index.js",
3030
"typings": "./dist/src/index.d.ts"
3131
}

packages/constants/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"tags": [
2121
"universal"
2222
],
23-
"version": "7.0.4",
23+
"version": "7.0.6",
2424
"main": "./dist/src/index.js",
2525
"typings": "./dist/src/index.d.ts"
2626
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const version = '7.0.4';
1+
export const version = '7.0.6';

0 commit comments

Comments
 (0)