New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ndn/endpoint

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ndn/endpoint - npm Package Compare versions

Comparing version 0.0.20200606 to 0.0.20200909

lib/consumer_browser.js

31

lib/consumer.d.ts
import { Forwarder } from "@ndn/fw";
import { Data, Interest } from "@ndn/packet";
import { Data, FwHint, Interest, NameLike, Verifier } from "@ndn/packet";
import PCancelable from "p-cancelable";
import { RetxPolicy } from "./retx";
declare type ModifyInterestFunc = (interest: Interest) => void;
interface ModifyInterestFields {
canBePrefix?: boolean;
mustBeFresh?: boolean;
fwHint?: FwHint;
lifetime?: number;
hopLimit?: number;
}
declare type ModifyInterest = ModifyInterestFunc | ModifyInterestFields;
export interface Options {
/** Description for debugging purpose. */
describe?: string;
/**
* Modify Interest according to specified options.
* Default is no modification.
*/
modifyInterest?: ModifyInterest;
/**
* Retransmission policy.
* Default is disabling retransmission.
*/
retx?: RetxPolicy;
describe?: string;
/**
* Data verifier.
* Default is no verification.
*/
verifier?: Verifier;
}

@@ -24,3 +48,4 @@ /**

/** Consume a single piece of Data. */
consume(interest: Interest, opts?: Options): Context;
consume(interestInput: Interest | NameLike, opts?: Options): Context;
}
export {};

@@ -1,2 +0,2 @@

import { Data, Interest } from "@ndn/packet";
import { Data, Interest, Signer } from "@ndn/packet";
/** Outgoing Data buffer for producer. */

@@ -22,7 +22,16 @@ export interface DataBuffer {

readonly store: DataStore;
constructor(store: DataStore, { ttl, dataSigner, }?: DataStoreBuffer.Options);
private readonly ttl;
constructor(store: DataStore, ttl?: number);
private readonly dataSigner?;
find(interest: Interest): Promise<Data | undefined>;
insert(...pkts: Data[]): Promise<void>;
}
export declare namespace DataStoreBuffer {
interface Options {
/** Data expiration time. Default is 60000ms. 0 means infinity. */
ttl?: number;
/** If specified, automatically sign Data packets unless already signed. */
dataSigner?: Signer;
}
}
export {};

3

lib/mod.d.ts
export type { RetxOptions, RetxPolicy } from "./retx";
export type { Context as ConsumerContext, Options as ConsumerOptions } from "./consumer";
export type { DataBuffer } from "./data-buffer";
export { DataStoreBuffer } from "./data-buffer";
export { DataBuffer, DataStoreBuffer } from "./data-buffer";
export type { Handler as ProducerHandler, Options as ProducerOptions, Producer } from "./producer";
export * from "./endpoint";
import { Forwarder, FwFace } from "@ndn/fw";
import { Data, Interest, Name, NameLike } from "@ndn/packet";
import { DataBuffer } from "./data-buffer";
import { Data, Interest, Name, NameLike, Signer } from "@ndn/packet";
import type { DataBuffer } from "./data-buffer";
/**

@@ -9,18 +9,33 @@ * Producer handler function.

*
* If Options.dataBuffer is provided, the handler can have access to the DataBuffer via
* producer.dataBuffer . The handler can return a Data to respond to the Interest, which is also
* inserted to the DataBuffer unless Options.autoBuffer is set to false. If the handler returns
* 'false', the Interest is used to query the DataBuffer, and any matching Data may be sent.
* If Options.dataBuffer is provided, the handler can access the DataBuffer via producer.dataBuffer .
* The handler can return a Data to respond to the Interest, which is also inserted to the DataBuffer
* unless Options.autoBuffer is set to false. If the handler returns 'false', the Interest is used
* to query the DataBuffer, and any matching Data may be sent.
*/
export declare type Handler = (interest: Interest, producer: Producer) => Promise<Data | false>;
export interface Options {
/** What name to be readvertised (ignored if prefix is unspecified). */
/** Description for debugging purpose. */
describe?: string;
/**
* What name to be readvertised.
* Ignored if prefix is undefined.
*/
announcement?: EndpointProducer.RouteAnnouncement;
/** How many Interests to process in parallel. */
/**
* How many Interests to process in parallel.
* Default is 1.
*/
concurrency?: number;
/** Description for debugging purpose. */
describe?: string;
/**
* If specified, automatically sign Data packets unless already signed.
* This does not apply to Data packets manually inserted to the dataBuffer.
*/
dataSigner?: Signer;
/** Outgoing Data buffer. */
dataBuffer?: DataBuffer;
/** Whether to add handler return value to buffer. Default is true. */
/**
* Whether to add handler return value to buffer.
* Default is true.
* Ignored when dataBuffer is not specified.
*/
autoBuffer?: boolean;

@@ -50,1 +65,2 @@ }

}
export declare function signUnsignedData(data: Data, dataSigner: Signer | undefined): Promise<void>;
{
"name": "@ndn/endpoint",
"version": "0.0.20200606",
"version": "0.0.20200909",
"description": "NDNts: Client Endpoint",

@@ -15,3 +15,4 @@ "keywords": [

"type": "module",
"main": "lib/mod.js",
"main": "lib/mod_node.js",
"module": "lib/mod_browser.js",
"sideEffects": false,

@@ -25,5 +26,5 @@ "homepage": "https://yoursunny.com/p/NDNts/",

"dependencies": {
"@ndn/fw": "0.0.20200606",
"@ndn/packet": "0.0.20200606",
"@ndn/tlv": "0.0.20200606",
"@ndn/fw": "0.0.20200909",
"@ndn/packet": "0.0.20200909",
"@ndn/tlv": "0.0.20200909",
"applymixins": "^1.1.0",

@@ -33,5 +34,6 @@ "it-pushable": "^1.4.0",

"p-cancelable": "^2.0.0",
"streaming-iterables": "^4.1.2",
"tslib": "*"
}
"streaming-iterables": "^5.0.2",
"tslib": "^2.0.1"
},
"types": "lib/mod.d.ts"
}

@@ -9,3 +9,3 @@ # @ndn/endpoint

* [ ] Outgoing packets are signed and incoming packets are verified, if trust schema is provided.
* [X] Outgoing packets are signed and incoming packets are verified, if trust schema is provided.
* [X] Outgoing Interests are retransmitted periodically, if retransmission policy is specified.

@@ -12,0 +12,0 @@ * [X] Outgoing Data buffer, if enabled, allows the producer to reply to one Interest with multiple Data (e.g. segments), or push generated Data without receiving an Interest.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc