---
# System prepended metadata

title: Untitled

---

https://github.com/monetae/core/blob/c09e2bcafed1975dbef8794abc2c247f9bc550ee/proto/schema/gateway.proto#L6-L29

When updating packet types, we're currently adding new packet types to the end. As an alternative, we may wish to categorize the packet types into ranges. For example, all `Promissory-` related packet types could be in the `100-199`, all identity related packet types could be in the `200-299` range, etc.


https://github.com/monetae/core/blob/c09e2bcafed1975dbef8794abc2c247f9bc550ee/proto/schema/gateway.proto#L6-L29

When updating packet types, we're currently adding new packet types to the end. As an alternative, we may wish to categorize the packet types into ranges. For example, all `Promissory-` related packet types could be in the `100-199`, all identity related packet types could be in the `200-299` range, etc.

```protobuf
enum PacketType {
  // Gateway Control Flow Packets 0..99
  // Unspecified packet type
  // default behavior is to drop the packet
  Unknown                       = 0;
  // Unsupported packet
  // default behavior is to return the packet
  Unsupported                   = 1;
  // Authenticate connection
  // Used to verify the verifier public key ownership
  // corresponds to `AuthenticationRequest` message
  Authenticate                  = 2;
  // Return to sender when unable to route packet
  // default behavior is to inverse the sender and recipient fields
  ReturnToSender                = 3;
  // Terminate data stream
  // TODO: decide if this is necessary after "Acknowledgement" type is implemented
  TerminateStream               = 4;
  // Life signal packet
  // Used to signal the gateway and/or client that the connection is still alive
  KeepAlive                     = 5;
  // Acknowledgement of packet
  // Used by a recipient to signal to the sender of the a packet that it has been received.
  Acknowledgement               = 6;

  // Promissory Packets 100..199
  // Send Promissory to recipient request
  // This is a direct end-to-end message, and will not Authorize the promissory
  Promissory                    = 100;
  // Authorize Promissory Request
  // Request an authorized signature for a promissory and return to the sender
  // corresponds to `AuthorizedSignatureRequest` message
  AuthorizePromissory           = 101;
  // Authorize and Forward Promissory
  // Request an authorized signature for a promissory and forward to the recipient
  // corresponds to `AuthorizedSignatureForward` message
  AuthorizeAndForwardPromissory = 102;
  // Archive Promissory Request
  // After a promissory file is removed from circulation archive the promissory file
  ArchivePromissory             = 103;
  // Promissory receipt acknowledgement
  // Respond with promissory receipt to a promissory request
  // TODO: Decide if this msg or a general acknowledgement message should be used.
  PromissoryReceipt             = 104;

  // Identity Packets 200..299
  // Identity Request
  // Request identity of a verifier in the network
  // Corresponds to `IdentityRequest` message
  IdentityRequest               = 200;
  // Identity Response
  // Response to identity request
  // Corresponds to `IdentityResponse` message
  IdentityResponse              = 201;
  // Identity proof
  // Identity proof to be added to subject DID document
  // Corresponds to `IdentityProof`
  IdentityProof                 = 202;

  // Treasury Packets 700..799
  // Remittance Request
  // Corresponds to `RemittanceRequest` message
  // Used by Treasury service to remit payments
  RemittanceRequest             = 700;
  // Remittance Response
  // Corresponds to `RemittanceResponse` message
  // Response from Treasury service as a payment response
  RemittanceResponse            = 701;
}
```

```plantuml
@startuml

skinparam monochrome true
skinparam sequenceArrowThickness 2.5
skinparam MaxMessageSize 200

autonumber

header \nGateway Service\nPacket Types

title Packet Types & Actors\n

participant "Device\nOne" as D1
participant "Device\nTwo" as D2
participant Gateway as G
participant Authority as A
' participant Metrics as M

== Promissory E2E Flow ==

note right of D1
Packet Types Used:

- **AuthorizeAndForwardPromissory**
- **Promissory**
- **Acknowledgment**
- **PromissoryReceipt**
endnote


alt Device is available
    ...
    D1 -> G : **AuthorizeAndForwardPromissory**
    activate D1
    activate G
    G -> A : **AuthorizeAndForwardPromissory**
    activate A
    A -> A : verify & authorize the promissory
    A -> G : **Acknowledgment**
    A -> G : **Promissory**
    deactivate A
    G -> D1 : **Acknowledgment**
    G -> D2 : **Promissory**
    activate D2
    D2 -> D2 : Verify promissory, sign receipt signature, send receipt to previous owner
    D2 -> G : **PromissoryReceipt**
    deactivate D2
    G -> D1 : **PromissoryReceipt**
    deactivate G
    deactivate D1
    ...
else Device is unavailable


end





@endumlp
```