web

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentDisposition = "Content-Disposition"
	ContentType        = "Content-Type"
	AcceptLength       = "Accept-Length"
	ContentTypeCSV     = "text/csv"
)
View Source
const GenericComplianceName = "A VASP Compliance Team using TRISA Envoy"

Variables

View Source
var (
	ErrNoTRISAEndpoint   = errors.New("cannot construct trisa travel address: no trisa endpoint defined")
	ErrNoLocalCommonName = errors.New("invalid configuration: no common name in trisa endpoint configuration")
	ErrNoLocalparty      = errors.New("could not lookup local vasp counterparty from database, please try again later")
	ErrNotAccepted       = errors.New("the accepted formats are not offered by the server")
	ErrNoPublicKey       = errors.New("no public key associated with secure envelope")
	ErrSunriseSubject    = errors.New("invalid subject type for sunrise review")
	ErrMissingID         = errors.New("id required for this resource")
	ErrIDMismatch        = errors.New("resource id does not match target")
)
View Source
var TransactionsHeader = []string{
	"ID", "Status", "Counterparty", "Originator", "Originator Address",
	"Beneficiary", "Beneficiary Address", "Virtual Asset", "Amount",
	"Last Update", "Created", "Number of Envelopes", "HMAC Signature",
}

Functions

func CheckIDMatch added in v0.30.0

func CheckIDMatch(id, target ulid.ULID) error

CheckIDMatch returns an error if the id is Null or it does not match the target.

func CheckUUIDMatch

func CheckUUIDMatch(id, target uuid.UUID) error

func IsAPIRequest added in v0.16.0

func IsAPIRequest(c *gin.Context) bool

Determines if the request being handled is an API request by inspecting the request path and Accept header. If the request path starts in /v1 and the Accept header is nil or json, then this function returns true.

Types

type Render

type Render struct {
	// contains filtered or unexported fields
}

func NewRender

func NewRender(fsys fs.FS, pattern string, includes ...string) (render *Render, err error)

func (*Render) AddPattern

func (r *Render) AddPattern(fsys fs.FS, pattern string, includes ...string) (err error)

func (*Render) Instance

func (r *Render) Instance(name string, data any) render.Render

type Server

type Server struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

The Web Server implements the compliance and administrative user interfaces.

func Debug

func Debug(conf config.Config, store store.Store, network network.Network, srv *http.Server) (s *Server, err error)

Debug returns a server that uses the specified http server instead of creating one. This function is primarily used to create test servers easily.

func New

func New(conf config.Config, store store.Store, network network.Network) (s *Server, err error)

Create a new web server that serves the compliance and admin web user interface.

func (*Server) APIDocs added in v0.25.0

func (s *Server) APIDocs(c *gin.Context)

func (*Server) APIEnabled added in v0.16.0

func (s *Server) APIEnabled() gin.HandlerFunc

If the API is disabled, this middleware factory function returns a middleware that returns 529 Unavailable on all API requests. If the API is enabled, it returns nil and should not be used as a middleware function.

func (*Server) APIKeyDetail added in v0.24.1

func (s *Server) APIKeyDetail(c *gin.Context)

func (*Server) APIKeys added in v0.24.1

func (s *Server) APIKeys(c *gin.Context)

func (*Server) About added in v0.17.0

func (s *Server) About(c *gin.Context)

func (*Server) AcceptTransaction added in v0.14.0

func (s *Server) AcceptTransaction(c *gin.Context)

func (*Server) AcceptTransactionPreview added in v0.12.0

func (s *Server) AcceptTransactionPreview(c *gin.Context)

func (*Server) AccountDetail

func (s *Server) AccountDetail(c *gin.Context)

func (*Server) Accounts

func (s *Server) Accounts(c *gin.Context)

func (*Server) ArchiveTransaction added in v0.29.0

func (s *Server) ArchiveTransaction(c *gin.Context)

func (*Server) Authenticate

func (s *Server) Authenticate(c *gin.Context)

func (*Server) ChangePassword added in v0.18.0

func (s *Server) ChangePassword(c *gin.Context)

func (*Server) ChangeUserPassword added in v0.18.0

func (s *Server) ChangeUserPassword(c *gin.Context)

func (*Server) ContactDetail added in v0.28.0

func (s *Server) ContactDetail(c *gin.Context)

func (*Server) CounterpartyDetail

func (s *Server) CounterpartyDetail(c *gin.Context)

func (*Server) CounterpartyFromTravelAddress

func (s *Server) CounterpartyFromTravelAddress(c *gin.Context, address string) (cp *models.Counterparty, err error)

func (*Server) CounterpartyVasps

func (s *Server) CounterpartyVasps(c *gin.Context)

func (*Server) CreateAPIKey added in v0.24.1

func (s *Server) CreateAPIKey(c *gin.Context)

func (*Server) CreateAccount

func (s *Server) CreateAccount(c *gin.Context)

func (*Server) CreateContact added in v0.28.0

func (s *Server) CreateContact(c *gin.Context)

func (*Server) CreateCounterparty

func (s *Server) CreateCounterparty(c *gin.Context)

func (*Server) CreateCryptoAddress

func (s *Server) CreateCryptoAddress(c *gin.Context)

func (*Server) CreateTransaction

func (s *Server) CreateTransaction(c *gin.Context)

func (*Server) CreateUser added in v0.18.0

func (s *Server) CreateUser(c *gin.Context)

func (*Server) CryptoAddressDetail

func (s *Server) CryptoAddressDetail(c *gin.Context)

func (*Server) DBInfo added in v0.28.0

func (s *Server) DBInfo(c *gin.Context)

DBInfo reports the database connection status and information if available, otherwise returns a 501 Not Implemented http error.

func (*Server) Debug

func (s *Server) Debug(c *gin.Context)

func (*Server) DecodeTravelAddress added in v0.12.0

func (s *Server) DecodeTravelAddress(c *gin.Context)

Decode a travel address into a URL or its other contents.

func (*Server) Decrypt added in v0.14.0

func (s *Server) Decrypt(in *models.SecureEnvelope) (out *envelope.Envelope, err error)

func (*Server) DeleteAPIKey added in v0.24.1

func (s *Server) DeleteAPIKey(c *gin.Context)

func (*Server) DeleteAccount

func (s *Server) DeleteAccount(c *gin.Context)

func (*Server) DeleteContact added in v0.28.0

func (s *Server) DeleteContact(c *gin.Context)

func (*Server) DeleteCounterparty

func (s *Server) DeleteCounterparty(c *gin.Context)

func (*Server) DeleteCryptoAddress

func (s *Server) DeleteCryptoAddress(c *gin.Context)

func (*Server) DeleteTransaction

func (s *Server) DeleteTransaction(c *gin.Context)

func (*Server) DeleteUser added in v0.18.0

func (s *Server) DeleteUser(c *gin.Context)

func (*Server) EncodeTravelAddress added in v0.12.0

func (s *Server) EncodeTravelAddress(c *gin.Context)

Convert a URL or other data into a travel address.

func (*Server) ExportTransactions

func (s *Server) ExportTransactions(c *gin.Context)

func (*Server) GetComplianceName added in v0.28.0

func (s *Server) GetComplianceName() string

func (*Server) Healthz

func (s *Server) Healthz(c *gin.Context)

Healthz is used to alert k8s to the health/liveness status of the server.

func (*Server) Home

func (s *Server) Home(c *gin.Context)

Home currently renders the primary landing page for the web ui.

func (*Server) LatestPayloadEnvelope added in v0.24.0

func (s *Server) LatestPayloadEnvelope(c *gin.Context)

func (*Server) ListAPIKeys added in v0.24.1

func (s *Server) ListAPIKeys(c *gin.Context)

func (*Server) ListAccounts

func (s *Server) ListAccounts(c *gin.Context)

func (*Server) ListContacts added in v0.28.0

func (s *Server) ListContacts(c *gin.Context)

func (*Server) ListCounterparties

func (s *Server) ListCounterparties(c *gin.Context)

func (*Server) ListCryptoAddresses

func (s *Server) ListCryptoAddresses(c *gin.Context)

func (*Server) ListSecureEnvelopes

func (s *Server) ListSecureEnvelopes(c *gin.Context)

func (*Server) ListTransactions

func (s *Server) ListTransactions(c *gin.Context)

func (*Server) ListUsers added in v0.18.0

func (s *Server) ListUsers(c *gin.Context)

func (*Server) Localparty

func (s *Server) Localparty(ctx context.Context) (_ *models.Counterparty, err error)

Localparty returns the VASP information for the current node.

func (*Server) Login

func (s *Server) Login(c *gin.Context)

func (*Server) LoginPage

func (s *Server) LoginPage(c *gin.Context)

func (*Server) Logout

func (s *Server) Logout(c *gin.Context)

func (*Server) Maintenance

func (s *Server) Maintenance() gin.HandlerFunc

If the server is in maintenance mode, aborts the current request and renders the maintenance mode page instead. Returns nil if not in maintenance mode.

func (*Server) NotAllowed

func (s *Server) NotAllowed(c *gin.Context)

Renders the "invalid action page"

func (*Server) NotFound

func (s *Server) NotFound(c *gin.Context)

Renders the "not found page"

func (*Server) OpenAPI added in v0.24.0

func (s *Server) OpenAPI(c *gin.Context)

func (*Server) PrepareTransaction

func (s *Server) PrepareTransaction(c *gin.Context)

func (*Server) Readyz

func (s *Server) Readyz(c *gin.Context)

Readyz is used to alert k8s to the readiness status of the server.

func (*Server) Reauthenticate

func (s *Server) Reauthenticate(c *gin.Context)

func (*Server) RejectTransaction added in v0.14.0

func (s *Server) RejectTransaction(c *gin.Context)

func (*Server) RepairTransaction added in v0.24.0

func (s *Server) RepairTransaction(c *gin.Context)

func (*Server) RepairTransactionPreview added in v0.24.0

func (s *Server) RepairTransactionPreview(c *gin.Context)

func (*Server) SearchCounterparties added in v0.23.0

func (s *Server) SearchCounterparties(c *gin.Context)

func (*Server) SecureEnvelopeDetail

func (s *Server) SecureEnvelopeDetail(c *gin.Context)

func (*Server) SendEnvelope added in v0.14.0

func (s *Server) SendEnvelope(ctx context.Context, packet *postman.TRISAPacket) (err error)

SendEnvelope performs the bulk of the work to send a TRISA or TRP transaction to the counterparty specified and storing both the outgoing and incoming secure envelopes in the database. This method is used to send the prepared transaction, to send envelopes for a transaction, and in the accept/reject workflows.

func (*Server) SendEnvelopeForTransaction added in v0.14.0

func (s *Server) SendEnvelopeForTransaction(c *gin.Context)

func (*Server) SendEnvelopeForm

func (s *Server) SendEnvelopeForm(c *gin.Context)

func (*Server) SendMessageForm added in v0.28.0

func (s *Server) SendMessageForm(c *gin.Context)

func (*Server) SendPreparedTransaction

func (s *Server) SendPreparedTransaction(c *gin.Context)

func (*Server) SendSunrise added in v0.28.0

func (s *Server) SendSunrise(c *gin.Context)

func (*Server) SendTRISATransfer

func (s *Server) SendTRISATransfer(ctx context.Context, p *postman.TRISAPacket) (err error)

func (*Server) Serve

func (s *Server) Serve(errc chan<- error) (err error)

Serve the compliance and administrative user interfaces in its own go routine.

func (*Server) SetStatus

func (s *Server) SetStatus(health, ready bool)

SetStatus sets the health and ready status on the server, modifying the behavior of the kubernetes probe responses.

func (*Server) SetSunriseAuthCookies added in v0.28.0

func (s *Server) SetSunriseAuthCookies(c *gin.Context, model *models.Sunrise) (err error)

func (*Server) Shutdown

func (s *Server) Shutdown() (err error)

Shutdown the web server gracefully.

func (*Server) Status

func (s *Server) Status(c *gin.Context)

Status reports the version and uptime of the server

func (*Server) SunriseAuthenticate added in v0.28.0

func (s *Server) SunriseAuthenticate(issuer *auth.ClaimsIssuer) gin.HandlerFunc

Authenticates sunrise users verifying the access token in the request. Does not allow API or JSON requests to be authenticated and the claims must have a sunrise subject. If the user is not authenticated they are redirected to the sunrise_404.html page.

This middleware should only be on routes intended for use by sunrise users.

func (*Server) SunriseEnabled added in v0.28.0

func (s *Server) SunriseEnabled() gin.HandlerFunc

Aborts the request with a 404 error if sunrise is not enabled.

func (*Server) SunriseMessageAccept added in v0.28.0

func (s *Server) SunriseMessageAccept(c *gin.Context)

func (*Server) SunriseMessageDownload added in v0.30.0

func (s *Server) SunriseMessageDownload(c *gin.Context)

func (*Server) SunriseMessageReject added in v0.28.0

func (s *Server) SunriseMessageReject(c *gin.Context)

func (*Server) SunriseMessageReview added in v0.28.0

func (s *Server) SunriseMessageReview(c *gin.Context)

func (*Server) TransactionDetail

func (s *Server) TransactionDetail(c *gin.Context)

func (*Server) Transactions

func (s *Server) Transactions(c *gin.Context)

func (*Server) TransactionsAcceptPreview added in v0.12.0

func (s *Server) TransactionsAcceptPreview(c *gin.Context)

func (*Server) TransactionsInfo added in v0.12.0

func (s *Server) TransactionsInfo(c *gin.Context)

func (*Server) TransactionsRepairPreview added in v0.24.1

func (s *Server) TransactionsRepairPreview(c *gin.Context)

func (*Server) TravelAddressUtility added in v0.12.0

func (s *Server) TravelAddressUtility(c *gin.Context)

func (*Server) UIEnabled added in v0.16.0

func (s *Server) UIEnabled() gin.HandlerFunc

If the UI is disabled, this middleware factory function returrns a middleware that returns 529 Unvailable on all UI requests. If the UI is enabled, it returns nil.

func (*Server) URL

func (s *Server) URL() string

URL returns the endpoint of the server as determined by the configuration and the socket address and port (if specified).

func (*Server) UpdateAPIKey added in v0.24.1

func (s *Server) UpdateAPIKey(c *gin.Context)

func (*Server) UpdateAPIKeyPreview added in v0.27.0

func (s *Server) UpdateAPIKeyPreview(c *gin.Context)

func (*Server) UpdateAccount

func (s *Server) UpdateAccount(c *gin.Context)

func (*Server) UpdateAccountPreview

func (s *Server) UpdateAccountPreview(c *gin.Context)

func (*Server) UpdateContact added in v0.28.0

func (s *Server) UpdateContact(c *gin.Context)

func (*Server) UpdateCounterparty

func (s *Server) UpdateCounterparty(c *gin.Context)

func (*Server) UpdateCounterpartyPreview

func (s *Server) UpdateCounterpartyPreview(c *gin.Context)

func (*Server) UpdateCryptoAddress

func (s *Server) UpdateCryptoAddress(c *gin.Context)

func (*Server) UpdateTransaction

func (s *Server) UpdateTransaction(c *gin.Context)

func (*Server) UpdateUser added in v0.18.0

func (s *Server) UpdateUser(c *gin.Context)

func (*Server) UserDetail added in v0.18.0

func (s *Server) UserDetail(c *gin.Context)

func (*Server) UserProfile added in v0.18.0

func (s *Server) UserProfile(c *gin.Context)

func (*Server) UsersManagement added in v0.18.0

func (s *Server) UsersManagement(c *gin.Context)

func (*Server) ValidateIVMS101 added in v0.29.0

func (s *Server) ValidateIVMS101(c *gin.Context)

func (*Server) VerifySunriseUser added in v0.28.0

func (s *Server) VerifySunriseUser(c *gin.Context)

The incoming request should be coming from a compliance officer at a VASP who has received a sunrise message. The request should include a verification token, otherwise a 404 is returned. If the verification token is valid, this endpoint will send a OTP to the user's email address, which the user must type in as a secondary check that they do indeed have access to the email address the message was sent to. If the token is expired, the user can request a new verification token sent to their email address. If the token is completed, e.g. the user has already logged in with it at least once; they can do the OTP passcheck and receive access to the data.

Directories

Path Synopsis
api
v1
Scene provides well structured template contexts and functionality for HTML template rendering.
Scene provides well structured template contexts and functionality for HTML template rendering.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL