Skip to content

Commit

Permalink
Hash the toSign parameter before signing in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glitch003 committed Sep 21, 2023
1 parent a690086 commit 2587d76
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/nodejs/manual-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const runLogic = async (contract: LitContracts) => {
const pkpSign = async (client, pkpPubkey, authSig) => {
// try and sign something
let sig = await client.pkpSign({
toSign: [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100], // hello world in Uint8Array
toSign: ethers.utils.arrayify(ethers.utils.keccak256([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100])), // hello world in Uint8Array
pubKey: pkpPubkey,
authSig,
});
Expand Down Expand Up @@ -247,7 +247,7 @@ const litActionSign = async(client, pkpPubkey, authSig) => {
// all jsParams can be used anywhere in your litActionCode
jsParams: {
// this is the string "Hello World" for testing
toSign: [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100],
toSign: ethers.utils.arrayify(ethers.utils.keccak256([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100])),
publicKey: pkpPubkey,
sigName: "sig1",
},
Expand Down Expand Up @@ -288,13 +288,13 @@ const mintPkpAndSign = async () => {
"http://localhost:7471",
"http://localhost:7472",
],
debug: false
debug: true
});
} else {
// use cayenne
client = new LitJsSdk.LitNodeClient({
litNetwork: 'cayenne',
debug: false
debug: true
});
}

Expand All @@ -320,7 +320,7 @@ const mintPkpAndSign = async () => {

let startTime = Date.now();
let allGood = true;
const testCount = 50;
const testCount = 1;
for(let i = 0; i < testCount; i++){
console.log(`testing ${i + 1} of ${testCount}`);
let result = await pkpSign(client, pkpPubkey, authSig);
Expand Down

0 comments on commit 2587d76

Please sign in to comment.