Skip to content

Commit

Permalink
Bump dependencies (#822)
Browse files Browse the repository at this point in the history
  • Loading branch information
kigawas authored Dec 7, 2024
1 parent 8bcce34 commit e362900
Show file tree
Hide file tree
Showing 13 changed files with 262 additions and 233 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ updates:
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 10
open-pull-requests-limit: 3
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

# Changelog

## 0.4.13

- Bump dependencies

## 0.4.12

- Add `PublicKey.toBytes` and deprecate `PublicKey.compressed` and `PublicKey.uncompressed`
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/47784cde956642b1b9e8e33cb8551674)](https://app.codacy.com/app/ecies/js)
[![License](https://img.shields.io/github/license/ecies/js.svg)](https://github.com/ecies/js)
[![Npm Package](https://img.shields.io/npm/v/eciesjs.svg)](https://www.npmjs.com/package/eciesjs)
[![NPM Package](https://img.shields.io/npm/v/eciesjs.svg)](https://www.npmjs.com/package/eciesjs)
![NPM Downloads](https://img.shields.io/npm/dm/eciesjs)
[![Bundle size](https://badgen.net/bundlephobia/minzip/eciesjs)](https://bundlephobia.com/package/eciesjs@latest)
[![CI](https://img.shields.io/github/actions/workflow/status/ecies/js/ci.yml)](https://github.com/ecies/js/actions)
[![Codecov](https://img.shields.io/codecov/c/github/ecies/js.svg)](https://codecov.io/gh/ecies/js)

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": "6.0.0-beta.9",
"vite": "^6.0.3",
"vite-bundle-visualizer": "^1.2.1"
}
}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "git",
"url": "git+https://github.com/ecies/js.git"
},
"version": "0.4.12",
"version": "0.4.13",
"engines": {
"node": ">=16",
"bun": ">=1",
Expand Down Expand Up @@ -56,17 +56,17 @@
"test:browser": "node ./scripts/gen-browser-tests.mjs && cd tests-browser && pnpm test"
},
"dependencies": {
"@ecies/ciphers": "^0.2.1",
"@ecies/ciphers": "^0.2.2",
"@noble/ciphers": "^1.0.0",
"@noble/curves": "^1.6.0",
"@noble/hashes": "^1.5.0"
},
"devDependencies": {
"@types/node": "^22.9.0",
"@vitest/coverage-v8": "^2.1.4",
"typescript": "^5.6.3",
"undici": "^6.20.1",
"vitest": "^2.1.4"
"@types/node": "^22.10.1",
"@vitest/coverage-v8": "^2.1.8",
"typescript": "^5.7.2",
"undici": "^7.1.0",
"vitest": "^2.1.8"
},
"packageManager": "pnpm@9.12.3+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee"
"packageManager": "pnpm@9.14.4+sha512.c8180b3fbe4e4bca02c94234717896b5529740a6cbadf19fa78254270403ea2f27d4e1d46a08a0f56c89b63dc8ebfd3ee53326da720273794e6200fcf0d184ab"
}
428 changes: 220 additions & 208 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions scripts/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
pnpm update -i
cd tests-browser && pnpm update && cd ..
cd example/browser && pnpm update && cd ..
4 changes: 2 additions & 2 deletions src/keys/PublicKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export class PublicKey {

/** @deprecated - use `PublicKey.toBytes(false)` instead. You may also need `Buffer.from`. */
get uncompressed(): Buffer {
return Buffer.from(this._uncompressed); // TODO: Uint8Array
return Buffer.from(this._uncompressed); // TODO: delete
}

/** @deprecated - use `PublicKey.toBytes()` instead. You may also need `Buffer.from`. */
get compressed(): Buffer {
return Buffer.from(this.data); // TODO: Uint8Array
return Buffer.from(this.data); // TODO: delete
}

constructor(data: Uint8Array) {
Expand Down
6 changes: 3 additions & 3 deletions tests-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"eciesjs": "file:.."
},
"devDependencies": {
"@vitest/browser": "^2.1.4",
"playwright": "^1.48.2",
"vitest": "^2.1.4"
"@vitest/browser": "^2.1.8",
"playwright": "^1.49.0",
"vitest": "^2.1.8"
}
}
17 changes: 13 additions & 4 deletions tests/crypt/random.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@ import { describe, expect, it } from "vitest";

import { bytesToHex } from "@noble/ciphers/utils";

import { ECIES_CONFIG, PrivateKey, decrypt, encrypt } from "../../src";
import {
ECIES_CONFIG,
PrivateKey,
decrypt as _decrypt,
encrypt as _encrypt,
} from "../../src";
import { EllipticCurve } from "../../src/config";

const encoder = new TextEncoder();
const TEXT = encoder.encode("hello world🌍");
const decrypt = (sk: Buffer | string, msg: Uint8Array) =>
Uint8Array.from(_decrypt(sk, msg));
const encrypt = (pk: Uint8Array | string, msg: Uint8Array) =>
Uint8Array.from(_encrypt(pk, msg));

interface TestParameter {
curve: EllipticCurve;
Expand Down Expand Up @@ -61,17 +70,17 @@ describe.each(params)(

function checkCompressed(sk: PrivateKey) {
const encrypted = encrypt(sk.publicKey.toBytes(), TEXT);
expect(decrypt(sk.secret, encrypted)).toStrictEqual(Buffer.from(TEXT));
expect(decrypt(sk.secret, encrypted)).toStrictEqual(TEXT);
}

function checkUncompressed(sk: PrivateKey) {
const encrypted = encrypt(sk.publicKey.toBytes(false), TEXT);
expect(decrypt(sk.secret, encrypted)).toStrictEqual(Buffer.from(TEXT));
expect(decrypt(sk.secret, encrypted)).toStrictEqual(TEXT);
}

function checkHex(sk: PrivateKey) {
const encrypted = encrypt(sk.publicKey.toHex(), TEXT);
expect(decrypt(bytesToHex(sk.secret), encrypted)).toStrictEqual(Buffer.from(TEXT));
expect(decrypt(bytesToHex(sk.secret), encrypted)).toStrictEqual(TEXT);
}

function testRandom() {
Expand Down
2 changes: 0 additions & 2 deletions tests/keys/known.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ describe("test known keys", () => {

const k1 = new PrivateKey(two);
const k2 = new PrivateKey(three);
expect(k1.secret).toStrictEqual(Buffer.from(two));
expect(k2.secret).toStrictEqual(Buffer.from(three));

checkHkdf(
k1,
Expand Down
2 changes: 1 addition & 1 deletion tests/keys/random.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("test random keys", () => {
}

function checkHex(sk: PrivateKey, compressed: boolean) {
expect(Buffer.from(decodeHex(sk.toHex()))).toStrictEqual(sk.secret);
expect(new PrivateKey(decodeHex(sk.toHex()))).toStrictEqual(sk);
expect(PrivateKey.fromHex(sk.toHex())).toStrictEqual(sk);
expect(PublicKey.fromHex(sk.publicKey.toHex(compressed))).toStrictEqual(sk.publicKey);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/keys/validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ describe("test validation", () => {

const groupOrderIntMinus1 =
"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140";
expect(PrivateKey.fromHex(groupOrderIntMinus1).secret).toStrictEqual(
Buffer.from(decodeHex(groupOrderIntMinus1))
expect(PrivateKey.fromHex(groupOrderIntMinus1)).toStrictEqual(
new PrivateKey(decodeHex(groupOrderIntMinus1))
);

const groupOrderIntAdd1 =
Expand Down

0 comments on commit e362900

Please sign in to comment.