From dd79fa80bc4a3f1b268912820c29f74b1337ced3 Mon Sep 17 00:00:00 2001 From: librelois <elois@ifee.fr> Date: Thu, 30 Apr 2020 17:24:15 +0200 Subject: [PATCH] [ref] neon: split index.d.ts into several files --- neon/lib/crypto.d.ts | 22 ++++++++++ neon/lib/index.d.ts | 101 +++++-------------------------------------- neon/lib/wot.d.ts | 70 ++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 89 deletions(-) create mode 100644 neon/lib/crypto.d.ts create mode 100644 neon/lib/wot.d.ts diff --git a/neon/lib/crypto.d.ts b/neon/lib/crypto.d.ts new file mode 100644 index 000000000..d1a18ea9a --- /dev/null +++ b/neon/lib/crypto.d.ts @@ -0,0 +1,22 @@ +/* tslint:disable */ + +export class KeyPairBuilder { + + static fromSeed(seed: Buffer): Ed25519Signator; + + static fromSecretKey(secretKey: string): Ed25519Signator; + + static random(): Ed25519Signator; +} + +export class Ed25519Signator { + + getPublicKey(): string; + + sign(message: Buffer | string): string; +} + +export function generateRandomSeed(): Buffer; +export function seedToSecretKey(seed: Buffer): string; +export function sha256(data: string): string; +export function verify(message: Buffer | string, sig: string, pubkey: string): boolean; diff --git a/neon/lib/index.d.ts b/neon/lib/index.d.ts index 7a5ef5ad4..227ff4931 100644 --- a/neon/lib/index.d.ts +++ b/neon/lib/index.d.ts @@ -1,91 +1,14 @@ /* tslint:disable */ -export class KeyPairBuilder { - - static fromSeed(seed: Buffer): Ed25519Signator; - - static fromSecretKey(secretKey: string): Ed25519Signator; - - static random(): Ed25519Signator; -} - -export class Ed25519Signator { - - getPublicKey(): string; - - sign(message: Buffer | string): string; -} - -export function generateRandomSeed(): Buffer; -export function seedToSecretKey(seed: Buffer): string; -export function sha256(data: string): string; -export function verify(message: Buffer | string, sig: string, pubkey: string): boolean; - -export class DetailedDistance { - nbSentries: number; - nbSuccess: number; - nbSuccessAtBorder: number; - nbReached: number; - nbReachedAtBorder: number; - isOutdistanced: number; -} - -export class WotBuilder { - static fromWot(wot: Wot): Wot; - - static fromFile(filePath: string): Wot; -} - -export class Wot { - constructor(maxCert: number); - - clear(): void; - - getMaxCert(): number; - - setMaxCert(maxCert: number): void; - - addNode(): number; - - removeNode(): number; - - getWoTSize(): number; - - isEnabled(node_id: number): boolean; - - getEnabled(): number[]; - - setEnabled(enabled: boolean, node_id: number): boolean; - - getDisabled(): number[]; - - getSentries(sentry_requirement: number): number[]; - - getNonSentries(sentry_requirement: number): number[]; - - addLink(source: number, target: number): number; - - existsLink(source: number, target: number): boolean; - - removeLink(source: number, target: number): number; - - isOutdistanced( - node_id: number, - sentry_requirement: number, - step_max: number, - x_percent: number - ): boolean; - - detailedDistance( - nde_id: number, - sentry_requirement: number, - step_max: number, - x_percent: number - ): DetailedDistance; - - getPaths(source: number, target: number, step_max: number): number[][]; - - writeInFile(file_path: string): boolean; - - dump(): string; -} +import * as _crypto from './crypto'; +import * as _wot from './wot'; + +export import KeyPairBuilder = _crypto.KeyPairBuilder; +export import Ed25519Signator = _crypto.Ed25519Signator; +export import generateRandomSeed = _crypto.generateRandomSeed; +export import seedToSecretKey = _crypto.seedToSecretKey; +export import sha256 = _crypto.sha256; +export import verify = _crypto.verify; + +export import Wot = _wot.Wot; +export import WotBuilder = _wot.WotBuilder; diff --git a/neon/lib/wot.d.ts b/neon/lib/wot.d.ts new file mode 100644 index 000000000..86ebf1264 --- /dev/null +++ b/neon/lib/wot.d.ts @@ -0,0 +1,70 @@ +/* tslint:disable */ + +export class DetailedDistance { + nbSentries: number; + nbSuccess: number; + nbSuccessAtBorder: number; + nbReached: number; + nbReachedAtBorder: number; + isOutdistanced: number; +} + +export class WotBuilder { + static fromWot(wot: Wot): Wot; + + static fromFile(filePath: string): Wot; +} + +export class Wot { + constructor(maxCert: number); + + clear(): void; + + getMaxCert(): number; + + setMaxCert(maxCert: number): void; + + addNode(): number; + + removeNode(): number; + + getWoTSize(): number; + + isEnabled(node_id: number): boolean; + + getEnabled(): number[]; + + setEnabled(enabled: boolean, node_id: number): boolean; + + getDisabled(): number[]; + + getSentries(sentry_requirement: number): number[]; + + getNonSentries(sentry_requirement: number): number[]; + + addLink(source: number, target: number): number; + + existsLink(source: number, target: number): boolean; + + removeLink(source: number, target: number): number; + + isOutdistanced( + node_id: number, + sentry_requirement: number, + step_max: number, + x_percent: number + ): boolean; + + detailedDistance( + nde_id: number, + sentry_requirement: number, + step_max: number, + x_percent: number + ): DetailedDistance; + + getPaths(source: number, target: number, step_max: number): number[][]; + + writeInFile(file_path: string): boolean; + + dump(): string; +} -- GitLab