diff --git a/dist/index.d.ts b/dist/index.d.ts index a55bfd8..3ac1b8b 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,3 +1,8 @@ +/// +import tls from "tls"; +import type { Logger } from "loglevel"; +import type { Ed25519Keypair, Err } from "libskynet"; +import type express from "express"; export interface RPCRequest { bypassCache?: boolean; module: string; @@ -25,6 +30,20 @@ export interface PluginAPI { registerMethod: (methodName: string, method: RPCMethod) => void; loadPlugin: (moduleName: string) => Promise; getMethods: () => string[]; + ssl: { + setContext: (context: tls.SecureContext) => void; + getContext: () => tls.SecureContext; + getSaved: (retry: boolean) => Promise; + set: (cert: IndependentFileSmall, key: IndependentFileSmall) => void; + get: () => SslData; + save: () => Promise; + }; + appRouter: { + get: () => express.Router; + set: (newRouter: express.Router) => void; + reset: () => void; + }; + logger: Logger; } export declare type PluginFunction = (api: PluginAPI) => Promise; export interface Plugin { @@ -36,4 +55,26 @@ export interface Plugin { export declare type RPCStreamHandler = ( stream: AsyncIterable ) => Promise; +export declare type OverwriteDataFn = (newData: Uint8Array) => Promise; +export declare type ReadDataFn = () => Promise<[Uint8Array, Err]>; +export interface IndependentFileSmallMetadata { + largestHistoricSize: bigint; +} +export interface IndependentFileSmall { + dataKey: Uint8Array; + fileData: Uint8Array; + inode: string; + keypair: Ed25519Keypair; + metadata: IndependentFileSmallMetadata; + revision: bigint; + seed: Uint8Array; + skylink: string; + viewKey: string; + overwriteData: OverwriteDataFn; + readData: ReadDataFn; +} +export interface SslData { + cert?: IndependentFileSmall; + key?: IndependentFileSmall; +} //# sourceMappingURL=index.d.ts.map diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index 82d0fdc..163c907 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,MAA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