Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
trungnotchung committed Dec 16, 2024
1 parent c61b421 commit 8de10bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions packages/node/src/handlers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Stream } from "@libp2p/interface";
import { NetworkPb, streamToUint8Array } from "@ts-drp/network";
import type { DRP, DRPObject, ObjectPb, Vertex } from "@ts-drp/object";
import type { DRP, DRPObject, ObjectPb } from "@ts-drp/object";
import { type DRPNode, log } from "./index.js";
import { verifySignature } from "./utils/vertexSignature.js";

Expand Down Expand Up @@ -132,7 +132,7 @@ function syncAcceptHandler(node: DRPNode, sender: string, data: Uint8Array) {
return;
}

const verifiedVertices: Vertex[] = verifyIncomingVertices(
const verifiedVertices: ObjectPb.Vertex[] = verifyIncomingVertices(
object,
syncAcceptMessage.requested,
);
Expand Down Expand Up @@ -208,9 +208,9 @@ export function drpObjectChangesHandler(

export function verifyIncomingVertices(
object: DRPObject,
incomingVertices: Vertex[],
): Vertex[] {
const vertices: Vertex[] = incomingVertices.map((vertex) => {
incomingVertices: ObjectPb.Vertex[],
): ObjectPb.Vertex[] {
const vertices: ObjectPb.Vertex[] = incomingVertices.map((vertex) => {
return {
hash: vertex.hash,
nodeId: vertex.nodeId,
Expand All @@ -228,7 +228,7 @@ export function verifyIncomingVertices(
return vertices;
}
const acl = drp.accessControl;
const verifiedVertices: Vertex[] = vertices.filter((vertex) => {
const verifiedVertices: ObjectPb.Vertex[] = vertices.filter((vertex) => {
const signature = vertex.signature;
if (!signature) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/utils/vertexSignature.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSign, createVerify } from "node:crypto";
import type { Operation, Vertex } from "@ts-drp/object";
import type { Operation } from "@ts-drp/object";

export function signOperation(
privateKey: string,
Expand Down

0 comments on commit 8de10bb

Please sign in to comment.