Documentation ¶
Index ¶
- Variables
- func Validate(payload *api.Payload) *api.Error
- type Incoming
- func (i *Incoming) Error(reject *api.Error) (out *Outgoing, err error)
- func (i *Incoming) ID() string
- func (i *Incoming) Model() *models.SecureEnvelope
- func (i *Incoming) Outgoing(msg *api.SecureEnvelope) (out *Outgoing, err error)
- func (i *Incoming) PublicKeySignature() string
- func (i *Incoming) Reject(code api.Error_Code, message string, retry bool) (*Outgoing, error)
- func (i *Incoming) SetHMACValid(valid bool)
- func (i *Incoming) UpdateRecord() (err error)
- type Outgoing
- type Server
- func (s *Server) ConfirmAddress(ctx context.Context, in *api.Address) (*api.AddressConfirmation, error)
- func (s *Server) HandleIncoming(in *Incoming) (out *Outgoing, err error)
- func (s *Server) HandleIncomingError(in *Incoming) (out *Outgoing, err error)
- func (s *Server) HandleSealed(in *Incoming) (out *Outgoing, err error)
- func (s *Server) KeyExchange(ctx context.Context, in *api.SigningKey) (out *api.SigningKey, err error)
- func (s *Server) Run(sock net.Listener)
- func (s *Server) Serve() (err error)
- func (s *Server) Shutdown() error
- func (s *Server) Status(ctx context.Context, in *api.HealthCheck) (out *api.ServiceState, err error)
- func (s *Server) Transfer(ctx context.Context, in *api.SecureEnvelope) (_ *api.SecureEnvelope, err error)
- func (s *Server) TransferStream(stream api.TRISANetwork_TransferStreamServer) (err error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingIdentity = &api.Error{ Code: api.Error_MISSING_FIELDS, Message: "identity payload is required", Retry: true, } ErrMissingTransaction = &api.Error{ Code: api.Error_MISSING_FIELDS, Message: "transaction payload is required", Retry: true, } ErrMissingSentAt = &api.Error{ Code: api.Error_MISSING_FIELDS, Message: "sent at payload field is required for non-repudiation", Retry: true, } ErrInvalidTimestamp = &api.Error{ Code: api.Error_VALIDATION_ERROR, Message: "could not parse payload timestamp as RFC3339 timestamp", Retry: true, } )
Functions ¶
Types ¶
type Incoming ¶
type Incoming struct {
// contains filtered or unexported fields
}
Incoming stores the full context of an incoming transfer message for handling.
func NewIncoming ¶
func (*Incoming) Model ¶
func (i *Incoming) Model() *models.SecureEnvelope
Converts the incoming message into a database model for storage. This method assumes that the envelopeID has already been parsed as a uuid and panics if the envelopeID is not a uuid. Since this is an incoming message, the encryption key and hmac secret are assumed to be sealed using a public key of the local TRISA node, identified by the public key signature.
func (*Incoming) Outgoing ¶
func (i *Incoming) Outgoing(msg *api.SecureEnvelope) (out *Outgoing, err error)
Create an outgoing envelope associated with the incoming envelope
func (*Incoming) PublicKeySignature ¶
Helper for retrieving the envelope public key signature if available
func (*Incoming) SetHMACValid ¶
Mark the incoming HMAC as validated (or not).
func (*Incoming) UpdateRecord ¶
Helper method to update the transaction with the incoming record details
type Outgoing ¶
type Outgoing struct {
// contains filtered or unexported fields
}
func (*Outgoing) Model ¶
func (o *Outgoing) Model() (model *models.SecureEnvelope, err error)
Creates an model to save an outgoing secure envelope to disk. The complicated thing about outgoing secure envelopes is that they're encrypted with the recipient's public keys, so instead, original envelope is kept intact and the encryption key and hmac secret are saved with the keys used to decrypt the associated incoming envelope.
type Server ¶
type Server struct { api.UnimplementedTRISAHealthServer api.UnimplementedTRISANetworkServer // contains filtered or unexported fields }
The TRISA server implements the TRISANetwork and TRISAHealth services defined by the TRISA protocol buffers in the github.com/trisacrypto/trisa repository. It can be run as a standalone service or can be embedded as a component in a larger service.
func New ¶
func New(conf config.TRISAConfig, network network.Network, store store.Store, echan chan<- error) (s *Server, err error)
Create a new TRISA server ready to handle gRPC requests.
func (*Server) ConfirmAddress ¶
func (s *Server) ConfirmAddress(ctx context.Context, in *api.Address) (*api.AddressConfirmation, error)
Address confirmation allows an originator VASP to establish that a beneficiary VASP has control of a crypto wallet address, prior to sending transaction information with sensitive PII data.
NOTE: this RPC is currently undefined by the v9 whitepaper
func (*Server) HandleIncoming ¶
func (*Server) HandleIncomingError ¶
Handles envelopes that only contain errors and require no decryption. The error is stored locally and to complete the transfer, the error is echoed back to the sender.
func (*Server) HandleSealed ¶
func (*Server) KeyExchange ¶
func (s *Server) KeyExchange(ctx context.Context, in *api.SigningKey) (out *api.SigningKey, err error)
KeyExchange is a preperatory RPC that is required before Transfer RPCs to ensure each counterparty has the public keys needed to encrypt secure envelopes for the recipient.
func (*Server) Status ¶
func (s *Server) Status(ctx context.Context, in *api.HealthCheck) (out *api.ServiceState, err error)
Status implements the TRISAHealth gRPC interface and is used for GDS health checks. TODO: allow user to configure not before/after time window
func (*Server) Transfer ¶
func (s *Server) Transfer(ctx context.Context, in *api.SecureEnvelope) (_ *api.SecureEnvelope, err error)
func (*Server) TransferStream ¶
func (s *Server) TransferStream(stream api.TRISANetwork_TransferStreamServer) (err error)