Skip to content

Commit

Permalink
task/tests: add extra wallet tests to verify private matches public keys
Browse files Browse the repository at this point in the history
  • Loading branch information
rosmcmahon committed Mar 19, 2024
1 parent 1e81f25 commit c8d2a72
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ describe("Wallets and keys", function () {

expect(walletA.n).to.match(/^[a-z0-9-_]{683}$/i);

/** extra tests that private matches public */
const sigA = await arweave.crypto.sign(walletA, new Uint8Array([1, 2, 3, 4]));
const verifyA = await arweave.crypto.verify(walletA.n, new Uint8Array([1, 2, 3, 4]), sigA);
expect(verifyA).true;
const sigB = await arweave.crypto.sign(walletB, new Uint8Array([1, 2, 3, 4]));
const verifyB = await arweave.crypto.verify(walletB.n, new Uint8Array([1, 2, 3, 4]), sigB);
expect(verifyB).true;


expect(walletA.d?.length).to.equal(683);
expect(walletA.d).to.match(/^[a-z0-9-_]{683}$/i);

const addressA = await arweave.wallets.jwkToAddress(walletA);
Expand Down

0 comments on commit c8d2a72

Please sign in to comment.