models

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PostDateLayout = "2006-01-02"
	MonthLayout    = "2006-01"
)
View Source
const (
	DefaultOrganizationName = "Draft Registration"
	MaxCollaborators        = 50
)
View Source
const (
	// Basic Details Fields
	FieldWebsite          = "website"
	FieldBusinessCategory = "business_category"
	FieldVASPCategories   = "vasp_categories"
	FieldEstablishedOn    = "established_on"
	FieldOrganizationName = "organization_name"

	// Legal Person Entity Fields
	FieldEntity                       = "entity"
	FieldEntityGeographicAddresses    = "entity.geographic_addresses"
	FieldEntityNationalIdentification = "entity.national_identification"
	FieldEntityCountryOfRegistration  = "entity.country_of_registration"

	// Contacts Fields
	FieldContacts                    = "contacts"
	FieldContactsTechnical           = "contacts.technical"
	FieldContactsTechnicalName       = "contacts.technical.name"
	FieldContactsTechnicalEmail      = "contacts.technical.email"
	FieldContactsTechnicalPhone      = "contacts.technical.phone"
	FieldContactsAdministrative      = "contacts.administrative"
	FieldContactsAdministrativeName  = "contacts.administrative.name"
	FieldContactsAdministrativeEmail = "contacts.administrative.email"
	FieldContactsAdministrativePhone = "contacts.administrative.phone"
	FieldContactsLegal               = "contacts.legal"
	FieldContactsLegalName           = "contacts.legal.name"
	FieldContactsLegalEmail          = "contacts.legal.email"
	FieldContactsLegalPhone          = "contacts.legal.phone"
	FieldContactsBilling             = "contacts.billing"
	FieldContactsBillingName         = "contacts.billing.name"
	FieldContactsBillingEmail        = "contacts.billing.email"
	FieldContactsBillingPhone        = "contacts.billing.phone"

	// TRIXO fields
	FieldTRIXO                                = "trixo"
	FieldTRIXOPrimaryNationalJurisdiction     = "trixo.primary_national_jurisdiction"
	FieldTRIXOPrimaryRegulator                = "trixo.primary_regulator"
	FieldTRIXOFinancialTransfersPermitted     = "trixo.financial_transfers_permitted"
	FieldTRIXOOtherJurisdictions              = "trixo.other_jurisdictions"
	FieldTRIXOOtherJurisdictionsCountry       = "trixo.other_jurisdictions.country"
	FieldTRIXOOtherJurisdictionsRegulatorName = "trixo.other_jurisdictions.regulator_name"
	FieldTRIXOOtherJurisdictionsLicenseNumber = "trixo.other_jurisdictions.license_number"
	FieldTRIXOHasRequiredRegulatoryProgram    = "trixo.has_required_regulatory_program"
	FieldTRIXOConductsCustomerKYC             = "trixo.conducts_customer_kyc"
	FieldTRIXOKYCThreshold                    = "trixo.kyc_threshold"
	FieldTRIXOKYCThresholdCurrency            = "trixo.kyc_threshold_currency"
	FieldTRIXOMustComplyTravelRule            = "trixo.must_comply_travel_rule"
	FieldTRIXOApplicableRegulations           = "trixo.applicable_regulations"
	FieldTRIXOComplianceThreshold             = "trixo.compliance_threshold"
	FieldTRIXOComplianceThresholdCurrency     = "trixo.compliance_threshold_currency"
	FieldTRIXOMustSafeguardPII                = "trixo.must_safeguard_pii"
	FieldTRIXOSafeGuardsPII                   = "trixo.safeguards_pii"

	// TRISA Details Fields
	FieldTestNet           = "testnet"
	FieldTestNetCommonName = "testnet.common_name"
	FieldTestNetEndpoint   = "testnet.endpoint"
	FieldTestNetDNSNames   = "testnet.dns_names"
	FieldMainNet           = "mainnet"
	FieldMainNetCommonName = "mainnet.common_name"
	FieldMainNetEndpoint   = "mainnet.endpoint"
	FieldMainNetDNSNames   = "mainnet.dns_names"

	// Default fields
	FieldState = "state"
)
View Source
const (
	DateLayout = "2006-01-02"
)

Variables

View Source
var (
	ErrYesNo                   = errors.New("field must be either 'yes' or 'no'")
	ErrYesNoPartially          = errors.New("field must be either 'yes', 'no', or 'partially'")
	ErrNegativeValue           = errors.New("field cannot be negative")
	ErrMissingField            = errors.New("missing required field")
	ErrTooShort                = errors.New("field is too short")
	ErrInvalidEmail            = errors.New("field is not an email address")
	ErrNoContacts              = errors.New("at least one contact is required")
	ErrMissingContact          = errors.New("administrative contact or technical and legal contacts required")
	ErrMissingAdminOrLegal     = errors.New("administrative or legal contact required")
	ErrMissingAdminOrTechnical = errors.New("administrative or technical contact required")
	ErrInvalidCollaborator     = errors.New("collaborator record is invalid")
	ErrCollaboratorExists      = errors.New("collaborator already exists in organization")
	ErrMaxCollaborators        = errors.New("maximum number of collaborators reached")
	ErrLegalPersonNameLength   = errors.New("legal person name must be less than 100 characters")
	ErrNoLegalNameIdentifier   = errors.New("at least one legal name identifier is required")
	ErrNoGeographicAddress     = errors.New("at least one geographic address is required")
	ErrTooManyAddressLines     = errors.New("an address can have at most 7 address lines")
	ErrInvalidAddress          = errors.New("address must have either address lines or street name and building number/name")
	ErrNoAddressLines          = errors.New("geographic address requires at least one address line")
	ErrInvalidCountry          = errors.New("country must be an ISO-3166-1 alpha-2 code")
	ErrInvalidCustomerNumber   = errors.New("customer number is optional but can be at most 50 characters")
	ErrInvalidLegalNatID       = errors.New("national identifier type must be RAID, MISC, LEIX, or TXID")
	ErrInvalidLEI              = errors.New("LEI identifier must not be longer than 35 characters")
	ErrNoCountryNatID          = errors.New("country of issue must be empty for legal persons")
	ErrLegalNatIDRequired      = errors.New("national identification is required to verify legal person")
	ErrNoRAForLEIX             = errors.New("registration authority must be empty for identifier type LEI")
	ErrRARequired              = errors.New("registration authority must be specified unless the identifier type is LEI")
	ErrMissingTestNetOrMainNet = errors.New("node implementation details are required for at least one network: testnet or mainnet")
	ErrInvalidEndpoint         = errors.New("endpoint must have the format host:port")
	ErrDuplicateEndpoint       = errors.New("mainnet endpoint cannot be the same as testnet endpoint")
	ErrMissingHost             = errors.New("endpoint string must have a host")
	ErrMissingPort             = errors.New("endpoint string must have a port")
	ErrInvalidPort             = errors.New("port must be a number between 1 and 65535")
	ErrInvalidCommonName       = errors.New("common name cannot contain wildcard characters (*) and must not have a scheme or port")
	ErrCommonNameMismatch      = errors.New("common name must match the endpoint host")
)
View Source
var (
	AttentionSeverity_name = map[int32]string{
		0: "SUCCESS",
		1: "INFO",
		2: "WARNING",
		3: "ALERT",
	}
	AttentionSeverity_value = map[string]int32{
		"SUCCESS": 0,
		"INFO":    1,
		"WARNING": 2,
		"ALERT":   3,
	}
)

Enum value maps for AttentionSeverity.

View Source
var (
	AttentionAction_name = map[int32]string{
		0: "NO_ACTION",
		1: "START_REGISTRATION",
		2: "COMPLETE_REGISTRATION",
		3: "SUBMIT_TESTNET",
		4: "SUBMIT_MAINNET",
		5: "VERIFY_EMAILS",
		6: "RENEW_CERTIFICATE",
		7: "CONTACT_SUPPORT",
	}
	AttentionAction_value = map[string]int32{
		"NO_ACTION":             0,
		"START_REGISTRATION":    1,
		"COMPLETE_REGISTRATION": 2,
		"SUBMIT_TESTNET":        3,
		"SUBMIT_MAINNET":        4,
		"VERIFY_EMAILS":         5,
		"RENEW_CERTIFICATE":     6,
		"CONTACT_SUPPORT":       7,
	}
)

Enum value maps for AttentionAction.

View Source
var (
	ErrInvalidOrgID = errors.New("invalid organization id")
)
View Source
var File_bff_models_v1_models_proto protoreflect.FileDescriptor

Functions

func NetworkDetailsIsZero added in v1.7.0

func NetworkDetailsIsZero(details *NetworkDetails) bool

NetworkDetailsIsZero returns true if the network details are nil or zero.

func ParseOrgID

func ParseOrgID(orgID interface{}) (uuid.UUID, error)

func ValidateContact added in v1.7.0

func ValidateContact(contact *pb.Contact, fieldName string) error

Validate a single contact, using the field name to construct errors.

Types

type ActivityCount added in v1.7.3

type ActivityCount struct {
	Testnet map[string]uint64 `` /* 156-byte string literal not displayed */
	Mainnet map[string]uint64 `` /* 156-byte string literal not displayed */
	RVASP   map[string]uint64 `` /* 152-byte string literal not displayed */
	// contains filtered or unexported fields
}

ActivityCount represents counts broken down by activity type and network.

func (*ActivityCount) Add added in v1.7.3

func (a *ActivityCount) Add(network activity.Network, acv activity.Activity, count uint64)

func (*ActivityCount) Descriptor deprecated added in v1.7.3

func (*ActivityCount) Descriptor() ([]byte, []int)

Deprecated: Use ActivityCount.ProtoReflect.Descriptor instead.

func (*ActivityCount) GetMainnet added in v1.7.3

func (x *ActivityCount) GetMainnet() map[string]uint64

func (*ActivityCount) GetRVASP added in v1.7.3

func (x *ActivityCount) GetRVASP() map[string]uint64

func (*ActivityCount) GetTestnet added in v1.7.3

func (x *ActivityCount) GetTestnet() map[string]uint64

func (*ActivityCount) ProtoMessage added in v1.7.3

func (*ActivityCount) ProtoMessage()

func (*ActivityCount) ProtoReflect added in v1.7.3

func (x *ActivityCount) ProtoReflect() protoreflect.Message

func (*ActivityCount) Reset added in v1.7.3

func (x *ActivityCount) Reset()

func (*ActivityCount) String added in v1.7.3

func (x *ActivityCount) String() string

type ActivityDay added in v1.7.3

type ActivityDay struct {

	// The date which the activities occurred on
	Date string `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"`
	// Activity counts broken down by network and activity type
	Activity *ActivityCount `protobuf:"bytes,3,opt,name=activity,proto3" json:"activity,omitempty"`
	// Activity counts broken down by VASP
	VaspActivity map[string]*ActivityCount `` /* 185-byte string literal not displayed */
	// contains filtered or unexported fields
}

ActivityDay represents activity across multiple networks aggregated over a single day.

func NewActivityDay added in v1.7.3

func NewActivityDay(date string) *ActivityDay

Create a new activity day from the date

func (*ActivityDay) Add added in v1.7.3

Add activity to the day.

func (*ActivityDay) Descriptor deprecated added in v1.7.3

func (*ActivityDay) Descriptor() ([]byte, []int)

Deprecated: Use ActivityDay.ProtoReflect.Descriptor instead.

func (*ActivityDay) GetActivity added in v1.7.3

func (x *ActivityDay) GetActivity() *ActivityCount

func (*ActivityDay) GetDate added in v1.7.3

func (x *ActivityDay) GetDate() string

func (*ActivityDay) GetVaspActivity added in v1.7.3

func (x *ActivityDay) GetVaspActivity() map[string]*ActivityCount

func (*ActivityDay) ProtoMessage added in v1.7.3

func (*ActivityDay) ProtoMessage()

func (*ActivityDay) ProtoReflect added in v1.7.3

func (x *ActivityDay) ProtoReflect() protoreflect.Message

func (*ActivityDay) Reset added in v1.7.3

func (x *ActivityDay) Reset()

func (*ActivityDay) String added in v1.7.3

func (x *ActivityDay) String() string

type ActivityMonth added in v1.7.3

type ActivityMonth struct {
	Date string         `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"`
	Days []*ActivityDay `protobuf:"bytes,2,rep,name=days,proto3" json:"days,omitempty"`
	// Metadata as RFC3339Nano Timestamps
	Created  string `protobuf:"bytes,14,opt,name=created,proto3" json:"created,omitempty"`
	Modified string `protobuf:"bytes,15,opt,name=modified,proto3" json:"modified,omitempty"`
	// contains filtered or unexported fields
}

Activity counts are aggregated by day and stored in months to enable efficient lookups of multiple days of counts for time series representations.

func (*ActivityMonth) Add added in v1.7.3

Add the activity to the month, this will ensure that the activity is added to the correct day and that the day is created if it does not exist. Note: This assumes that the activity window is less than 24 hours.

func (*ActivityMonth) Descriptor deprecated added in v1.7.3

func (*ActivityMonth) Descriptor() ([]byte, []int)

Deprecated: Use ActivityMonth.ProtoReflect.Descriptor instead.

func (*ActivityMonth) GetCreated added in v1.7.3

func (x *ActivityMonth) GetCreated() string

func (*ActivityMonth) GetDate added in v1.7.3

func (x *ActivityMonth) GetDate() string

func (*ActivityMonth) GetDays added in v1.7.3

func (x *ActivityMonth) GetDays() []*ActivityDay

func (*ActivityMonth) GetModified added in v1.7.3

func (x *ActivityMonth) GetModified() string

func (*ActivityMonth) Key added in v1.7.3

func (m *ActivityMonth) Key() (_ []byte, err error)

Return the key used to lookup an ActivityMonth in the ActivityStore, which is the byte slice representation of the date in the form YYYY-MM. This method also validates that the date is correct.

func (*ActivityMonth) ProtoMessage added in v1.7.3

func (*ActivityMonth) ProtoMessage()

func (*ActivityMonth) ProtoReflect added in v1.7.3

func (x *ActivityMonth) ProtoReflect() protoreflect.Message

func (*ActivityMonth) Reset added in v1.7.3

func (x *ActivityMonth) Reset()

func (*ActivityMonth) String added in v1.7.3

func (x *ActivityMonth) String() string

type Announcement

type Announcement struct {
	Id       string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Title    string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	Body     string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
	PostDate string `protobuf:"bytes,4,opt,name=post_date,json=postDate,proto3" json:"post_date,omitempty"`
	Author   string `protobuf:"bytes,5,opt,name=author,proto3" json:"author,omitempty"`
	// Metadata as RFC3339Nano Timestamps
	Created  string `protobuf:"bytes,14,opt,name=created,proto3" json:"created,omitempty"`
	Modified string `protobuf:"bytes,15,opt,name=modified,proto3" json:"modified,omitempty"`
	// contains filtered or unexported fields
}

Announcements are made by network administrators to inform all TRISA members of important events, maintenance, or milestones. These are broadcast from the BFF so that all members receive the same announcement.

func (*Announcement) Descriptor deprecated

func (*Announcement) Descriptor() ([]byte, []int)

Deprecated: Use Announcement.ProtoReflect.Descriptor instead.

func (*Announcement) GetAuthor

func (x *Announcement) GetAuthor() string

func (*Announcement) GetBody

func (x *Announcement) GetBody() string

func (*Announcement) GetCreated

func (x *Announcement) GetCreated() string

func (*Announcement) GetId

func (x *Announcement) GetId() string

func (*Announcement) GetModified

func (x *Announcement) GetModified() string

func (*Announcement) GetPostDate

func (x *Announcement) GetPostDate() string

func (*Announcement) GetTitle

func (x *Announcement) GetTitle() string

func (*Announcement) Month

func (a *Announcement) Month() (_ string, err error)

Month returns the postdate month in the form YYYY-MM to determine which AnnouncementsMonth the announcement should belong in.

func (*Announcement) ParsePostDate

func (a *Announcement) ParsePostDate() (time.Time, error)

Return the timestamp from the post date.

func (*Announcement) ProtoMessage

func (*Announcement) ProtoMessage()

func (*Announcement) ProtoReflect

func (x *Announcement) ProtoReflect() protoreflect.Message

func (*Announcement) Reset

func (x *Announcement) Reset()

func (*Announcement) String

func (x *Announcement) String() string

type AnnouncementMonth

type AnnouncementMonth struct {
	Date          string          `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"`
	Announcements []*Announcement `protobuf:"bytes,2,rep,name=announcements,proto3" json:"announcements,omitempty"`
	// Metadata as RFC3339Nano Timestamps
	Created  string `protobuf:"bytes,14,opt,name=created,proto3" json:"created,omitempty"`
	Modified string `protobuf:"bytes,15,opt,name=modified,proto3" json:"modified,omitempty"`
	// contains filtered or unexported fields
}

Announcements are stored in months to enable fast retrieval of the latest announcements in a specific time range without a reversal traversal of time-ordered anncouncement objects. Note that the annoucements are stored in a slice instead of a map to reduce data storage overhead. Accessing a specific announcement requires iterating over the annoucements, but the number of annoucements in a month should not be unbounded, so this cost is acceptable for data storage performance.

func (*AnnouncementMonth) Add

func (m *AnnouncementMonth) Add(a *Announcement)

Add an announcement ensuring that they are stored sorted by post date. NOTE: can sort postdate strings in the YYYY-MM-DD format without parsing them, however the post date must be validated before adding it to the month.

func (*AnnouncementMonth) Descriptor deprecated

func (*AnnouncementMonth) Descriptor() ([]byte, []int)

Deprecated: Use AnnouncementMonth.ProtoReflect.Descriptor instead.

func (*AnnouncementMonth) GetAnnouncements

func (x *AnnouncementMonth) GetAnnouncements() []*Announcement

func (*AnnouncementMonth) GetCreated

func (x *AnnouncementMonth) GetCreated() string

func (*AnnouncementMonth) GetDate

func (x *AnnouncementMonth) GetDate() string

func (*AnnouncementMonth) GetModified

func (x *AnnouncementMonth) GetModified() string

func (*AnnouncementMonth) Key

func (m *AnnouncementMonth) Key() (_ []byte, err error)

Return the key associated with the announcement month: the byte array of the string date in YYYY-MM form. This method also validates the Date is correct.

func (*AnnouncementMonth) ProtoMessage

func (*AnnouncementMonth) ProtoMessage()

func (*AnnouncementMonth) ProtoReflect

func (x *AnnouncementMonth) ProtoReflect() protoreflect.Message

func (*AnnouncementMonth) Reset

func (x *AnnouncementMonth) Reset()

func (*AnnouncementMonth) String

func (x *AnnouncementMonth) String() string

type AttentionAction

type AttentionAction int32

AttentionAction is used to indicate the action that should be taken by the user in response to an attention message.

const (
	AttentionAction_NO_ACTION             AttentionAction = 0
	AttentionAction_START_REGISTRATION    AttentionAction = 1
	AttentionAction_COMPLETE_REGISTRATION AttentionAction = 2
	AttentionAction_SUBMIT_TESTNET        AttentionAction = 3
	AttentionAction_SUBMIT_MAINNET        AttentionAction = 4
	AttentionAction_VERIFY_EMAILS         AttentionAction = 5
	AttentionAction_RENEW_CERTIFICATE     AttentionAction = 6
	AttentionAction_CONTACT_SUPPORT       AttentionAction = 7
)

func (AttentionAction) Descriptor

func (AttentionAction) Enum

func (x AttentionAction) Enum() *AttentionAction

func (AttentionAction) EnumDescriptor deprecated

func (AttentionAction) EnumDescriptor() ([]byte, []int)

Deprecated: Use AttentionAction.Descriptor instead.

func (AttentionAction) Number

func (AttentionAction) String

func (x AttentionAction) String() string

func (AttentionAction) Type

type AttentionSeverity

type AttentionSeverity int32

AttentionSeverity is used to indicate the importance of an attention message

const (
	AttentionSeverity_SUCCESS AttentionSeverity = 0
	AttentionSeverity_INFO    AttentionSeverity = 1
	AttentionSeverity_WARNING AttentionSeverity = 2
	AttentionSeverity_ALERT   AttentionSeverity = 3
)

func (AttentionSeverity) Descriptor

func (AttentionSeverity) Enum

func (AttentionSeverity) EnumDescriptor deprecated

func (AttentionSeverity) EnumDescriptor() ([]byte, []int)

Deprecated: Use AttentionSeverity.Descriptor instead.

func (AttentionSeverity) Number

func (AttentionSeverity) String

func (x AttentionSeverity) String() string

func (AttentionSeverity) Type

type Collaborator

type Collaborator struct {

	// Identifiers used by the BFF
	Id    string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
	// User data cached from the authentication service
	UserId   string   `protobuf:"bytes,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	Name     string   `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
	Roles    []string `protobuf:"bytes,5,rep,name=roles,proto3" json:"roles,omitempty"`
	Verified bool     `protobuf:"varint,6,opt,name=verified,proto3" json:"verified,omitempty"`
	// Metadata as RFC3339Nano Timestamps
	CreatedAt  string `protobuf:"bytes,10,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	ModifiedAt string `protobuf:"bytes,11,opt,name=modified_at,json=modifiedAt,proto3" json:"modified_at,omitempty"`
	JoinedAt   string `protobuf:"bytes,12,opt,name=joined_at,json=joinedAt,proto3" json:"joined_at,omitempty"`
	LastLogin  string `protobuf:"bytes,13,opt,name=last_login,json=lastLogin,proto3" json:"last_login,omitempty"`
	ExpiresAt  string `protobuf:"bytes,14,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"`
	// contains filtered or unexported fields
}

A Collaborator is a user that is associated with an organization. Collaborators are uniquely identified by their email address and the Organization document they exist on. Therefore, it is possible for a user to exist as a collaborator on multiple organizations. The information in the Collaborator document is meant to be used by frontend applications to manage and display collaborators and their roles to the user, so the BFF should periodically keep this information up to date by syncing with the authentication service (e.g. Auth0).

func (*Collaborator) Descriptor deprecated

func (*Collaborator) Descriptor() ([]byte, []int)

Deprecated: Use Collaborator.ProtoReflect.Descriptor instead.

func (*Collaborator) GetCreatedAt

func (x *Collaborator) GetCreatedAt() string

func (*Collaborator) GetEmail

func (x *Collaborator) GetEmail() string

func (*Collaborator) GetExpiresAt added in v1.6.1

func (x *Collaborator) GetExpiresAt() string

func (*Collaborator) GetId added in v1.5.4

func (x *Collaborator) GetId() string

func (*Collaborator) GetJoinedAt added in v1.6.0

func (x *Collaborator) GetJoinedAt() string

func (*Collaborator) GetLastLogin added in v1.6.0

func (x *Collaborator) GetLastLogin() string

func (*Collaborator) GetModifiedAt

func (x *Collaborator) GetModifiedAt() string

func (*Collaborator) GetName added in v1.5.4

func (x *Collaborator) GetName() string

func (*Collaborator) GetRoles added in v1.5.4

func (x *Collaborator) GetRoles() []string

func (*Collaborator) GetUserId added in v1.5.4

func (x *Collaborator) GetUserId() string

func (*Collaborator) GetVerified added in v1.6.0

func (x *Collaborator) GetVerified() bool

func (*Collaborator) Key

func (collab *Collaborator) Key() string

Returns the key which uniquely identifies this collaborator.

func (*Collaborator) ProtoMessage

func (*Collaborator) ProtoMessage()

func (*Collaborator) ProtoReflect

func (x *Collaborator) ProtoReflect() protoreflect.Message

func (*Collaborator) Reset

func (x *Collaborator) Reset()

func (*Collaborator) String

func (x *Collaborator) String() string

func (*Collaborator) Validate

func (collab *Collaborator) Validate() error

Validate a collaborator record, ensuring that all the required fields exist for storage and generating missing fields such as the ID.

func (*Collaborator) ValidateInvitation added in v1.6.1

func (collab *Collaborator) ValidateInvitation() (err error)

Helper to determine if a collaborator invite is valid based on the expiration date. If there is no expiration date, this method assumes that the collaborator invitation is still valid.

type DirectoryRecord

type DirectoryRecord struct {
	Id                  string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	RegisteredDirectory string `protobuf:"bytes,2,opt,name=registered_directory,json=registeredDirectory,proto3" json:"registered_directory,omitempty"`
	CommonName          string `protobuf:"bytes,3,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"`
	// RFC 3339 timestamp -- if set, the form has been submitted without error
	Submitted string `protobuf:"bytes,15,opt,name=submitted,proto3" json:"submitted,omitempty"`
	// contains filtered or unexported fields
}

DirectoryRecord contains the information needed to lookup a VASP in a directory service.

func (*DirectoryRecord) Descriptor deprecated

func (*DirectoryRecord) Descriptor() ([]byte, []int)

Deprecated: Use DirectoryRecord.ProtoReflect.Descriptor instead.

func (*DirectoryRecord) GetCommonName

func (x *DirectoryRecord) GetCommonName() string

func (*DirectoryRecord) GetId

func (x *DirectoryRecord) GetId() string

func (*DirectoryRecord) GetRegisteredDirectory

func (x *DirectoryRecord) GetRegisteredDirectory() string

func (*DirectoryRecord) GetSubmitted

func (x *DirectoryRecord) GetSubmitted() string

func (*DirectoryRecord) ProtoMessage

func (*DirectoryRecord) ProtoMessage()

func (*DirectoryRecord) ProtoReflect

func (x *DirectoryRecord) ProtoReflect() protoreflect.Message

func (*DirectoryRecord) Reset

func (x *DirectoryRecord) Reset()

func (*DirectoryRecord) String

func (x *DirectoryRecord) String() string

type FormState

type FormState struct {

	// The current 1-indexed step of the form
	Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"`
	// If set, the form is completely filled out and ready to be submitted
	ReadyToSubmit bool `protobuf:"varint,2,opt,name=ready_to_submit,json=readyToSubmit,proto3" json:"ready_to_submit,omitempty"`
	// The state of each step in the form
	Steps []*FormStep `protobuf:"bytes,3,rep,name=steps,proto3" json:"steps,omitempty"`
	// RFC 3339 timestamp -- if set, the user has started filling out the form
	Started string `protobuf:"bytes,4,opt,name=started,proto3" json:"started,omitempty"`
	// contains filtered or unexported fields
}

FormState contains the current state of an organization's registration form to enable a consistent user experience across multiple contexts.

func (*FormState) Descriptor deprecated

func (*FormState) Descriptor() ([]byte, []int)

Deprecated: Use FormState.ProtoReflect.Descriptor instead.

func (*FormState) GetCurrent

func (x *FormState) GetCurrent() int32

func (*FormState) GetReadyToSubmit

func (x *FormState) GetReadyToSubmit() bool

func (*FormState) GetStarted

func (x *FormState) GetStarted() string

func (*FormState) GetSteps

func (x *FormState) GetSteps() []*FormStep

func (*FormState) ProtoMessage

func (*FormState) ProtoMessage()

func (*FormState) ProtoReflect

func (x *FormState) ProtoReflect() protoreflect.Message

func (*FormState) Reset

func (x *FormState) Reset()

func (*FormState) String

func (x *FormState) String() string

type FormStep

type FormStep struct {
	Key    int32  `protobuf:"varint,1,opt,name=key,proto3" json:"key,omitempty"`
	Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	Name   string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

FormStep contains the state of a single step in an organization's registration form.

func (*FormStep) Descriptor deprecated

func (*FormStep) Descriptor() ([]byte, []int)

Deprecated: Use FormStep.ProtoReflect.Descriptor instead.

func (*FormStep) GetKey

func (x *FormStep) GetKey() int32

func (*FormStep) GetName added in v1.7.0

func (x *FormStep) GetName() string

func (*FormStep) GetStatus

func (x *FormStep) GetStatus() string

func (*FormStep) ProtoMessage

func (*FormStep) ProtoMessage()

func (*FormStep) ProtoReflect

func (x *FormStep) ProtoReflect() protoreflect.Message

func (*FormStep) Reset

func (x *FormStep) Reset()

func (*FormStep) String

func (x *FormStep) String() string

type NetworkDetails

type NetworkDetails struct {

	// Certificate request information
	CommonName string   `protobuf:"bytes,1,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"`
	Endpoint   string   `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	DnsNames   []string `protobuf:"bytes,3,rep,name=dns_names,json=dnsNames,proto3" json:"dns_names,omitempty"`
	// contains filtered or unexported fields
}

NetworkDetails contains directory-service specific submission information such as the certificate request and information about when the registration form was submitted.

func (*NetworkDetails) Descriptor deprecated

func (*NetworkDetails) Descriptor() ([]byte, []int)

Deprecated: Use NetworkDetails.ProtoReflect.Descriptor instead.

func (*NetworkDetails) GetCommonName

func (x *NetworkDetails) GetCommonName() string

func (*NetworkDetails) GetDnsNames

func (x *NetworkDetails) GetDnsNames() []string

func (*NetworkDetails) GetEndpoint

func (x *NetworkDetails) GetEndpoint() string

func (*NetworkDetails) ProtoMessage

func (*NetworkDetails) ProtoMessage()

func (*NetworkDetails) ProtoReflect

func (x *NetworkDetails) ProtoReflect() protoreflect.Message

func (*NetworkDetails) Reset

func (x *NetworkDetails) Reset()

func (*NetworkDetails) String

func (x *NetworkDetails) String() string

type Organization

type Organization struct {

	// BFF Unique Identifier and Record Information
	Id        string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name      string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	LogoUrl   string `protobuf:"bytes,3,opt,name=logo_url,json=logoUrl,proto3" json:"logo_url,omitempty"`
	Domain    string `protobuf:"bytes,4,opt,name=domain,proto3" json:"domain,omitempty"`
	CreatedBy string `protobuf:"bytes,5,opt,name=created_by,json=createdBy,proto3" json:"created_by,omitempty"`
	// Directory Registrations for Lookups
	// TODO: populate these details in the Registration Endpoint
	Testnet *DirectoryRecord `protobuf:"bytes,10,opt,name=testnet,proto3" json:"testnet,omitempty"`
	Mainnet *DirectoryRecord `protobuf:"bytes,11,opt,name=mainnet,proto3" json:"mainnet,omitempty"`
	// Collaborators
	Collaborators map[string]*Collaborator `` /* 168-byte string literal not displayed */
	// Registration Form
	Registration *RegistrationForm `protobuf:"bytes,13,opt,name=registration,proto3" json:"registration,omitempty"`
	// Metadata as RFC3339Nano Timestamps
	Created  string `protobuf:"bytes,14,opt,name=created,proto3" json:"created,omitempty"`
	Modified string `protobuf:"bytes,15,opt,name=modified,proto3" json:"modified,omitempty"`
	// contains filtered or unexported fields
}

The Organization document contains VASP-specific information for a single VASP record in the directory service. This document differs in that it stores information relevant to the BFF and should not be used to duplicate storage in the directory.

func (*Organization) AddCollaborator

func (org *Organization) AddCollaborator(collab *Collaborator) (err error)

Add a new collaborator to an organization record. The given collaborator record is validated before being added to the organization. Note: The caller is responsible for saving the updated organization record to the database.

func (*Organization) DeleteCollaborator added in v1.6.0

func (org *Organization) DeleteCollaborator(email string)

Delete a collaborator by email address. Note that this will not return an error if the collaborator does not exist on the organization.

func (*Organization) Descriptor deprecated

func (*Organization) Descriptor() ([]byte, []int)

Deprecated: Use Organization.ProtoReflect.Descriptor instead.

func (*Organization) GetCollaborator added in v1.6.0

func (org *Organization) GetCollaborator(email string) (collab *Collaborator)

Retrieve a collaborator by email address. Returns nil if the collaborator does not exist on the organization.

func (*Organization) GetCollaborators

func (x *Organization) GetCollaborators() map[string]*Collaborator

func (*Organization) GetCreated

func (x *Organization) GetCreated() string

func (*Organization) GetCreatedBy added in v1.6.0

func (x *Organization) GetCreatedBy() string

func (*Organization) GetDomain added in v1.6.0

func (x *Organization) GetDomain() string

func (*Organization) GetId

func (x *Organization) GetId() string

func (*Organization) GetLogoUrl

func (x *Organization) GetLogoUrl() string

func (*Organization) GetMainnet

func (x *Organization) GetMainnet() *DirectoryRecord

func (*Organization) GetModified

func (x *Organization) GetModified() string

func (*Organization) GetName

func (x *Organization) GetName() string

func (*Organization) GetRegistration

func (x *Organization) GetRegistration() *RegistrationForm

func (*Organization) GetTestnet

func (x *Organization) GetTestnet() *DirectoryRecord

func (*Organization) Key

func (org *Organization) Key() []byte

func (*Organization) ProtoMessage

func (*Organization) ProtoMessage()

func (*Organization) ProtoReflect

func (x *Organization) ProtoReflect() protoreflect.Message

func (*Organization) Reset

func (x *Organization) Reset()

func (*Organization) ResolveName added in v1.6.0

func (org *Organization) ResolveName() string

ResolveName returns the name of the organization, parsing it from the registration form if necessary. If no name is available, it returns a default name.

func (*Organization) String

func (x *Organization) String() string

func (*Organization) UUID

func (org *Organization) UUID() uuid.UUID

type RegistrationForm

type RegistrationForm struct {

	// Business information: Basic Details Step
	Website          string                   `protobuf:"bytes,1,opt,name=website,proto3" json:"website,omitempty"`
	BusinessCategory v1beta1.BusinessCategory `` /* 157-byte string literal not displayed */
	VaspCategories   []string                 `protobuf:"bytes,3,rep,name=vasp_categories,json=vaspCategories,proto3" json:"vasp_categories,omitempty"`
	EstablishedOn    string                   `protobuf:"bytes,4,opt,name=established_on,json=establishedOn,proto3" json:"established_on,omitempty"`
	OrganizationName string                   `protobuf:"bytes,5,opt,name=organization_name,json=organizationName,proto3" json:"organization_name,omitempty"`
	// IVMS 101 Legal Person record: Legal Person Step
	Entity *ivms101.LegalPerson `protobuf:"bytes,11,opt,name=entity,proto3" json:"entity,omitempty"`
	// Directory Record contacts: Contacts Step
	Contacts *v1beta1.Contacts `protobuf:"bytes,12,opt,name=contacts,proto3" json:"contacts,omitempty"`
	// TRIXO Form: TRIXO Step
	Trixo *v1beta1.TRIXOQuestionnaire `protobuf:"bytes,13,opt,name=trixo,proto3" json:"trixo,omitempty"`
	// Network-specific information and submission details: TRISA Step
	Testnet *NetworkDetails `protobuf:"bytes,14,opt,name=testnet,proto3" json:"testnet,omitempty"`
	Mainnet *NetworkDetails `protobuf:"bytes,15,opt,name=mainnet,proto3" json:"mainnet,omitempty"`
	// Current progress of the form for the frontend
	State *FormState `protobuf:"bytes,20,opt,name=state,proto3" json:"state,omitempty"`
	// contains filtered or unexported fields
}

RegistrationForm is an extension of the TRISA GDS RegistrationRequest with BFF fields.

func NewRegisterForm

func NewRegisterForm() *RegistrationForm

NewRegisterForm returns a new registration form with default values.

func (*RegistrationForm) Descriptor deprecated

func (*RegistrationForm) Descriptor() ([]byte, []int)

Deprecated: Use RegistrationForm.ProtoReflect.Descriptor instead.

func (*RegistrationForm) GetBusinessCategory

func (x *RegistrationForm) GetBusinessCategory() v1beta1.BusinessCategory

func (*RegistrationForm) GetContacts

func (x *RegistrationForm) GetContacts() *v1beta1.Contacts

func (*RegistrationForm) GetEntity

func (x *RegistrationForm) GetEntity() *ivms101.LegalPerson

func (*RegistrationForm) GetEstablishedOn

func (x *RegistrationForm) GetEstablishedOn() string

func (*RegistrationForm) GetMainnet

func (x *RegistrationForm) GetMainnet() *NetworkDetails

func (*RegistrationForm) GetOrganizationName

func (x *RegistrationForm) GetOrganizationName() string

func (*RegistrationForm) GetState

func (x *RegistrationForm) GetState() *FormState

func (*RegistrationForm) GetTestnet

func (x *RegistrationForm) GetTestnet() *NetworkDetails

func (*RegistrationForm) GetTrixo

func (*RegistrationForm) GetVaspCategories

func (x *RegistrationForm) GetVaspCategories() []string

func (*RegistrationForm) GetWebsite

func (x *RegistrationForm) GetWebsite() string

func (*RegistrationForm) MarshalJSON

func (r *RegistrationForm) MarshalJSON() ([]byte, error)

MarshalJSON uses protojson with default marshaling options.

func (*RegistrationForm) MarshalStep added in v1.7.0

func (r *RegistrationForm) MarshalStep(step StepType) (intermediate map[string]interface{}, err error)

func (*RegistrationForm) MarshalStepJSON added in v1.7.0

func (r *RegistrationForm) MarshalStepJSON(step StepType) (_ []byte, err error)

MarshalStepJSON excludes all fields not related to the specified step when returning JSON data, ensuring the front-end only gets the data it needs.

func (*RegistrationForm) ProtoMessage

func (*RegistrationForm) ProtoMessage()

func (*RegistrationForm) ProtoReflect

func (x *RegistrationForm) ProtoReflect() protoreflect.Message

func (*RegistrationForm) ReadyToSubmit

func (r *RegistrationForm) ReadyToSubmit(network string) bool

ReadyToSubmit performs very lightweight validation, ensuring that there are non-nil values on the nested data structures so that the request to the GDS does not fail. For data validation (required fields, types, etc.), we should rely on the GDS response to ensure that we're able to submit valid forms and that validation only occurs in one place in the code.

func (*RegistrationForm) Reset

func (x *RegistrationForm) Reset()

func (*RegistrationForm) String

func (x *RegistrationForm) String() string

func (*RegistrationForm) Truncate added in v1.7.0

func (r *RegistrationForm) Truncate(step StepType) (*RegistrationForm, error)

Truncate reutrns a new registration form with only the specified step's data. If none or all is specified then the original registration form is returned without error.

func (*RegistrationForm) TruncateBasicDetails added in v1.7.0

func (r *RegistrationForm) TruncateBasicDetails() *RegistrationForm

Returns a registration form with only the original details.

func (*RegistrationForm) TruncateContacts added in v1.7.0

func (r *RegistrationForm) TruncateContacts() *RegistrationForm

Returns a registration form with only the contacts (same pointer).

func (*RegistrationForm) TruncateLegalPerson added in v1.7.0

func (r *RegistrationForm) TruncateLegalPerson() *RegistrationForm

Returns a registration form with only the IVMS101 legal person entity (same pointer).

func (*RegistrationForm) TruncateTRISA added in v1.7.0

func (r *RegistrationForm) TruncateTRISA() *RegistrationForm

Returns a registration form with only the network details (same pointers).

func (*RegistrationForm) TruncateTRIXO added in v1.7.0

func (r *RegistrationForm) TruncateTRIXO() *RegistrationForm

Returns a registration form with only the TRIXO form (same pointer).

func (*RegistrationForm) UnmarshalJSON

func (r *RegistrationForm) UnmarshalJSON(data []byte) error

UnmarshalJSON uses protojson with default unmarshaling options.

func (*RegistrationForm) Update added in v1.7.0

func (r *RegistrationForm) Update(o *RegistrationForm, step StepType) error

Update the registration form from another registration form model. If a step is specified then only that step from the other registration form is copied to this form otherwise the entire registration form is updated. If there is an update error it is returned, otherwise validation is performed and ValidationErrors are returned.

func (*RegistrationForm) UpdateBasicDetails added in v1.7.0

func (r *RegistrationForm) UpdateBasicDetails(o *RegistrationForm) error

Update only the fields from the basic details step.

func (*RegistrationForm) UpdateContacts added in v1.7.0

func (r *RegistrationForm) UpdateContacts(o *RegistrationForm) error

Update only the fields from the contacts step.

func (*RegistrationForm) UpdateLegalPerson added in v1.7.0

func (r *RegistrationForm) UpdateLegalPerson(o *RegistrationForm) error

Update only the fields from the legal person step.

func (*RegistrationForm) UpdateTRISA added in v1.7.0

func (r *RegistrationForm) UpdateTRISA(o *RegistrationForm) error

Update only the fields from the TRISA step.

func (*RegistrationForm) UpdateTRIXO added in v1.7.0

func (r *RegistrationForm) UpdateTRIXO(o *RegistrationForm) error

Update only the fields from the TRIXO step.

func (*RegistrationForm) Validate added in v1.7.0

func (r *RegistrationForm) Validate(step StepType) error

Validate the registration form returning all field errors as opposed to a single error that shortcircuits when the first validation error is found. If a step is specified then only that step's fields are validated.

func (*RegistrationForm) ValidateBasicDetails added in v1.7.0

func (r *RegistrationForm) ValidateBasicDetails() error

Validate only the fields in the basic details step.

func (*RegistrationForm) ValidateContacts added in v1.7.0

func (r *RegistrationForm) ValidateContacts() error

Validate only the fields in the contacts step.

func (*RegistrationForm) ValidateLegalPerson added in v1.7.0

func (r *RegistrationForm) ValidateLegalPerson() error

Validate only the fields in the legal person step.

func (*RegistrationForm) ValidateTRISA added in v1.7.0

func (r *RegistrationForm) ValidateTRISA() error

Validate only the fields in the trisa step.

func (*RegistrationForm) ValidateTRIXO added in v1.7.0

func (r *RegistrationForm) ValidateTRIXO() error

Validate only the fields in the trixo step.

type StepType added in v1.7.0

type StepType string

StepType represents a collection of fields in the registration form that are handled together as a single step when the user is filling in the registration form.

const (
	StepNone         StepType = ""
	StepAll          StepType = "all"
	StepBasicDetails StepType = "basic"
	StepLegalPerson  StepType = "legal"
	StepContacts     StepType = "contacts"
	StepTRISA        StepType = "trisa"
	StepTRIXO        StepType = "trixo"
)

func ParseStepType added in v1.7.0

func ParseStepType(s string) (StepType, error)

Parse a string as a step type.

func (StepType) String added in v1.7.0

func (s StepType) String() string

type ValidationError added in v1.7.0

type ValidationError struct {
	Field string
	Err   string
	Index int
}

func (*ValidationError) Error added in v1.7.0

func (v *ValidationError) Error() string

type ValidationErrors added in v1.7.0

type ValidationErrors []*ValidationError

func (ValidationErrors) Append added in v1.7.0

func (v ValidationErrors) Append(err error) (ValidationErrors, bool)

If err is a ValidationErrors then append them to this list of validation errors and return true, otherwise return false since we can't append random errors.

func (ValidationErrors) Error added in v1.7.0

func (v ValidationErrors) Error() string

Jump to

Keyboard shortcuts

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