mirror of https://github.com/waku-org/js-waku.git
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:
parent
e8efd5e962
commit
e65e0a0a80
|
@ -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.
|
||||||
*/
|
*/
|
|
@ -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 } = {
|
|
@ -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,
|
|
@ -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");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue