File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import { SessionManager } from './sessions';
2222import { certNodeId } from './network/utils' ;
2323import { IdentitiesManager } from './identities' ;
2424import { ForwardProxy , ReverseProxy } from './network' ;
25- import { IAgentServer } from './proto/js/Agent_grpc_pb ' ;
25+ import { IAgentServer } from './proto/js/Agent.v2_grpc_pb ' ;
2626import { IClientServer } from './proto/js/Client_grpc_pb' ;
2727import { createAgentService , AgentService } from './agent' ;
2828import { createClientService , ClientService } from './client' ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import { Sigchain } from '../sigchain';
1414import { KeyManager } from '../keys' ;
1515import { NotificationsManager } from '../notifications' ;
1616import { ErrorGRPC } from '../grpc/errors' ;
17- import { AgentService , IAgentServer } from '../proto/js/Agent_grpc_pb ' ;
17+ import { AgentService , IAgentServer } from '../proto/js/Agent.v2_grpc_pb ' ;
1818
1919import { messages } from '.' ;
2020import * as grpcUtils from '../grpc/utils' ;
@@ -47,7 +47,7 @@ function createAgentService({
4747 notificationsManager : NotificationsManager ;
4848} ) : IAgentServer {
4949 const agentService : IAgentServer = {
50- echo : async (
50+ echoNew : async (
5151 call : grpc . ServerUnaryCall <
5252 messages . common . EchoMessage ,
5353 messages . common . EchoMessage
Original file line number Diff line number Diff line change @@ -194,7 +194,6 @@ class GRPCServer {
194194 return ;
195195 }
196196
197- @ready ( new grpcErrors . ErrorGRPCServerNotStarted ( ) )
198197 public closeServerForce ( ) : void {
199198 this . server . forceShutdown ( ) ;
200199 }
Original file line number Diff line number Diff line change 1+ syntax = "proto3" ;
2+
3+ import "Common.proto" ;
4+ import "Nodes.proto" ;
5+ import "Vaults.proto" ;
6+ import "Notifications.proto" ;
7+
8+ package agentInterface.v2 ;
9+
10+ service Agent {
11+
12+ // Echo
13+ rpc EchoNew (common.EchoMessage ) returns (common.EchoMessage );
14+
15+ // Vaults
16+ rpc VaultsGitInfoGet (vault.Vault ) returns (stream vault.PackChunk );
17+ rpc VaultsGitPackGet (stream vault.PackChunk ) returns (stream vault.PackChunk );
18+ rpc VaultsScan (node.Node ) returns (stream vault.Vault );
19+ rpc VaultsPermisssionsCheck (vault.NodePermission ) returns (vault.NodePermissionAllowed );
20+
21+ // Nodes
22+ rpc NodesClosestLocalNodesGet (node.Node ) returns (node.NodeTable );
23+ rpc NodesClaimsGet (node.ClaimType ) returns (node.Claims );
24+ rpc NodesChainDataGet (common.EmptyMessage ) returns (node.ChainData );
25+ rpc NodesHolePunchMessageSend (node.Relay ) returns (common.EmptyMessage );
26+ rpc NodesCrossSignClaim (stream node.CrossSign ) returns (stream node.CrossSign );
27+
28+ // Notifications
29+ rpc NotificationsSend (notification.AgentNotification ) returns (common.EmptyMessage );
30+ }
Original file line number Diff line number Diff line change @@ -216,6 +216,12 @@ class VaultManager {
216216 this . logger . info ( 'Destroyed Vault Manager' ) ;
217217 }
218218
219+ /**
220+ * Gets the name of the vault with vaultId
221+ * @param vaultId - Id of the vault.
222+ * @returns {VaultName } - Name of the vault.
223+ * @throws ErrorVaultUndefined if no vault matches the provided VaultId
224+ */
219225 @ready ( new vaultsErrors . ErrorVaultManagerDestroyed ( ) )
220226 public async getVaultName ( vaultId : VaultId ) : Promise < VaultName | undefined > {
221227 const vaultMeta = await this . db . get < POJO > (
@@ -226,6 +232,11 @@ class VaultManager {
226232 return vaultMeta . name ;
227233 }
228234
235+ /**
236+ * Creates a vault with the vaultName.
237+ * @param vaultName
238+ * @returns {* }
239+ */
229240 @ready ( new vaultsErrors . ErrorVaultManagerDestroyed ( ) )
230241 public async createVault ( vaultName : VaultName ) : Promise < Vault > {
231242 const vaultId = await this . generateVaultId ( ) ;
Original file line number Diff line number Diff line change @@ -407,4 +407,11 @@ describe('GRPC agent', () => {
407407 expect ( sigchain . locked ) . toBe ( false ) ;
408408 } ) ;
409409 } ) ;
410+ test ( 'trying to call a service that is not supported.' , async ( ) => {
411+ const echoMessage = new messages . common . EchoMessage ( ) ;
412+ echoMessage . setChallenge ( 'yes' ) ;
413+ await client . echo ( echoMessage ) ;
414+ const response = await client . echo ( echoMessage ) ;
415+ expect ( response . getChallenge ( ) ) . toBe ( 'yes' ) ;
416+ } )
410417} ) ;
You can’t perform that action at this time.
0 commit comments