mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-20 03:47:50 +01:00
Simplified profile code.
This commit is contained in:
32
Profile Data.go
Normal file
32
Profile Data.go
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
File Name: Profile Data.go
|
||||
Copyright: 2021 Peernet s.r.o.
|
||||
Author: Peter Kleissner
|
||||
*/
|
||||
|
||||
package core
|
||||
|
||||
// List of recognized profile fields.
|
||||
const (
|
||||
ProfileName = 0 // Arbitrary username
|
||||
ProfileEmail = 1 // Email address
|
||||
ProfileWebsite = 2 // Website address
|
||||
ProfileTwitter = 3 // Twitter account without the @
|
||||
ProfileYouTube = 4 // YouTube channel URL
|
||||
ProfileAddress = 5 // Physical address
|
||||
ProfilePicture = 6 // Profile picture, blob
|
||||
)
|
||||
|
||||
// The encoding of profile fields depends on the field. Text data is always UTF-8 text encoded.
|
||||
// Note that all profile data is arbitrary and shall be considered untrusted and unverified.
|
||||
// To establish trust, the user must load Certificates into the blockchain that validate certain data.
|
||||
|
||||
// Text returns the profile field as text encoded
|
||||
func (info *BlockRecordProfile) Text() string {
|
||||
return string(info.Data)
|
||||
}
|
||||
|
||||
// ProfileFieldFromText returns a profile field from text
|
||||
func ProfileFieldFromText(Type uint16, Text string) BlockRecordProfile {
|
||||
return BlockRecordProfile{Type: Type, Data: []byte(Text)}
|
||||
}
|
||||
Reference in New Issue
Block a user