Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
amydevs committed Aug 13, 2024
1 parent 35c67b9 commit a401b04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/nodes/NodeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@ class NodeManager {
requestingNodeId: NodeId,
input: AgentRPCRequestParams<AgentClaimMessage>,
tran?: DBTransaction,
): Promise<AgentRPCResponseResult<AgentClaimMessage>> {
): Promise<AgentRPCResponseResult<{ success: boolean }>> {
if (tran == null) {
return this.db.withTransactionF((tran) =>
this.handleVerifyClaimNetwork(requestingNodeId, input, tran),
Expand Down Expand Up @@ -1586,7 +1586,9 @@ class NodeManager {
}
}

throw new Error();
return {
success: isAuthenticated,
}
}

/**
Expand Down
15 changes: 10 additions & 5 deletions src/nodes/agent/handlers/NodesNetworkVerifyClaim.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {
AgentClaimMessage,
AgentRPCRequestParams,
AgentRPCResponseResult,
} from '../types';
Expand All @@ -13,20 +14,24 @@ import { never } from '../../../utils';
import * as keysUtils from '../../../keys/utils';
import * as ids from '../../../ids';

class NodesNetworkAuthenticate extends UnaryHandler<
class NodesNetworkVerifyClaim extends UnaryHandler<
{
nodeManager: NodeManager;
},
AgentRPCRequestParams<{}>,
AgentRPCResponseResult<{}>
> {
public handle = async (
input: AgentRPCRequestParams<{}>,
input: AgentRPCRequestParams<AgentClaimMessage>,
_cancel,
meta: Record<string, JSONValue> | undefined,
): Promise<AgentRPCResponseResult<{}>> => {
return {};
): Promise<AgentRPCResponseResult<{ success: boolean }>> => {
const requestingNodeId = agentUtils.nodeIdFromMeta(meta);
if (requestingNodeId == null) {
throw new agentErrors.ErrorAgentNodeIdMissing();
}
return this.container.nodeManager.handleVerifyClaimNetwork(requestingNodeId, input);
};
}

export default NodesNetworkAuthenticate;
export default NodesNetworkVerifyClaim;

0 comments on commit a401b04

Please sign in to comment.