refactor: move module that define cryptographic operations to crypto/

This is to prepare the split of encoder/decoder/message definition
from index.ts.
This commit is contained in:
fryorcraken.eth 2022-11-23 16:38:19 +11:00
parent e8efd5e962
commit e65e0a0a80
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
4 changed files with 8 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import * as secp from "@noble/secp256k1"; import * as secp from "@noble/secp256k1";
import { concat, hexToBytes } from "@waku/byte-utils"; import { concat, hexToBytes } from "@waku/byte-utils";
import { getSubtle, randomBytes, sha256 } from "./crypto.js"; import { getSubtle, randomBytes, sha256 } from "./index.js";
/** /**
* HKDF as implemented in go-ethereum. * HKDF as implemented in go-ethereum.
*/ */

View File

@ -4,7 +4,7 @@ import * as secp from "@noble/secp256k1";
import { concat } from "@waku/byte-utils"; import { concat } from "@waku/byte-utils";
import sha3 from "js-sha3"; import sha3 from "js-sha3";
import { Asymmetric, Symmetric } from "./constants.js"; import { Asymmetric, Symmetric } from "../constants.js";
declare const self: Record<string, any> | undefined; declare const self: Record<string, any> | undefined;
const crypto: { node?: any; web?: any } = { const crypto: { node?: any; web?: any } = {

View File

@ -1,5 +1,6 @@
import { Symmetric } from "./constants.js"; import { Symmetric } from "../constants.js";
import { getSubtle, randomBytes } from "./crypto.js";
import { getSubtle, randomBytes } from "./index.js";
export async function encrypt( export async function encrypt(
iv: Uint8Array, iv: Uint8Array,

View File

@ -15,6 +15,7 @@ import type {
import debug from "debug"; import debug from "debug";
import { Symmetric } from "./constants.js"; import { Symmetric } from "./constants.js";
import * as ecies from "./crypto/ecies.js";
import { import {
generatePrivateKey, generatePrivateKey,
generateSymmetricKey, generateSymmetricKey,
@ -22,9 +23,8 @@ import {
keccak256, keccak256,
randomBytes, randomBytes,
sign, sign,
} from "./crypto.js"; } from "./crypto/index.js";
import * as ecies from "./ecies.js"; import * as symmetric from "./crypto/symmetric.js";
import * as symmetric from "./symmetric.js";
const log = debug("waku:message:version-1"); const log = debug("waku:message:version-1");