Skip to content

Commit

Permalink
docs: Update TS documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
microshine committed Sep 30, 2024
1 parent c7c021e commit 2feb2b6
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 41 deletions.
8 changes: 0 additions & 8 deletions packages/client/src/connection/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ export class Client extends EventEmitter {
* Return PIN for current session
*
* @returns
*
* @memberOf Client
*/
public async challenge() {
if (!this.cipher) {
Expand All @@ -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();
Expand All @@ -186,9 +181,6 @@ export class Client extends EventEmitter {

/**
* Request session authentication
*
*
* @memberOf Client
*/
public async login() {
const action = new proto.ServerLoginActionProto();
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/connection/challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 0 additions & 4 deletions packages/server/src/connection/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
11 changes: 4 additions & 7 deletions packages/server/src/connection/storages/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ export interface IdentityList {

/**
* Identity key storage base on @peculiar/webcrypto
*
* @export
* @class OpenSSLStorage
*/
export class FileStorage extends RatchetStorage {

Expand All @@ -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<void> {
const identityPath = FileStorage.STORAGE_NAME + "/identity.json";
Expand Down Expand Up @@ -146,7 +143,7 @@ export class FileStorage extends RatchetStorage {
return identity;
}

public async loadRemoteIdentity(key: string): Promise<RemoteIdentity| null> {
public async loadRemoteIdentity(key: string): Promise<RemoteIdentity | null> {
await this.loadRemote();
return this.remoteIdentities[key] || null;
}
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions packages/server/src/crypto/openssl/key_storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
25 changes: 10 additions & 15 deletions packages/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ export interface IServerOptions extends ServerOptions {

/**
* Local server
*
* @export
* @class LocalServer
* @extends {EventEmitter}
*/
export class LocalServer extends core.EventLogEmitter {

Expand All @@ -30,7 +26,6 @@ export class LocalServer extends core.EventLogEmitter {
* Server
*
* @type {Server}
* @memberof LocalServer
*/
public server: Server;
public sessions: Session[] = [];
Expand All @@ -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;
Expand Down

0 comments on commit 2feb2b6

Please sign in to comment.