*add plugin util types

This commit is contained in:
Derrick Hammer 2023-01-07 23:39:42 -05:00
parent 5a3226e0b9
commit e6941a34e2
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 16 additions and 0 deletions

View File

@ -5,7 +5,9 @@
"type": "module", "type": "module",
"devDependencies": { "devDependencies": {
"@lumeweb/cfg": "https://git.lumeweb.com/LumeWeb/cfg.git", "@lumeweb/cfg": "https://git.lumeweb.com/LumeWeb/cfg.git",
"@types/b4a": "^1.6.0",
"@types/node": "^18.11.17", "@types/node": "^18.11.17",
"c": "^1.1.1",
"express": "^4.18.1", "express": "^4.18.1",
"node-cache": "^5.1.2", "node-cache": "^5.1.2",
"prettier": "^2.8.1", "prettier": "^2.8.1",

View File

@ -5,6 +5,7 @@ import SSLManager from "./ssl.js";
import type { HDKey } from "micro-ed25519-hdkey"; import type { HDKey } from "micro-ed25519-hdkey";
import type Config from "@lumeweb/cfg"; import type Config from "@lumeweb/cfg";
import type { ProtocolManager } from "./swarm.js"; import type { ProtocolManager } from "./swarm.js";
import type { Util } from "./util.js";
export type PluginFunction = (api: PluginAPI) => Promise<void>; export type PluginFunction = (api: PluginAPI) => Promise<void>;
@ -27,6 +28,7 @@ export declare class PluginAPI extends EventEmitter2 {
server: RPCServer; server: RPCServer;
swarm: any; swarm: any;
}); });
get util(): Util;
get swarm(): any; get swarm(): any;
get config(): Config; get config(): Config;
get pluginConfig(): Config; get pluginConfig(): Config;

12
src/util.ts Normal file
View File

@ -0,0 +1,12 @@
import type b4a from "b4a";
import type c from "compact-encoding";
export declare class Util {
private _crypto;
get crypto(): Crypto;
get bufferEncoding(): typeof b4a;
get binaryEncoding(): typeof c;
}
export declare class Crypto {
createHash(data: string): Buffer;
}