Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename DAPClient to Task #409

Merged
merged 3 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ The `main` branch is under continuous development and will usually be partway be
## Usage

```typescript
import DAPClient from "@divviup/dap";
import Task from "@divviup/dap";

const client = new DAPClient({
const task = new Task({
type: "sum",
bits: 8,
taskId: "3XTBHxTtUAtI516GeXZsVIKjBPYVNIYmF94vEBb4jcY",
id: "3XTBHxTtUAtI516GeXZsVIKjBPYVNIYmF94vEBb4jcY",
leader: "http://localhost:8080",
helper: "http://localhost:8081",
timePrecisionSeconds: 3600,
});

await client.sendMeasurement(42);
await task.sendMeasurement(42);
```
6 changes: 3 additions & 3 deletions packages/dap/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export { DAPClient, DAPClient as default } from "./client.js";
export { Task, Task as default } from "./task.js";
export { DAPError } from "./errors.js";
export type { ReportOptions } from "./client.js";
export type { KnownVdafSpec, VdafMeasurement } from "./client.js";
export type { ReportOptions } from "./task.js";
export type { KnownVdafSpec, VdafMeasurement } from "./task.js";
export { TaskId } from "./taskId.js";
export { HpkeConfig } from "./hpkeConfig.js";
4 changes: 2 additions & 2 deletions packages/dap/src/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { Extension } from "./extension.js";

export class ReportMetadata implements Encodable {
constructor(
public reportID: ReportId,
public reportId: ReportId,
public time: number,
) {}

encode(): Buffer {
const buffer = Buffer.alloc(24);
this.reportID.encode().copy(buffer, 0);
this.reportId.encode().copy(buffer, 0);
buffer.writeUInt32BE(this.time, 16 + 4);
return buffer;
}
Expand Down
Loading