Documentation
¶
Index ¶
- Variables
- func AddInspector(userIndex int) error
- func CreateHomeDir()
- func DeleteKeyFromBucket(key int, bucketName []byte) error
- func NewPlatform(name string, code string, timeout bool) error
- func OpenDB() (*bolt.DB, error)
- func RetrieveAllPfLim() (int, error)
- func RetrieveAllUsersLim() (int, error)
- type AnchorKYCHelper
- type KycStruct
- type MailboxHelper
- type Platform
- type StellWallet
- type User
- func CheckUsernameCollision(uname string) (User, error)
- func NewUser(uname string, pwhash string, seedpwd string, email string) (User, error)
- func RetrieveAllAdmins() ([]User, error)
- func RetrieveAllUsers() ([]User, error)
- func RetrieveAllUsersWithKyc() ([]User, error)
- func RetrieveAllUsersWithoutKyc() ([]User, error)
- func RetrieveUser(key int) (User, error)
- func SearchWithEmailID(email string) (User, error)
- func TopReputationUsers() ([]User, error)
- func ValidateAccessToken(name string, accessToken string) (User, error)
- func ValidatePwhash(name string, pwhash string) (User, error)
- func ValidatePwhashReg(name string, pwhash string) (User, error)
- func ValidateSeedpwd(name string, pwhash string, seedpwd string) (User, error)
- func ValidateSeedpwdAuthToken(name string, token string, seedpwd string) (User, error)
- func (a *User) AddEmail(email string) error
- func (a *User) AddtoMailbox(subject string, message string) error
- func (a *User) AllLogout() error
- func (a *User) Authenticate2FA(password string) (bool, error)
- func (a *User) Authorize(userIndex int) error
- func (a *User) ChangeReputation(reputation float64) error
- func (a *User) GenAccessToken() (string, error)
- func (a *User) GenKeys(seedpwd string, options ...string) error
- func (a *User) Generate2FA() (string, error)
- func (a *User) GiveFeedback(userIndex int, feedback int) error
- func (a *User) ImportSeed(encryptedSeed []byte, pubkey string, seedpwd string) error
- func (a *User) IncreaseTrustLimit(seedpwd string, trust float64) error
- func (a *User) MoveFundsFromSecondaryWallet(amount float64, seedpwd string) error
- func (a *User) Save() error
- func (a *User) SetBan(userIndex int) error
- func (a *User) SweepSecondaryWallet(seedpwd string) error
- func (a *User) UnverReq() error
- func (a *User) VerReq() error
Constants ¶
This section is empty.
Variables ¶
var PlatformBucket = []byte("Platforms")
PlatformBucket is the bucket where we'll store platforms that are under openx1
var UserBucket = []byte("Users")
UserBucket is the bucket in which we'll store openx users
Functions ¶
func AddInspector ¶
AddInspector sets the Inspector flag on a user
func DeleteKeyFromBucket ¶
DeleteKeyFromBucket deletes an object from the passed bucket
func NewPlatform ¶
NewPlatform creates a new platform and stores it in the database
func RetrieveAllPfLim ¶
RetrieveAllPfLim gets the number of platforms in the platform bucket
func RetrieveAllUsersLim ¶
RetrieveAllUsersLim gets the number of users in the bucket
Types ¶
type AnchorKYCHelper ¶
type AnchorKYCHelper struct {
Name string
Birthday struct {
Month string
Day string
Year string
}
Tax struct {
Country string
ID string
}
Address struct {
Street string
City string
Postal string
Region string
Country string
Phone string
}
PrimaryPhone string
Gender string
DepositIdentifier string
WithdrawIdentifier string
URL string
AccountID string
}
AnchorKYCHelper contains the KYC parameters required by Anchor
type KycStruct ¶
type KycStruct struct {
PassportPhoto string
IDCardPhoto string
DriversLicense string
PersonalPhoto string
}
KycStruct contains the parameters required by ComplyAdvantage
type MailboxHelper ¶
type MailboxHelper struct {
Subject string // the subject can be used to send push notifications
Message string // the message
}
MailboxHelper is a helper struct that can be used to send admin notifications to users
type Platform ¶
Platform is a struct which holds all platform related info
func RetrieveAllPlatforms ¶
RetrieveAllPlatforms retrieves all platforms from the database
func RetrievePlatform ¶
RetrievePlatform retrieves a Platform from the database
type StellWallet ¶
StellWallet hold the Stellar Publickey and Encrypted Seed
type User ¶
type User struct {
// Index is an incremental index maintained to easily retrieve users
Index int
// Name is the real name of the user
Name string
// Description contains some other stuff that a user might wish to describe about themselves
Description string
// Image is an optional profile image that users might upload
Image string
// FirstSignedUp contains the date on which the users signed up on openx
FirstSignedUp string
// Address is the address of the user
Address string
// City denotes the city of residence of the user
City string
// ZipCode is the zipcode iof the user's residence
ZipCode string
// Country is the country of residence of the user. Some platforms may be restricted to a certain subset of countries
Country string
// RecoveryPhone used to send recovery codes or contact the user in the event of an emergency
RecoveryPhone string
// Email is used to send users notifications on their actions on openx based platforms
Email string
// Notification is a bool which denotes whether the user wants to receive notifications related to the openx platform
Notification bool
// StellarWallet contains a publickey and encrypted seed that can be used to interact with the Stellar blockchain
StellarWallet StellWallet
// AlgorandWallet contains a publickey and privatekey pair which can be used to interact with the Algorand blockchain
AlgorandWallet algorand.Wallet
// Username denoteds the username of the user to log on to openx
Username string
// Pwhash is the 512 byte SHA-3 hash of the user's password
Pwhash string
// Kyc denotes whether the user has passed KYC
Kyc bool
// Admin denotes whether the user has passed kyc or not
Admin bool
// Inspector denotes whether the user is a KYC inspector ie whether they're authorized to approve other's KYC requests
Inspector bool
// Banned is true if the user is banned on openx
Banned bool
// Reputation is a float which denotes the reputation of a user on the openx platform
Reputation float64
// LocalAssets is a list of P2P assets belonging to the user
LocalAssets []string
RecoveryShares []string
// PwdResetCode is a code that's set when a user wants to reset their password
PwdResetCode string
// SecondaryWallet is a secondary wallet where people can store their funds in
SecondaryWallet StellWallet
// PendingDocuments is a list of pending documents which a user must upload before progressing on to the next stage
PendingDocuments map[string]string
// KYC contains KYC information required by ComplyAdvantage
KYC KycStruct
// StarRating is a star rating similar to popular platforms which users can use to rate each other
StarRating map[int]int
// GivenStarRating contains a list of users whom this user has rated
GivenStarRating map[int]int
// TwoFASecret is the secret associated with Google 2FA that users can enable while logging on openx
TwoFASecret string
// AnchorKYC contains KYC information required by AnchorUSD
AnchorKYC AnchorKYCHelper
// AccessToken is the access token that will be used for authenticating RPC requests made to the server
AccessToken map[string]int64
// Mailbox is a mailbox where admins can send you messages or updated on your invested / interested projects
Mailbox []MailboxHelper
// Legal is a bool which is set when the user accepts the terms and conditions
Legal bool
// ProfileProgress is a float which denotes user profile completeness on the frontend
ProfileProgress float64
// Verified marks a person as verified
Verified bool
// VerifyReq requests verification
VerifyReq bool
// VerifiedBy stores the index of the admin who verified the user
VerifiedBy int
// VerifiedTime stores when the user was verified
VerifiedTime string
// ConfToken is the confirmation token sent to users to confirm their registration on openx
ConfToken string
// Conf is a bool that is set to true when users confirm their tokens
Conf bool
}
User defines a base layer structure that can be used by entities on platforms built on openx
func CheckUsernameCollision ¶
CheckUsernameCollision checks if a passed username collides with someone who's already on the platform. If a collision does exist, return the existing user in the database
func NewUser ¶
NewUser creates a new user, stores it in the openx database and returns a user struct
func RetrieveAllAdmins ¶
RetrieveAllAdmins retrieves a list of all admisn from the database
func RetrieveAllUsers ¶
RetrieveAllUsers gets a list of all Users in the database
func RetrieveAllUsersWithKyc ¶
RetrieveAllUsersWithKyc retrieves all users with kyc
func RetrieveAllUsersWithoutKyc ¶
RetrieveAllUsersWithoutKyc retrieves all users without kyc
func RetrieveUser ¶
RetrieveUser retrieves a User from the database
func SearchWithEmailID ¶ added in v1.0.5
SearchWithEmailID searches for a user given their email id
func TopReputationUsers ¶
TopReputationUsers gets a list of users sorted by descending reputation
func ValidateAccessToken ¶
ValidateAccessToken validates a username / accessToken combination
func ValidatePwhash ¶
ValidatePwhash validates a username / pwhash combination
func ValidatePwhashReg ¶ added in v1.0.4
ValidatePwhashReg validates a username / pwhash combination during registration
func ValidateSeedpwd ¶
ValidateSeedpwd validates a user and their seedpwd
func ValidateSeedpwdAuthToken ¶
ValidateSeedpwdAuthToken validates a user and their seedpwd using their accesstoken
func (*User) AddtoMailbox ¶
AddtoMailbox adds a message to a user's mailbox
func (*User) Authenticate2FA ¶
Authenticate2FA authenticates the given password against the user's stored 2fA secret
func (*User) ChangeReputation ¶
ChangeReputation changes the reputation associated with a user
func (*User) GenAccessToken ¶
GenAccessToken generates a new access token for the user
func (*User) GenKeys ¶
GenKeys generates a keypair for the user and takes in options on which blockchain to generate keys for
func (*User) Generate2FA ¶
Generate2FA generates a new 2FA secret for the given user
func (*User) GiveFeedback ¶
GiveFeedback is used to rate another user
func (*User) ImportSeed ¶
ImportSeed can be used to import an ecrypted seed
func (*User) IncreaseTrustLimit ¶
IncreaseTrustLimit increases the trust limit of a user towards the in house stablecoin
func (*User) MoveFundsFromSecondaryWallet ¶
MoveFundsFromSecondaryWallet moves XLM from the secondary wallet to the primary wallet
func (*User) SweepSecondaryWallet ¶
SweepSecondaryWallet sweeps XLM from the secondary account to the primary account