Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

- Bump dependencies
- Drop Node 18 support
- Remove deprecated `@noble/curves` usage

## 0.4.15

Expand Down
2 changes: 1 addition & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.2.3/schema.json",
"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
Expand Down
2 changes: 1 addition & 1 deletion example/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"eciesjs": "file:../.."
},
"devDependencies": {
"vite": "^7.1.5",
"vite": "^7.1.9",
"vite-bundle-visualizer": "^1.2.1"
}
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@
"@noble/hashes": "^1.8.0"
},
"devDependencies": {
"@biomejs/biome": "^2.2.3",
"@types/node": "^24.3.1",
"@biomejs/biome": "2.2.5",
"@types/node": "^24.7.2",
"@vitest/coverage-v8": "^3.2.4",
"typescript": "^5.9.2",
"undici": "~7.12.0",
"typescript": "^5.9.3",
"undici": "^7.16.0",
"vitest": "^3.2.4"
},
"pnpm": {
Expand All @@ -77,5 +77,5 @@
"esbuild"
]
},
"packageManager": "pnpm@10.15.1+sha512.34e538c329b5553014ca8e8f4535997f96180a1d0f614339357449935350d924e22f8614682191264ec33d1462ac21561aff97f6bb18065351c162c7e8f6de67"
"packageManager": "pnpm@10.18.2+sha512.9fb969fa749b3ade6035e0f109f0b8a60b5d08a1a87fdf72e337da90dcc93336e2280ca4e44f2358a649b83c17959e9993e777c2080879f3801e6f0d999ad3dd"
}
601 changes: 305 additions & 296 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/utils/elliptic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ export const convertPublicKeyFormat = (
// only for secp256k1
_exec(
curve,
(curve) => curve.getSharedSecret(BigInt(1), pk, compressed),
(curve) =>
curve.getSharedSecret(
Uint8Array.from(Array(31).fill(0).concat([1])), // 1 as private key
pk,
compressed
),
() => pk,
() => pk
);
Expand Down Expand Up @@ -103,6 +108,6 @@ const getSharedPointOnEd25519 = (
): Uint8Array => {
// Note: scalar is hashed from sk
const { scalar } = curve.utils.getExtendedPublicKey(sk);
const point = curve.Point.fromHex(pk).multiply(scalar);
const point = curve.Point.fromBytes(pk).multiply(scalar);
return point.toBytes();
};
2 changes: 1 addition & 1 deletion tests-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"devDependencies": {
"@vitest/browser": "^3.2.4",
"playwright": "^1.55.0",
"playwright": "^1.56.0",
"vitest": "^3.2.4"
}
}
18 changes: 6 additions & 12 deletions tests/keys/known.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ describe("test known keys", () => {
});

it("tests encapsulate: secp256k1", () => {
const two = new Uint8Array(32);
two[31] = 2;
const three = new Uint8Array(32);
three[31] = 3;
const two = Uint8Array.from(Array(31).fill(0).concat([2]));
const three = Uint8Array.from(Array(31).fill(0).concat([3]));

const k1 = new PrivateKey(two, "secp256k1");
const k2 = new PrivateKey(three, "secp256k1");
Expand All @@ -53,10 +51,8 @@ describe("test known keys", () => {
});

it("tests encapsulate: x25519", () => {
const two = new Uint8Array(32);
two[31] = 2;
const three = new Uint8Array(32);
three[31] = 3;
const two = Uint8Array.from(Array(31).fill(0).concat([2]));
const three = Uint8Array.from(Array(31).fill(0).concat([3]));

const k1 = new PrivateKey(two, "x25519");
const k2 = new PrivateKey(three, "x25519");
Expand All @@ -77,10 +73,8 @@ describe("test known keys", () => {
});

it("tests encapsulate: ed25519", () => {
const two = new Uint8Array(32);
two[31] = 2;
const three = new Uint8Array(32);
three[31] = 3;
const two = Uint8Array.from(Array(31).fill(0).concat([2]));
const three = Uint8Array.from(Array(31).fill(0).concat([3]));

const k1 = new PrivateKey(two, "ed25519");
const k2 = new PrivateKey(three, "ed25519");
Expand Down