Documentation
¶
Overview ¶
***************************************************************************
- Copyright (C) 2023 CrowdWare *
- This file is part of SHIFT. *
- SHIFT is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- SHIFT is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. *
- You should have received a copy of the GNU General Public License
- along with SHIFT. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************
***************************************************************************
- Copyright (C) 2023 CrowdWare *
- This file is part of SHIFT. *
- SHIFT is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- SHIFT is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. *
- You should have received a copy of the GNU General Public License
- along with SHIFT. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************
***************************************************************************
- Copyright (C) 2023 CrowdWare *
- This file is part of SHIFT. *
- SHIFT is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- SHIFT is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. *
- You should have received a copy of the GNU General Public License
- along with SHIFT. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************
***************************************************************************
- Copyright (C) 2023 CrowdWare *
- This file is part of SHIFT. *
- SHIFT is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- SHIFT is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. *
- You should have received a copy of the GNU General Public License
- along with SHIFT. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************
***************************************************************************
- Copyright (C) 2023 CrowdWare *
- This file is part of SHIFT. *
- SHIFT is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- SHIFT is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. *
- You should have received a copy of the GNU General Public License
- along with SHIFT. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************
***************************************************************************
- Copyright (C) 2023 CrowdWare *
- This file is part of SHIFT. *
- SHIFT is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- SHIFT is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. *
- You should have received a copy of the GNU General Public License
- along with SHIFT. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************
***************************************************************************
- Copyright (C) 2023 CrowdWare *
- This file is part of SHIFT. *
- SHIFT is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- SHIFT is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. *
- You should have received a copy of the GNU General Public License
- along with SHIFT. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************
***************************************************************************
- Copyright (C) 2023 CrowdWare *
- This file is part of SHIFT. *
- SHIFT is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- SHIFT is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. *
- You should have received a copy of the GNU General Public License
- along with SHIFT. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************
***************************************************************************
- Copyright (C) 2023 CrowdWare *
- This file is part of SHIFT. *
- SHIFT is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- SHIFT is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details. *
- You should have received a copy of the GNU General Public License
- along with SHIFT. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************
Index ¶
- Constants
- func AcceptProposal() string
- func AddPeerFromQRCode(enc string) string
- func CanScoop() bool
- func CreateAccount(name, uuid, ruuid, country, language string) int
- func Decrypt(enc string) (string, error)
- func DeletePeerMassage(peerUuid, messageKey string) bool
- func Encrypt(value string) string
- func GetAccessToken() string
- func GetAgreementFromQRCode(enc string) string
- func GetAgreementQRCode() string
- func GetAgreementQRCodeForTransaction(pkey string) string
- func GetBalanceInMillis() int64
- func GetBucketName() string
- func GetEncodedUuid() string
- func GetMatelist() string
- func GetMessages() string
- func GetName() string
- func GetPeerQRCode() string
- func GetProposalFromQRCode(enc string) string
- func GetProposalQRCode(amount int64, purpose string) string
- func GetScoopedBalance() int64
- func GetScoopingHours() float64
- func GetTransactions() string
- func GetUuid() string
- func HasJoined() bool
- func Init(filesDir string, useWS bool)
- func IsScooping() bool
- func RefreshMessages()
- func SendMessageToPeer(peerUuid string, message string) string
- func SetName(name string)
- func SetStorj(bucketName string, accessKey string) bool
- func SetUseWebService(useWS bool)
- func StartScooping() int
- type BalanceError
- type Friend
- type MessageTO
- type TransactionTO
- type TransactionType
Constants ¶
const ( Unknown TransactionType = iota InitialBooking = 1 Scooped = 2 Lmp = 3 // liquid micro payment Lmr = 4 // liquid micro receive Subtotal = 5 )
Variables ¶
This section is empty.
Functions ¶
func AcceptProposal ¶
func AcceptProposal() string
** When GetProposalFromQRCode is called, then this transaction is stored temporary ** In this method we take the last transaction and withdraw it from the account. ** We don't want to have a public function for adding transactions.
func AddPeerFromQRCode ¶
** Decrypt the QR-Code, unmarshalls the peer and add it to the peer list
func CreateAccount ¶
** Create the account and send it to the rest service. ** This is only called once running the app for the first time. ** The invite code may come as uuid or an encoded uuid.
func DeletePeerMassage ¶
** Deletes a message from Storj
func GetAgreementFromQRCode ¶
** We encrypt the QR-Code, unpack and validate the transaction and when ** everything is fine we book it.
func GetAgreementQRCode ¶
func GetAgreementQRCode() string
** Create a transation, pack it to a json string and return the encrypted string. ** On the client a QR code will be created based on that string.
func GetAgreementQRCodeForTransaction ¶
** Get a transaction from account, pack it to a json string and return the encrypted string. ** This is used in case the giver skipped the last step and wants to recreate the qr code.
func GetBalanceInMillis ¶
func GetBalanceInMillis() int64
** Sum up all transactions after subtracting the demurrage.
func GetEncodedUuid ¶
func GetEncodedUuid() string
func GetMatelist ¶
func GetMatelist() string
** Get a list of all mates from rest service, pack them into json and return the json string. ** We are also adding the user from the peerlist. These are the users with whom we exchanged ** Our public key and storj access with.
func GetMessages ¶
func GetMessages() string
** Get the messages from message.db ** TODO: Only return the last X newest messages ordered by time ** TODO: Paging, read first 50 messages, then read 51-100, and so forth ** TODO: Readed should be filled if receiver deleted the message
func GetProposalFromQRCode ¶
** We decrypt the string from a QR code, unpack and validate the transaction ** and send back the json to the client (we cannot send objects to Kotlin). ** If it cannot be decrypted or unpacked its a sign for an attack.
func GetProposalQRCode ¶
** Create a transaction, pack it to a json string and return the encrypted string. ** On the client a QR code will be created based on that string.
func GetScoopedBalance ¶
func GetScoopedBalance() int64
** Calculate the scooped amount which since last setScooping, to be displayed ** on the client while balance display is in milli liter mode.
func GetScoopingHours ¶
func GetScoopingHours() float64
** Returns the amount of hours the account is scooping
func GetTransactions ¶
func GetTransactions() string
** Get a list of the last 30 transactions, pack it into a json string and return it.
func IsScooping ¶
func IsScooping() bool
** Checks if account is scooping and is already 20 hours ago. ** If so a new scooped transaction is added and isScooping is set to false. ** The function returns this isScooping flag.
func RefreshMessages ¶
func RefreshMessages()
** Loading all new messages for each peer and save them in the database
func SendMessageToPeer ¶
** Puts an encrypted message on the Storj bucket from the peer
func StartScooping ¶
func StartScooping() int
** Set the account in scooping mode, scooping is set to now and rest method is called. ** The level counts will be set after the rest call.
Types ¶
type BalanceError ¶
type BalanceError struct {
// contains filtered or unexported fields
}
func (*BalanceError) Error ¶
func (e *BalanceError) Error() string
type TransactionTO ¶
type TransactionTO struct { Pkey string Amount int64 Date int64 From string To string Purpose string Typ int }
** This is needed to create a json string to be sent to the client.
type TransactionType ¶
type TransactionType byte