mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-04-25 06:02:21 +00:00
fix: typescript types (#69)
This commit is contained in:
parent
14d09970ca
commit
269a6f5e0a
7
src/pubsub/errors.d.ts
vendored
7
src/pubsub/errors.d.ts
vendored
@ -1,4 +1,11 @@
|
|||||||
export namespace codes {
|
export namespace codes {
|
||||||
|
export const ERR_INVALID_SIGNATURE_POLICY: string;
|
||||||
|
export const ERR_UNHANDLED_SIGNATURE_POLICY: string;
|
||||||
export const ERR_MISSING_SIGNATURE: string;
|
export const ERR_MISSING_SIGNATURE: string;
|
||||||
|
export const ERR_MISSING_SEQNO: string;
|
||||||
export const ERR_INVALID_SIGNATURE: string;
|
export const ERR_INVALID_SIGNATURE: string;
|
||||||
|
export const ERR_UNEXPECTED_FROM: string;
|
||||||
|
export const ERR_UNEXPECTED_SIGNATURE: string;
|
||||||
|
export const ERR_UNEXPECTED_KEY: string;
|
||||||
|
export const ERR_UNEXPECTED_SEQNO: string;
|
||||||
}
|
}
|
||||||
|
22
src/pubsub/index.d.ts
vendored
22
src/pubsub/index.d.ts
vendored
@ -22,18 +22,16 @@ declare class PubsubBaseProtocol {
|
|||||||
* @param {String} props.debugName log namespace
|
* @param {String} props.debugName log namespace
|
||||||
* @param {Array<string>|string} props.multicodecs protocol identificers to connect
|
* @param {Array<string>|string} props.multicodecs protocol identificers to connect
|
||||||
* @param {Libp2p} props.libp2p
|
* @param {Libp2p} props.libp2p
|
||||||
* @param {boolean} [props.signMessages = true] if messages should be signed
|
* @param {SignaturePolicy} [props.globalSignaturePolicy = SignaturePolicy.StrictSign] defines how signatures should be handled
|
||||||
* @param {boolean} [props.strictSigning = true] if message signing should be required
|
|
||||||
* @param {boolean} [props.canRelayMessage = false] if can relay messages not subscribed
|
* @param {boolean} [props.canRelayMessage = false] if can relay messages not subscribed
|
||||||
* @param {boolean} [props.emitSelf = false] if publish should emit to self, if subscribed
|
* @param {boolean} [props.emitSelf = false] if publish should emit to self, if subscribed
|
||||||
* @abstract
|
* @abstract
|
||||||
*/
|
*/
|
||||||
constructor({ debugName, multicodecs, libp2p, signMessages, strictSigning, canRelayMessage, emitSelf }: {
|
constructor({ debugName, multicodecs, libp2p, globalSignaturePolicy, canRelayMessage, emitSelf }: {
|
||||||
debugName: string;
|
debugName: string;
|
||||||
multicodecs: string | string[];
|
multicodecs: string | string[];
|
||||||
libp2p: any;
|
libp2p: any;
|
||||||
signMessages?: boolean;
|
globalSignaturePolicy?: any;
|
||||||
strictSigning?: boolean;
|
|
||||||
canRelayMessage?: boolean;
|
canRelayMessage?: boolean;
|
||||||
emitSelf?: boolean;
|
emitSelf?: boolean;
|
||||||
});
|
});
|
||||||
@ -66,12 +64,12 @@ declare class PubsubBaseProtocol {
|
|||||||
* @type {Map<string, import('./peer-streams')>}
|
* @type {Map<string, import('./peer-streams')>}
|
||||||
*/
|
*/
|
||||||
peers: Map<string, import('./peer-streams')>;
|
peers: Map<string, import('./peer-streams')>;
|
||||||
signMessages: boolean;
|
|
||||||
/**
|
/**
|
||||||
* If message signing should be required for incoming messages
|
* The signature policy to follow by default
|
||||||
* @type {boolean}
|
*
|
||||||
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
strictSigning: boolean;
|
globalSignaturePolicy: string;
|
||||||
/**
|
/**
|
||||||
* If router can relay received messages, even if not subscribed
|
* If router can relay received messages, even if not subscribed
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
@ -284,7 +282,7 @@ declare class PubsubBaseProtocol {
|
|||||||
getTopics(): string[];
|
getTopics(): string[];
|
||||||
}
|
}
|
||||||
declare namespace PubsubBaseProtocol {
|
declare namespace PubsubBaseProtocol {
|
||||||
export { message, utils, InMessage, PeerId };
|
export { message, utils, SignaturePolicy, InMessage, PeerId };
|
||||||
}
|
}
|
||||||
type PeerId = import("peer-id");
|
type PeerId = import("peer-id");
|
||||||
/**
|
/**
|
||||||
@ -305,3 +303,7 @@ type InMessage = {
|
|||||||
*/
|
*/
|
||||||
declare const message: typeof import('./message');
|
declare const message: typeof import('./message');
|
||||||
declare const utils: typeof import("./utils");
|
declare const utils: typeof import("./utils");
|
||||||
|
declare const SignaturePolicy: {
|
||||||
|
StrictSign: string;
|
||||||
|
StrictNoSign: string;
|
||||||
|
};
|
||||||
|
@ -116,7 +116,7 @@ class PubsubBaseProtocol extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* The signature policy to follow by default
|
* The signature policy to follow by default
|
||||||
*
|
*
|
||||||
* @type {SignaturePolicy}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.globalSignaturePolicy = globalSignaturePolicy
|
this.globalSignaturePolicy = globalSignaturePolicy
|
||||||
|
|
||||||
|
4
src/pubsub/signature-policy.d.ts
vendored
Normal file
4
src/pubsub/signature-policy.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export namespace SignaturePolicy {
|
||||||
|
export const StrictSign: string;
|
||||||
|
export const StrictNoSign: string;
|
||||||
|
}
|
1
src/pubsub/utils.d.ts
vendored
1
src/pubsub/utils.d.ts
vendored
@ -1,5 +1,6 @@
|
|||||||
export function randomSeqno(): Uint8Array;
|
export function randomSeqno(): Uint8Array;
|
||||||
export function msgId(from: string, seqno: Uint8Array): Uint8Array;
|
export function msgId(from: string, seqno: Uint8Array): Uint8Array;
|
||||||
|
export function noSignMsgId(data: Uint8Array): Uint8Array;
|
||||||
export function anyMatch(a: any[] | Set<any>, b: any[] | Set<any>): boolean;
|
export function anyMatch(a: any[] | Set<any>, b: any[] | Set<any>): boolean;
|
||||||
export function ensureArray(maybeArray: any): any[];
|
export function ensureArray(maybeArray: any): any[];
|
||||||
export function normalizeInRpcMessage(message: any, peerId: string): any;
|
export function normalizeInRpcMessage(message: any, peerId: string): any;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user