relaycorp / awala-endpoint-internet

Middleware for server-side apps to communicate over Awala without implementing any of the networking or cryptography from the protocol suite.
https://docs.relaycorp.tech/awala-endpoint-internet/
GNU Affero General Public License v3.0
0 stars 0 forks source link

Store incoming PDAs #15

Closed gnarea closed 1 year ago

gnarea commented 1 year ago

This Part 3a of the POST / endpoint in the PoHTTP server. If the service message has a content type of application/vnd+relaycorp.awala.pda-path.

We don't have examples of this in the Pong app because here we're going to use the high-level utilities introduced in #31.

This task comprises:

  1. Parse the decrypted service message with const params = PrivateEndpointConnParams.deserialize(...) from the Awala core library. Any parsing error should be logged and ignored (HTTP accepted response).
  2. Call fastify.activeEndpoint.savePrivateEndpointChannel(params).
  3. Override InternetPrivateEndpointChannel.savePrivateEndpointChannel(), in order to store the peer's gateway address (present in params). Notes:
    • This requires creating a new Mongoose model (PrivateEndpoint), with the fields peerId and gatewayInternetAddress.
    • We should still call super.savePrivateEndpointChannel(params) before attempting to upsert the private endpoint.

See also:

gnarea commented 1 year ago

I need to get the relevant example from the Internet Gateway. It won't be something we can simply copy/paste but it will be mostly what we need.

levansuper commented 1 year ago

remove the part where we are logging the decrypted parcel


      // This log is needed not to throw decryptionResult is unused error.
      // Will be removed in the next PR
      parcelAwareLogger.info(
        { test: decryptionResult.senderSessionKey.keyId },
        'Invalid service message',
      );
github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: