Skip to content

Commit

Permalink
Merge pull request #416 from dajiaji/remove-is-node
Browse files Browse the repository at this point in the history
Remove duplicated isNode.
  • Loading branch information
dajiaji authored Oct 7, 2024
2 parents 25a9a33 + 5e397a9 commit 6caf245
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/hpke-js/test/conformance.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { afterAll, beforeAll, describe, it } from "@std/testing/bdd";

import { isNode } from "@hpke/common";

import type { ConformanceTester } from "./conformanceTester.ts";
import type { TestVector } from "./testVector.ts";

import { createConformanceTester } from "./conformanceTester.ts";
import { getPath, isNode } from "./utils.ts";
import { getPath } from "./utils.ts";

describe("RFC9180 conformance", () => {
let testVectors: TestVector[];
Expand Down
3 changes: 1 addition & 2 deletions packages/hpke-js/test/dhkemPrimitives.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { assertEquals, assertRejects } from "@std/assert";
import { describe, it } from "@std/testing/bdd";

import { DeserializeError, Ec, KemId } from "@hpke/common";
import { DeserializeError, Ec, isNode, KemId } from "@hpke/common";
import { HkdfSha256, X25519 } from "@hpke/dhkem-x25519";
import { HkdfSha512, X448 } from "@hpke/dhkem-x448";

import { HkdfSha384 } from "../src/kdfs/hkdfSha384.ts";
import { isNode } from "./utils.ts";

describe("derivePublicKey", () => {
describe("with valid parameters", () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/hpke-js/test/keyValidationEc.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { afterAll, beforeAll, describe, it } from "@std/testing/bdd";

import { isNode } from "@hpke/common";

import type { ConformanceTester } from "./conformanceTester.ts";
import type { WycheproofTestVector } from "./testVector.ts";

import { createConformanceTester } from "./conformanceTester.ts";
import { getPath, isNode } from "./utils.ts";
import { getPath } from "./utils.ts";

describe("EC key validation", () => {
let totalCount: number;
Expand Down
3 changes: 1 addition & 2 deletions packages/hpke-js/test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { dirname, fromFileUrl, join } from "@std/path";

// deno-lint-ignore no-explicit-any
export const isNode = () => (globalThis as any).process?.versions?.node != null;
import { isNode } from "@hpke/common";

export function getPath(name: string): string {
const currentPath = dirname(fromFileUrl(import.meta.url));
Expand Down

0 comments on commit 6caf245

Please sign in to comment.