From 2feb2b6a74d0f909263081e548654bf3f1e1262a Mon Sep 17 00:00:00 2001 From: microshine Date: Mon, 30 Sep 2024 21:50:29 +0200 Subject: [PATCH] docs: Update TS documentation --- packages/client/src/connection/client.ts | 8 ------ packages/core/src/connection/challenge.ts | 5 ++-- packages/server/src/connection/server.ts | 4 --- .../server/src/connection/storages/file.ts | 11 +++----- .../server/src/crypto/openssl/key_storage.ts | 5 +--- packages/server/src/server.ts | 25 ++++++++----------- 6 files changed, 17 insertions(+), 41 deletions(-) diff --git a/packages/client/src/connection/client.ts b/packages/client/src/connection/client.ts index d1ac4982..fbc3f530 100644 --- a/packages/client/src/connection/client.ts +++ b/packages/client/src/connection/client.ts @@ -161,8 +161,6 @@ export class Client extends EventEmitter { * Return PIN for current session * * @returns - * - * @memberOf Client */ public async challenge() { if (!this.cipher) { @@ -173,9 +171,6 @@ export class Client extends EventEmitter { /** * Returns true if session is authorized - * - * - * @memberOf Client */ public async isLoggedIn() { const action = new proto.ServerIsLoggedInActionProto(); @@ -186,9 +181,6 @@ export class Client extends EventEmitter { /** * Request session authentication - * - * - * @memberOf Client */ public async login() { const action = new proto.ServerLoginActionProto(); diff --git a/packages/core/src/connection/challenge.ts b/packages/core/src/connection/challenge.ts index 313a2130..39844210 100644 --- a/packages/core/src/connection/challenge.ts +++ b/packages/core/src/connection/challenge.ts @@ -4,9 +4,8 @@ import { Convert } from "pvtsutils"; /** * Generates 6 digit string from server's identity and client's identity keys. * - * @export - * @param {ECPublicKey} serverIdentity Server's identity public key - * @param {ECPublicKey} clientIdentity Client's identity public key + * @param serverIdentity Server's identity public key + * @param clientIdentity Client's identity public key * @returns */ export async function challenge(serverIdentity: ECPublicKey, clientIdentity: ECPublicKey) { diff --git a/packages/server/src/connection/server.ts b/packages/server/src/connection/server.ts index bb085d82..b1a0407e 100644 --- a/packages/server/src/connection/server.ts +++ b/packages/server/src/connection/server.ts @@ -63,10 +63,6 @@ export interface Session { * - generates Identity * - store makes PreKey bundle * - Stores secure sessions - * - * @export - * @class Server - * @extends {EventEmitter} */ export class Server extends core.EventLogEmitter { diff --git a/packages/server/src/connection/storages/file.ts b/packages/server/src/connection/storages/file.ts index 7414ea78..81047759 100644 --- a/packages/server/src/connection/storages/file.ts +++ b/packages/server/src/connection/storages/file.ts @@ -36,9 +36,6 @@ export interface IdentityList { /** * Identity key storage base on @peculiar/webcrypto - * - * @export - * @class OpenSSLStorage */ export class FileStorage extends RatchetStorage { @@ -51,8 +48,8 @@ export class FileStorage extends RatchetStorage { /** * Associative array of remote identities */ - public remoteIdentities: { [key: string]: RemoteIdentity } = {}; - public sessions: { [key: string]: ratchet.AsymmetricRatchet } = {}; + public remoteIdentities: { [key: string]: RemoteIdentity; } = {}; + public sessions: { [key: string]: ratchet.AsymmetricRatchet; } = {}; public async loadIdentities(): Promise { const identityPath = FileStorage.STORAGE_NAME + "/identity.json"; @@ -146,7 +143,7 @@ export class FileStorage extends RatchetStorage { return identity; } - public async loadRemoteIdentity(key: string): Promise { + public async loadRemoteIdentity(key: string): Promise { await this.loadRemote(); return this.remoteIdentities[key] || null; } @@ -180,7 +177,7 @@ export class FileStorage extends RatchetStorage { return null; } - protected async ecKeyToBase64(key: CryptoKey) { + protected async ecKeyToBase64(key: CryptoKey) { const oldValue = key.extractable; try { (key as any).extractable = true; diff --git a/packages/server/src/crypto/openssl/key_storage.ts b/packages/server/src/crypto/openssl/key_storage.ts index caec5fe0..87f0ac40 100755 --- a/packages/server/src/crypto/openssl/key_storage.ts +++ b/packages/server/src/crypto/openssl/key_storage.ts @@ -98,11 +98,8 @@ export class OpenSSLKeyStorage implements core.CryptoKeyStorage { * - public/private key's hex = SHA-256(spki) * - secret key's hex = SHA-256(RND(32)) * - * @protected - * @param {CryptoKey} key + * @param key * @returns - * - * @memberOf OpenSSLKeyStorage */ protected async getID(key: CryptoKey) { const nativeKey = (key as any).native; diff --git a/packages/server/src/server.ts b/packages/server/src/server.ts index abf7fb92..bb2e574a 100755 --- a/packages/server/src/server.ts +++ b/packages/server/src/server.ts @@ -17,10 +17,6 @@ export interface IServerOptions extends ServerOptions { /** * Local server - * - * @export - * @class LocalServer - * @extends {EventEmitter} */ export class LocalServer extends core.EventLogEmitter { @@ -30,7 +26,6 @@ export class LocalServer extends core.EventLogEmitter { * Server * * @type {Server} - * @memberof LocalServer */ public server: Server; public sessions: Session[] = []; @@ -44,16 +39,16 @@ export class LocalServer extends core.EventLogEmitter { this.server = new Server(options); if (!options.disablePCSC) { - // The CardReaderService is disabled because it is not used on the client side, - // but it duplicates log entries for PCSCWatcher. - - // this.cardReader = new CardReaderService(this.server) - // .on("info", (level, source, message, data) => { - // this.emit("info", level, source, message, data); - // }) - // .on("error", (e) => { - // this.emit("error", e); - // }); + // The CardReaderService is disabled because it is not used on the client side, + // but it duplicates log entries for PCSCWatcher. + + // this.cardReader = new CardReaderService(this.server) + // .on("info", (level, source, message, data) => { + // this.emit("info", level, source, message, data); + // }) + // .on("error", (e) => { + // this.emit("error", e); + // }); } else { // Disable PCSC for provider too options.config.disablePCSC = true;