Compare commits
76 Commits
v0.0.1
...
v0.0.2-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | a3396e438d | |
Derrick Hammer | eed6804640 | |
Derrick Hammer | 66d2112d2f | |
Derrick Hammer | 830a349d6c | |
Derrick Hammer | 78a58db9c0 | |
Derrick Hammer | 21341f6af4 | |
Derrick Hammer | 0030db4237 | |
Derrick Hammer | 9401b0420c | |
Derrick Hammer | 8bad551b29 | |
Derrick Hammer | 4995bdcefe | |
Derrick Hammer | 3231c18e08 | |
Derrick Hammer | 3ae45da896 | |
Derrick Hammer | b1d11e4d1c | |
Derrick Hammer | 4f7a3bf728 | |
Derrick Hammer | 4e460a182d | |
Derrick Hammer | 65211fe144 | |
Derrick Hammer | e6941a34e2 | |
Derrick Hammer | 5a3226e0b9 | |
Derrick Hammer | 6bcb61e3c6 | |
Derrick Hammer | 7c3c193b4a | |
Derrick Hammer | baf8ebd511 | |
Derrick Hammer | 815c7a824c | |
Derrick Hammer | 0d6219837a | |
Derrick Hammer | c476a94b0e | |
Derrick Hammer | b5b1a8bbb9 | |
Derrick Hammer | f1da2249ac | |
Derrick Hammer | 632bd19635 | |
Derrick Hammer | b139bba69a | |
Derrick Hammer | b3519688d4 | |
Derrick Hammer | 6da33f1352 | |
Derrick Hammer | a4c4920839 | |
Derrick Hammer | 66c879033a | |
Derrick Hammer | f105bab780 | |
Derrick Hammer | 5242c16367 | |
Derrick Hammer | 2d7bed64d5 | |
Derrick Hammer | 998076824d | |
Derrick Hammer | 2f3ca517b3 | |
Derrick Hammer | 298d043b39 | |
Derrick Hammer | ae10937bb8 | |
Derrick Hammer | 33b87a1075 | |
Derrick Hammer | e8d4c0c756 | |
Derrick Hammer | 90beb40785 | |
Derrick Hammer | b6ea4e687c | |
Derrick Hammer | 75bb30db99 | |
Derrick Hammer | e95e8d830f | |
Derrick Hammer | 4c618a311d | |
Derrick Hammer | 516e82b7c1 | |
Derrick Hammer | 4c04f4b11a | |
Derrick Hammer | efcc37871d | |
Derrick Hammer | 83b831b621 | |
Derrick Hammer | b02c78fcb6 | |
Derrick Hammer | c21fa3ea15 | |
Derrick Hammer | 54ef04d959 | |
Derrick Hammer | cd8e8c6489 | |
Derrick Hammer | 14cfb55f85 | |
Derrick Hammer | ce5e713f6a | |
Derrick Hammer | d435344353 | |
Derrick Hammer | 568dd8ff9b | |
Derrick Hammer | b04f609592 | |
Derrick Hammer | 727dffed67 | |
Derrick Hammer | bc75b57397 | |
Derrick Hammer | bc6d683477 | |
Derrick Hammer | 24aa7201e2 | |
Derrick Hammer | 3bf6ccb1f0 | |
Derrick Hammer | 56a54b48ae | |
Derrick Hammer | 789542e2a6 | |
Derrick Hammer | 17fa55f156 | |
Derrick Hammer | 648c366b6d | |
Derrick Hammer | 9768e2dc9d | |
Derrick Hammer | a9e069bafe | |
Derrick Hammer | ea7a23e824 | |
Derrick Hammer | d94c3c8e5a | |
Derrick Hammer | 1a77bb0469 | |
Derrick Hammer | 6a91a5f4fd | |
Derrick Hammer | 890d593cff | |
Derrick Hammer | eb2d441670 |
|
@ -0,0 +1,13 @@
|
||||||
|
name: Build/Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
- develop-*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
main:
|
||||||
|
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
|
||||||
|
secrets: inherit
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"preset": [
|
||||||
|
"@lumeweb/node-library-preset"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
## [0.0.2-develop.1](https://git.lumeweb.com/LumeWeb/interface-relay/compare/v0.0.1...v0.0.2-develop.1) (2023-07-04)
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2022 Lume Web
|
Copyright (c) 2022 Hammmer Technologies LLC
|
||||||
|
|
||||||
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
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"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"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
export * from "./rpc.js";
|
||||||
|
export * from "./plugin.js";
|
||||||
|
export * from "./swarm.js";
|
|
@ -0,0 +1,45 @@
|
||||||
|
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;
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
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;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
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;
|
|
@ -0,0 +1,6 @@
|
||||||
|
export type ProtocolHandler = (peer: any, muxer: any) => void;
|
||||||
|
|
||||||
|
export declare class ProtocolManager {
|
||||||
|
constructor(swarm: any);
|
||||||
|
register(name: string, handler: ProtocolHandler): boolean;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue