Compare commits

..

No commits in common. "v0.0.2-develop.1" and "v0.0.1" have entirely different histories.

12 changed files with 1 additions and 19944 deletions

View File

@ -1,13 +0,0 @@
name: Build/Publish
on:
push:
branches:
- master
- develop
- develop-*
jobs:
main:
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
secrets: inherit

View File

@ -1,5 +0,0 @@
{
"preset": [
"@lumeweb/node-library-preset"
]
}

View File

@ -1 +0,0 @@
## [0.0.2-develop.1](https://git.lumeweb.com/LumeWeb/interface-relay/compare/v0.0.1...v0.0.2-develop.1) (2023-07-04)

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2022 Hammmer Technologies LLC Copyright (c) 2022 Lume Web
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

19731
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +0,0 @@
{
"name": "@lumeweb/interface-relay",
"version": "0.0.2-develop.1",
"main": "lib/index.js",
"type": "module",
"types": "lib/index.d.ts",
"repository": {
"type": "git",
"url": "gitea@git.lumeweb.com:LumeWeb/interface-relay.git"
},
"devDependencies": {
"@lumeweb/node-library-preset": "^0.2.7",
"@types/b4a": "^1.6.0",
"compact-encoding": "^2.12.0",
"ed25519-keygen": "^0.4.1",
"eventemitter2": "^6.4.9",
"fastify": "^4.19.2",
"node-cache": "^5.1.2",
"presetter": "*"
},
"readme": "ERROR: No README data found!",
"scripts": {
"prepare": "presetter bootstrap",
"build": "run build",
"semantic-release": "semantic-release"
},
"dependencies": {
"@lumeweb/relay-cfg": "0.1.9"
},
"publishConfig": {
"access": "public"
},
"files": [
"lib"
]
}

View File

@ -1,3 +0,0 @@
export * from "./rpc.js";
export * from "./plugin.js";
export * from "./swarm.js";

View File

@ -1,45 +0,0 @@
import type { EventEmitter2 } from "eventemitter2";
import type { RPCMethod, RPCServer } from "./rpc.js";
import type { Logger } from "pino";
import type SSLManager from "./ssl.js";
import type { HDKey } from "ed25519-keygen/hdkey";
import type { Config } from "@lumeweb/relay-cfg";
import type { ProtocolManager } from "./swarm.js";
import type { Util } from "./util.js";
import type { FastifyInstance } from "fastify";
export type PluginFunction = (api: PluginAPI) => Promise<void>;
export interface Plugin {
name: string;
plugin: PluginFunction;
exports?: any;
default?: Plugin;
}
export declare class PluginAPI extends EventEmitter2 {
constructor({
config,
logger,
server,
swarm,
}: {
config: Config;
logger: Logger;
server: RPCServer;
swarm: any;
});
get util(): Util;
get swarm(): any;
get config(): Config;
get pluginConfig(): Config;
get logger(): Logger;
get rpcServer(): RPCServer;
get seed(): Uint8Array;
get identity(): HDKey;
get ssl(): SSLManager;
get protocols(): ProtocolManager;
get app(): FastifyInstance;
loadPlugin(moduleName: string): (moduleName: string) => Promise<Plugin>;
registerMethod(methodName: string, method: RPCMethod): void;
}

View File

@ -1,66 +0,0 @@
import type EventEmitter from "events";
import type NodeCache from "node-cache";
export interface RPCRequest {
module: string;
method: string;
data: any;
}
export interface ClientRPCRequest extends RPCRequest {
bypassCache?: boolean;
}
export interface RPCResponse {
updated?: number;
data?: any | RPCResponse;
error?: string;
signature?: string;
signedField?: string;
}
export interface RPCMethod {
cacheable: boolean;
handler: (req: any) => Promise<any>;
}
export interface RPCCacheData {
[query: string]: RPCCacheItem | null;
}
export interface RPCCacheItem extends RPCResponse {
value: RPCResponse;
signature: string;
}
export interface RPCBroadcastRequest {
request: RPCRequest;
relays: string[];
timeout: number;
}
export interface RPCBroadcastResponse extends RPCResponse {
relays: { [relay: string]: RPCResponse };
}
export declare class RPCServer extends EventEmitter {
get cache(): RPCCache;
registerMethod(
moduleName: string,
methodName: string,
options: RPCMethod,
): void;
public getMethods(): string[];
public setup(stream: any): any;
public signData(data: any): string;
public static hashQuery(query: RPCRequest): string;
public handleRequest(request: RPCRequest): Promise<RPCResponse>;
}
export declare class RPCCache extends EventEmitter {
get data(): NodeCache;
constructor(server: RPCServer);
public signResponse(item: RPCCacheItem): any;
public verifyResponse(pubkey: Buffer, item: RPCCacheItem): boolean | Buffer;
public addItem(query: RPCRequest, response: RPCResponse): void;
public deleteItem(queryHash: string): boolean;
}

View File

@ -1,25 +0,0 @@
import type tls from "tls";
export type SSLManagerRenewHandler = (domain: string) => Promise<boolean>;
export type SSLCert = string | Buffer | Array<string | Buffer>;
declare class SSLManager {
constructor(domain: string);
get context(): tls.SecureContext;
set privateKey(key: Buffer);
set cert(cert: SSLCert);
renew(): Promise<boolean>;
get enabled(): boolean;
get ready(): boolean;
get renewHandler(): SSLManagerRenewHandler;
set renewHandler(value: SSLManagerRenewHandler);
}
export default SSLManager;

View File

@ -1,6 +0,0 @@
export type ProtocolHandler = (peer: any, muxer: any) => void;
export declare class ProtocolManager {
constructor(swarm: any);
register(name: string, handler: ProtocolHandler): boolean;
}

View File

@ -1,12 +0,0 @@
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;
}