common

package
v0.14.8 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: GPL-3.0 Imports: 31 Imported by: 0

README

Sonr DID

Sonr DID is a module for building, verifying, specifying, and parsing DIDs for the Sonr blockchain.

Description

Sonr is building the most immersive DWeb experience for both Users and Developers alike. We believe the best way to onboard the next billion users is to create a cohesive end-to-end platform that’s composable and interoperable with all existing protocols.

For this we built our Networking layer in Libp2p and our Layer 1 Blockchain with Starport. Our network comprises of two separate nodes: Highway and Motor, which each have a specific use case on the network. In order to maximize the onboarding experience, we developed our own Wallet which has value out of the gate!

Getting Started

Dependencies
Installing

To install the latest version of the Sonr blockchain node's binary, execute the following command on your machine:

go get -u https://github.com/sonr-io/did
Configuration

This project is a pseudo-monorepo, meaning it has a single root directory and all of its packages are in subdirectories. The structure is as follows:

/beam            ->        Real-time Key/Value Store
/common          ->        Core data types and functions.
/device          ->        Node Device management
/docs            ->        Documentation.
/exchange        ->        Data Transfer related Models.
/host            ->        Libp2p Host Configuration
/identity        ->        Identity management models and interfaces
/node            ->        Highway and Motor node builder configuration
/proto           ->        Protobuf Definition Files.
/transmit        ->        Protocol for byte transmission between nodes
/types           ->        Protobuf Compiled Types
  └─ cpp         ->        +   C++ Definition Files
  └─ go          ->        +   Golang Definition Files
  └─ java        ->        +   Java Definition Files
/wallet          ->        Interfaces for managing Universal Wallet

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Authors

Contributors names and contact info

  • Prad Nukala

License

This project facilitated under Sonr Inc. is distributed under the GPLv3 License. See LICENSE.md for more information.

Acknowledgments

Inspiration, code snippets, etc.

Documentation

Index

Constants

View Source
const (
	PublicKeyJwk       = "PublicKeyJwk"
	PublicKeyMultibase = "PublicKeyMultibase"
)
View Source
const (
	Method = "did:sonr"
)

Variables

View Source
var (
	Connection_name = map[int32]string{
		0: "CONNECTION_UNSPECIFIED",
		1: "CONNECTION_WIFI",
		2: "CONNECTION_ETHERNET",
		3: "CONNECTION_MOBILE",
		4: "CONNECTION_OFFLINE",
	}
	Connection_value = map[string]int32{
		"CONNECTION_UNSPECIFIED": 0,
		"CONNECTION_WIFI":        1,
		"CONNECTION_ETHERNET":    2,
		"CONNECTION_MOBILE":      3,
		"CONNECTION_OFFLINE":     4,
	}
)

Enum value maps for Connection.

View Source
var (
	MIME_Type_name = map[int32]string{
		0: "TYPE_UNSPECIFIED",
		1: "TYPE_AUDIO",
		2: "TYPE_DOCUMENT",
		3: "TYPE_IMAGE",
		4: "TYPE_TEXT",
		5: "TYPE_VIDEO",
		6: "TYPE_URL",
		7: "TYPE_CRYPTO",
	}
	MIME_Type_value = map[string]int32{
		"TYPE_UNSPECIFIED": 0,
		"TYPE_AUDIO":       1,
		"TYPE_DOCUMENT":    2,
		"TYPE_IMAGE":       3,
		"TYPE_TEXT":        4,
		"TYPE_VIDEO":       5,
		"TYPE_URL":         6,
		"TYPE_CRYPTO":      7,
	}
)

Enum value maps for MIME_Type.

View Source
var (
	Peer_Status_name = map[int32]string{
		0: "STATUS_UNSPECIFIED",
		1: "STATUS_ONLINE",
		2: "STATUS_AWAY",
		3: "STATUS_BUSY",
	}
	Peer_Status_value = map[string]int32{
		"STATUS_UNSPECIFIED": 0,
		"STATUS_ONLINE":      1,
		"STATUS_AWAY":        2,
		"STATUS_BUSY":        3,
	}
)

Enum value maps for Peer_Status.

View Source
var (
	Direction_name = map[int32]string{
		0: "DIRECTION_UNSPECIFIED",
		1: "DIRECTION_INCOMING",
		2: "DIRECTION_OUTGOING",
	}
	Direction_value = map[string]int32{
		"DIRECTION_UNSPECIFIED": 0,
		"DIRECTION_INCOMING":    1,
		"DIRECTION_OUTGOING":    2,
	}
)

Enum value maps for Direction.

View Source
var (
	ErrFragmentAndQuery = errors.New("Unable to create new DID. Fragment and Query are mutually exclusive")
	ErrParseInvalid     = errors.New("Unable to parse string into DID, invalid format.")
)
View Source
var (
	ErrParentDirNotExists = errors.New("FileItem's Parent Directory does not exist")
	ErrEmptyData          = errors.New("Passed Buffer is Empty")
)
View Source
var (
	BucketType_name = map[int32]string{
		0: "BUCKET_TYPE_UNSPECIFIED",
		1: "BUCKET_TYPE_APP",
		2: "BUCKET_TYPE_USER",
	}
	BucketType_value = map[string]int32{
		"BUCKET_TYPE_UNSPECIFIED": 0,
		"BUCKET_TYPE_APP":         1,
		"BUCKET_TYPE_USER":        2,
	}
)

Enum value maps for BucketType.

View Source
var (
	ObjectFieldType_name = map[int32]string{
		0: "OBJECT_FIELD_TYPE_UNSPECIFIED",
		1: "OBJECT_FIELD_TYPE_STRING",
		2: "OBJECT_FIELD_TYPE_INT",
		3: "OBJECT_FIELD_TYPE_FLOAT",
		4: "OBJECT_FIELD_TYPE_BOOL",
		5: "OBJECT_FIELD_TYPE_DATETIME",
		6: "OBJECT_FIELD_TYPE_BLOB",
		7: "OBJECT_FIELD_TYPE_REFERENCE",
	}
	ObjectFieldType_value = map[string]int32{
		"OBJECT_FIELD_TYPE_UNSPECIFIED": 0,
		"OBJECT_FIELD_TYPE_STRING":      1,
		"OBJECT_FIELD_TYPE_INT":         2,
		"OBJECT_FIELD_TYPE_FLOAT":       3,
		"OBJECT_FIELD_TYPE_BOOL":        4,
		"OBJECT_FIELD_TYPE_DATETIME":    5,
		"OBJECT_FIELD_TYPE_BLOB":        6,
		"OBJECT_FIELD_TYPE_REFERENCE":   7,
	}
)

Enum value maps for ObjectFieldType.

View Source
var DidForbiddenSymbolsRegexp, _ = regexp.Compile(`^[^&\\]+$`)
View Source
var File_common_core_proto protoreflect.FileDescriptor
View Source
var File_common_data_proto protoreflect.FileDescriptor
View Source
var File_common_did_proto protoreflect.FileDescriptor
View Source
var File_common_object_proto protoreflect.FileDescriptor
View Source
var ValidNetworkPrefixes = []string{
	"mainnet",
	"testnet",
	"devnet",
}
View Source
var VerificationMethodType = map[string]string{
	"JsonWebKey2020":             PublicKeyJwk,
	"Ed25519VerificationKey2020": PublicKeyMultibase,
}

Functions

func GetVerificationMethodType added in v0.14.3

func GetVerificationMethodType(vmType string) string

GetVerificationMethodType returns the verification method type

func IsDidFragment added in v0.14.3

func IsDidFragment(prefix string, didUrl string) bool

IsDidFragment checks if a DID fragment is valid

func IsFullDidFragment added in v0.14.3

func IsFullDidFragment(prefix string, didUrl string) bool

IsFullDidFragment checks if a DID fragment is for full string

func IsNotValidDIDArray added in v0.14.3

func IsNotValidDIDArray(prefix string, array []string) (bool, int)

IsNotValidDIDArray checks if a DID array is invalid

func IsNotValidDIDArrayFragment added in v0.14.3

func IsNotValidDIDArrayFragment(prefix string, array []string) (bool, int)

IsNotValidDIDArrayFragment checks if a DID array is invalid

func IsValidDid added in v0.14.3

func IsValidDid(prefix string, did string) bool

IsValidDid checks if a DID is valid

func IsValidNetworkPrefix added in v0.14.3

func IsValidNetworkPrefix(prefix string) bool

func NewThumbnail

func NewThumbnail(path string, tbuf []byte, mime *MIME, ch chan *Thumbnail)

NewThumbnail creates a new thumbnail for the given file

func SplitDidUrlIntoDidAndFragment added in v0.14.3

func SplitDidUrlIntoDidAndFragment(didUrl string) (string, string)

SplitDidUrlIntoDidAndFragment splits a DID URL into DID and fragment

Types

type Bucket added in v0.14.2

type Bucket struct {

	// Label is human-readable name of the bucket.
	Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"`
	// Description is a human-readable description of the bucket.
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	// Type is the kind of bucket for either App specific or User specific data.
	Type BucketType `protobuf:"varint,3,opt,name=type,proto3,enum=common.BucketType" json:"type,omitempty"`
	// Did is the identifier of the bucket.
	Did string `protobuf:"bytes,4,opt,name=did,proto3" json:"did,omitempty"`
	// Objects are stored in a tree structure.
	Objects []*ObjectDoc `protobuf:"bytes,5,rep,name=objects,proto3" json:"objects,omitempty"`
	// contains filtered or unexported fields
}

Bucket is a collection of objects.

func (*Bucket) Descriptor deprecated added in v0.14.2

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

Deprecated: Use Bucket.ProtoReflect.Descriptor instead.

func (*Bucket) GetDescription added in v0.14.2

func (x *Bucket) GetDescription() string

func (*Bucket) GetDid added in v0.14.2

func (x *Bucket) GetDid() string

func (*Bucket) GetLabel added in v0.14.2

func (x *Bucket) GetLabel() string

func (*Bucket) GetObjects added in v0.14.2

func (x *Bucket) GetObjects() []*ObjectDoc

func (*Bucket) GetType added in v0.14.2

func (x *Bucket) GetType() BucketType

func (*Bucket) ProtoMessage added in v0.14.2

func (*Bucket) ProtoMessage()

func (*Bucket) ProtoReflect added in v0.14.2

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

func (*Bucket) Reset added in v0.14.2

func (x *Bucket) Reset()

func (*Bucket) String added in v0.14.2

func (x *Bucket) String() string

type BucketType added in v0.14.2

type BucketType int32

BucketType is the type of a bucket.

const (
	// BucketTypeUnspecified is the default value.
	BucketType_BUCKET_TYPE_UNSPECIFIED BucketType = 0
	// BucketTypeApp is an App specific bucket. For Assets regarding the service.
	BucketType_BUCKET_TYPE_APP BucketType = 1
	// BucketTypeUser is a User specific bucket. For any remote user data that is required
	// to be stored in the Network.
	BucketType_BUCKET_TYPE_USER BucketType = 2
)

func (BucketType) Descriptor added in v0.14.2

func (BucketType) Descriptor() protoreflect.EnumDescriptor

func (BucketType) Enum added in v0.14.2

func (x BucketType) Enum() *BucketType

func (BucketType) EnumDescriptor deprecated added in v0.14.2

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

Deprecated: Use BucketType.Descriptor instead.

func (BucketType) Number added in v0.14.2

func (x BucketType) Number() protoreflect.EnumNumber

func (BucketType) String added in v0.14.2

func (x BucketType) String() string

func (BucketType) Type added in v0.14.2

type Connection

type Connection int32

Internet Connection Type

const (
	Connection_CONNECTION_UNSPECIFIED Connection = 0
	// ConnectionWifi is used for WiFi connections.
	Connection_CONNECTION_WIFI Connection = 1
	// ConnectionEthernet is used for Ethernet connections.
	Connection_CONNECTION_ETHERNET Connection = 2
	// ConnectionMobile is used for mobile connections.
	Connection_CONNECTION_MOBILE Connection = 3
	// CONNECTION_OFFLINE
	Connection_CONNECTION_OFFLINE Connection = 4 // No Internet Connection
)

func (Connection) Descriptor

func (Connection) Descriptor() protoreflect.EnumDescriptor

func (Connection) Enum

func (x Connection) Enum() *Connection

func (Connection) EnumDescriptor deprecated

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

Deprecated: Use Connection.Descriptor instead.

func (Connection) IsMdnsCompatible

func (c Connection) IsMdnsCompatible() bool

IsMdnsCompatible returns true if the Connection is MDNS compatible

func (Connection) Number

func (x Connection) Number() protoreflect.EnumNumber

func (Connection) String

func (x Connection) String() string

func (Connection) Type

type DefaultProfileOption

type DefaultProfileOption func(profileOpts)

DefaultProfileOption is a type for Profile Options

func WithCheckerProfile

func WithCheckerProfile(profile *Profile) DefaultProfileOption

WithCheckerProfile sets the checker profile

type Did added in v0.14.3

type Did struct {

	// Method is the method used to create the DID. For the Sonr network it is "sonr".
	Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
	// Network is the network the DID is on. For testnet it is "testnet". i.e "did:sonr:testnet:".
	Network string `protobuf:"bytes,2,opt,name=network,proto3" json:"network,omitempty"`
	// id is the trailing identifier after the network. i.e. "did:sonr:testnet:abc123"
	Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"`
	// Paths is a list of paths that the DID is valid for. This is used to identify the Service.
	Paths []string `protobuf:"bytes,4,rep,name=paths,proto3" json:"paths,omitempty"`
	// Query is the query string that was used to create the DID. This is followed by a '?'.
	Query string `protobuf:"bytes,5,opt,name=query,proto3" json:"query,omitempty"`
	// Fragment is the fragment string that was used to create the DID. This is followed by a '#'.
	Fragment string `protobuf:"bytes,6,opt,name=fragment,proto3" json:"fragment,omitempty"`
	// contains filtered or unexported fields
}

Did represents a string that has been parsed and validated as a DID. The parts are stored in the individual fields.

func CreateBaseDID added in v0.14.3

func CreateBaseDID(pubKey crypto.PubKey) (*Did, string, error)

CreateBaseDID creates a base DID with a given users libp2p public key

func CreateServiceDID added in v0.14.3

func CreateServiceDID(pubKey crypto.PubKey, name string) (*Did, string, error)

CreateServiceDID creates a service DID with a developers libp2p public key

func NewDID added in v0.14.3

func NewDID(id string, options ...Option) (*Did, error)

NewDID creates a new DID

func ParseDid added in v0.14.4

func ParseDid(s string) (*Did, error)

Parse parses a DID string into a DID struct

func (*Did) AddFragment added in v0.14.3

func (d *Did) AddFragment(fragment string) *Did

AddFragment adds a fragment to the DID struct and returns the new DID

func (*Did) AddPath added in v0.14.3

func (d *Did) AddPath(path string) *Did

AddPath adds a path to the DID struct and returns the new DID

func (*Did) AddQuery added in v0.14.3

func (d *Did) AddQuery(query string) *Did

AddQuery adds a query to the DID struct and returns the new DID

func (*Did) Descriptor deprecated added in v0.14.3

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

Deprecated: Use Did.ProtoReflect.Descriptor instead.

func (*Did) GetBase added in v0.14.3

func (d *Did) GetBase() string

GetBase returns the base DID string: Method + Network

func (*Did) GetFragment added in v0.14.3

func (x *Did) GetFragment() string

func (*Did) GetId added in v0.14.3

func (x *Did) GetId() string

func (*Did) GetMethod added in v0.14.3

func (x *Did) GetMethod() string

func (*Did) GetNetwork added in v0.14.3

func (x *Did) GetNetwork() string

func (*Did) GetPaths added in v0.14.3

func (x *Did) GetPaths() []string

func (*Did) GetQuery added in v0.14.3

func (x *Did) GetQuery() string

func (*Did) HasFragment added in v0.14.3

func (d *Did) HasFragment() bool

HasFragment returns true if the DID has a fragment

func (*Did) HasNetwork added in v0.14.3

func (d *Did) HasNetwork() bool

HasNetwork returns true if the DID has a network

func (*Did) HasPath added in v0.14.3

func (d *Did) HasPath() bool

HasPath returns true if the DID has a path

func (*Did) HasQuery added in v0.14.3

func (d *Did) HasQuery() bool

HasQuery returns true if the DID has a query

func (*Did) IsValid added in v0.14.3

func (d *Did) IsValid() bool

IsValid checks if a DID is valid and does not contain both a Fragment and a Query

func (*Did) ProtoMessage added in v0.14.3

func (*Did) ProtoMessage()

func (*Did) ProtoReflect added in v0.14.3

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

func (*Did) Reset added in v0.14.3

func (x *Did) Reset()

func (*Did) String added in v0.14.3

func (x *Did) String() string

func (*Did) ToString added in v0.14.3

func (d *Did) ToString() string

String combines all DID parts into a string

type DidDocument added in v0.14.3

type DidDocument struct {

	// Context is the context of the DID document. This is used to identify the Service.
	Context []string `protobuf:"bytes,1,rep,name=context,proto3" json:"context,omitempty"` // optional
	// Id is the DID of the document.
	Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	// Controller is the DID of the controller of the document. This will be the individual user devices and mailboxes.
	Controller []string `protobuf:"bytes,3,rep,name=controller,proto3" json:"controller,omitempty"` //optional
	// VerificationMethod is the list of verification methods for the user.
	VerificationMethod []*VerificationMethod `protobuf:"bytes,4,rep,name=verification_method,json=verificationMethod,proto3" json:"verification_method,omitempty"` // optional
	// Authentication is the list of authentication methods for the user.
	Authentication []string `protobuf:"bytes,5,rep,name=authentication,proto3" json:"authentication,omitempty"` // optional
	// AssertionMethod is the list of assertion methods for the user.
	AssertionMethod []string `protobuf:"bytes,6,rep,name=assertion_method,json=assertionMethod,proto3" json:"assertion_method,omitempty"` // optional
	// CapabilityInvocation is the list of capability invocation methods for the user.
	CapabilityInvocation []string `protobuf:"bytes,7,rep,name=capability_invocation,json=capabilityInvocation,proto3" json:"capability_invocation,omitempty"` // optional
	// CapabilityDelegation is the list of capability delegation methods for the user.
	CapabilityDelegation []string `protobuf:"bytes,8,rep,name=capability_delegation,json=capabilityDelegation,proto3" json:"capability_delegation,omitempty"` // optional
	// KeyAgreement is the list of key agreement methods for the user.
	KeyAgreement []string `protobuf:"bytes,9,rep,name=key_agreement,json=keyAgreement,proto3" json:"key_agreement,omitempty"` // optional
	// Service is the list of services or DApps that the user has access to.
	Service []*Service `protobuf:"bytes,10,rep,name=service,proto3" json:"service,omitempty"` // optional
	// AlsoKnownAs is the list of ".snr" aliases for the user.
	AlsoKnownAs []string `protobuf:"bytes,11,rep,name=also_known_as,json=alsoKnownAs,proto3" json:"also_known_as,omitempty"` // optional
	// contains filtered or unexported fields
}

DidDocument is the document that describes a DID. This document is stored on the blockchain.

func (*DidDocument) Descriptor deprecated added in v0.14.3

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

Deprecated: Use DidDocument.ProtoReflect.Descriptor instead.

func (*DidDocument) GetAlsoKnownAs added in v0.14.3

func (x *DidDocument) GetAlsoKnownAs() []string

func (*DidDocument) GetAssertionMethod added in v0.14.3

func (x *DidDocument) GetAssertionMethod() []string

func (*DidDocument) GetAuthentication added in v0.14.3

func (x *DidDocument) GetAuthentication() []string

func (*DidDocument) GetCapabilityDelegation added in v0.14.3

func (x *DidDocument) GetCapabilityDelegation() []string

func (*DidDocument) GetCapabilityInvocation added in v0.14.3

func (x *DidDocument) GetCapabilityInvocation() []string

func (*DidDocument) GetContext added in v0.14.3

func (x *DidDocument) GetContext() []string

func (*DidDocument) GetController added in v0.14.3

func (x *DidDocument) GetController() []string

func (*DidDocument) GetId added in v0.14.3

func (x *DidDocument) GetId() string

func (*DidDocument) GetKeyAgreement added in v0.14.3

func (x *DidDocument) GetKeyAgreement() []string

func (*DidDocument) GetService added in v0.14.3

func (x *DidDocument) GetService() []*Service

func (*DidDocument) GetVerificationMethod added in v0.14.3

func (x *DidDocument) GetVerificationMethod() []*VerificationMethod

func (*DidDocument) ProtoMessage added in v0.14.3

func (*DidDocument) ProtoMessage()

func (*DidDocument) ProtoReflect added in v0.14.3

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

func (*DidDocument) Reset added in v0.14.3

func (x *DidDocument) Reset()

func (*DidDocument) String added in v0.14.3

func (x *DidDocument) String() string

type Direction

type Direction int32

Direction is the direction of a stream.

const (
	// Unspecified is the default value.
	Direction_DIRECTION_UNSPECIFIED Direction = 0
	// Incoming is the direction of an incoming stream.
	Direction_DIRECTION_INCOMING Direction = 1
	// Outgoing is the direction of an outgoing stream.
	Direction_DIRECTION_OUTGOING Direction = 2
)

func (Direction) Descriptor

func (Direction) Descriptor() protoreflect.EnumDescriptor

func (Direction) Enum

func (x Direction) Enum() *Direction

func (Direction) EnumDescriptor deprecated

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

Deprecated: Use Direction.Descriptor instead.

func (Direction) Number

func (x Direction) Number() protoreflect.EnumNumber

func (Direction) String

func (x Direction) String() string

func (Direction) Type

type FileItem

type FileItem struct {
	Mime         *MIME      `protobuf:"bytes,1,opt,name=mime,proto3" json:"mime,omitempty"`                                      // Standard Mime Type
	Name         string     `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`                                      // File Name without Path
	Path         string     `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`                                      // File Location
	Size         int64      `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"`                                     // File Size in Bytes
	Thumbnail    *Thumbnail `protobuf:"bytes,5,opt,name=thumbnail,proto3" json:"thumbnail,omitempty"`                            // Thumbnail of File
	LastModified int64      `protobuf:"varint,6,opt,name=last_modified,json=lastModified,proto3" json:"last_modified,omitempty"` // Last Modified Time in Seconds
	// contains filtered or unexported fields
}

For Transfer File Payload

func (*FileItem) Descriptor deprecated

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

Deprecated: Use FileItem.ProtoReflect.Descriptor instead.

func (*FileItem) GetLastModified

func (x *FileItem) GetLastModified() int64

func (*FileItem) GetMime

func (x *FileItem) GetMime() *MIME

func (*FileItem) GetName

func (x *FileItem) GetName() string

func (*FileItem) GetPath

func (x *FileItem) GetPath() string

func (*FileItem) GetSize

func (x *FileItem) GetSize() int64

func (*FileItem) GetThumbnail

func (x *FileItem) GetThumbnail() *Thumbnail

func (*FileItem) Header

func (f *FileItem) Header() textproto.MIMEHeader

Header returns the header of the FileItem

func (*FileItem) ProtoMessage

func (*FileItem) ProtoMessage()

func (*FileItem) ProtoReflect

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

func (*FileItem) Reset

func (x *FileItem) Reset()

func (*FileItem) SetPathFromFolder

func (f *FileItem) SetPathFromFolder(folder device.Folder) (string, error)

SetPathFromFolder sets the path of the FileItem

func (*FileItem) String

func (x *FileItem) String() string

func (*FileItem) ToTransferItem

func (f *FileItem) ToTransferItem() *Payload_Item

ToTransferItem Returns Transfer for FileItem

type GetProfileFunc

type GetProfileFunc func() (*Profile, error)

GetProfileFunc returns a function that returns the Profile and error

type Location

type Location struct {

	// Location Latitude
	Latitude float64 `protobuf:"fixed64,1,opt,name=latitude,proto3" json:"latitude,omitempty"`
	// Location Longitude
	Longitude float64 `protobuf:"fixed64,2,opt,name=longitude,proto3" json:"longitude,omitempty"`
	// Location Placemark Information - Generated
	Placemark *Location_Placemark `protobuf:"bytes,3,opt,name=placemark,proto3" json:"placemark,omitempty"`
	// Last Updated Time
	LastModified int64 `protobuf:"varint,4,opt,name=last_modified,json=lastModified,proto3" json:"last_modified,omitempty"`
	// contains filtered or unexported fields
}

Location from GeoIP and OLC information

func NewDefaultLocation added in v0.12.5

func NewDefaultLocation() *Location

NewDefaultLocation returns the Sonr HQ as default location

func (*Location) Descriptor deprecated

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

Deprecated: Use Location.ProtoReflect.Descriptor instead.

func (*Location) GetLastModified

func (x *Location) GetLastModified() int64

func (*Location) GetLatitude

func (x *Location) GetLatitude() float64

func (*Location) GetLongitude

func (x *Location) GetLongitude() float64

func (*Location) GetPlacemark

func (x *Location) GetPlacemark() *Location_Placemark

func (*Location) OLC

func (l *Location) OLC() string

OLC returns Open Location code

func (*Location) ProtoMessage

func (*Location) ProtoMessage()

func (*Location) ProtoReflect

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

func (*Location) Reset

func (x *Location) Reset()

func (*Location) String

func (x *Location) String() string

type Location_Placemark

type Location_Placemark struct {

	// The name associated with the placemark.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The street associated with the placemark.
	Street string `protobuf:"bytes,2,opt,name=street,proto3" json:"street,omitempty"`
	// The abbreviated country name, according to the two letter (alpha-2) [ISO
	// standard](https://www.iso.org/iso-3166-country-codes.html).
	IsoCountryCode string `protobuf:"bytes,3,opt,name=iso_country_code,json=isoCountryCode,proto3" json:"iso_country_code,omitempty"`
	// The name of the country associated with the placemark.
	Country string `protobuf:"bytes,4,opt,name=country,proto3" json:"country,omitempty"`
	// The postal code associated with the placemark.
	PostalCode string `protobuf:"bytes,5,opt,name=postal_code,json=postalCode,proto3" json:"postal_code,omitempty"`
	// The name of the state or province associated with the placemark.
	AdministrativeArea string `protobuf:"bytes,6,opt,name=administrative_area,json=administrativeArea,proto3" json:"administrative_area,omitempty"`
	// Additional administrative area information for the placemark.
	SubAdministrativeArea string `` /* 126-byte string literal not displayed */
	// The name of the city associated with the placemark.
	Locality string `protobuf:"bytes,8,opt,name=locality,proto3" json:"locality,omitempty"`
	// Additional city-level information for the placemark.
	SubLocality string `protobuf:"bytes,9,opt,name=sub_locality,json=subLocality,proto3" json:"sub_locality,omitempty"`
	// The street address associated with the placemark.
	Thoroughfare string `protobuf:"bytes,10,opt,name=thoroughfare,proto3" json:"thoroughfare,omitempty"`
	// Additional street address information for the placemark.
	SubThoroughfare string `protobuf:"bytes,11,opt,name=sub_thoroughfare,json=subThoroughfare,proto3" json:"sub_thoroughfare,omitempty"`
	// contains filtered or unexported fields
}

Contains detailed placemark information.

func (*Location_Placemark) Descriptor deprecated

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

Deprecated: Use Location_Placemark.ProtoReflect.Descriptor instead.

func (*Location_Placemark) GetAdministrativeArea

func (x *Location_Placemark) GetAdministrativeArea() string

func (*Location_Placemark) GetCountry

func (x *Location_Placemark) GetCountry() string

func (*Location_Placemark) GetIsoCountryCode

func (x *Location_Placemark) GetIsoCountryCode() string

func (*Location_Placemark) GetLocality

func (x *Location_Placemark) GetLocality() string

func (*Location_Placemark) GetName

func (x *Location_Placemark) GetName() string

func (*Location_Placemark) GetPostalCode

func (x *Location_Placemark) GetPostalCode() string

func (*Location_Placemark) GetStreet

func (x *Location_Placemark) GetStreet() string

func (*Location_Placemark) GetSubAdministrativeArea

func (x *Location_Placemark) GetSubAdministrativeArea() string

func (*Location_Placemark) GetSubLocality

func (x *Location_Placemark) GetSubLocality() string

func (*Location_Placemark) GetSubThoroughfare

func (x *Location_Placemark) GetSubThoroughfare() string

func (*Location_Placemark) GetThoroughfare

func (x *Location_Placemark) GetThoroughfare() string

func (*Location_Placemark) ProtoMessage

func (*Location_Placemark) ProtoMessage()

func (*Location_Placemark) ProtoReflect

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

func (*Location_Placemark) Reset

func (x *Location_Placemark) Reset()

func (*Location_Placemark) String

func (x *Location_Placemark) String() string

type MIME

type MIME struct {

	// Type of File
	Type MIME_Type `protobuf:"varint,1,opt,name=type,proto3,enum=common.MIME_Type" json:"type,omitempty"`
	// Extension of File
	Subtype string `protobuf:"bytes,2,opt,name=subtype,proto3" json:"subtype,omitempty"`
	// Type/Subtype i.e. (image/jpeg)
	Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

Standard MIME with Additional Extensions

func DefaultUrlMIME

func DefaultUrlMIME() *MIME

** ─────────────────────────────────────────────────────── ** ─── MIME Management ─────────────────────────────────── ** ─────────────────────────────────────────────────────── DefaultUrlMIME is the standard MIME type for URLs

func NewMime

func NewMime(path string) (*MIME, error)

NewMime creates a new MIME type from Path

func (*MIME) Descriptor deprecated

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

Deprecated: Use MIME.ProtoReflect.Descriptor instead.

func (*MIME) Ext

func (m *MIME) Ext() string

Ext Method adjusts extension for JPEG

func (*MIME) GetSubtype

func (x *MIME) GetSubtype() string

func (*MIME) GetType

func (x *MIME) GetType() MIME_Type

func (*MIME) GetValue

func (x *MIME) GetValue() string

func (*MIME) IsAudio

func (m *MIME) IsAudio() bool

IsAudio Checks if Mime is Audio

func (*MIME) IsFile

func (m *MIME) IsFile() bool

IsFile Checks if Path is a File

func (*MIME) IsImage

func (m *MIME) IsImage() bool

IsImage Checks if Mime is Image

func (*MIME) IsMedia

func (m *MIME) IsMedia() bool

IsMedia Checks if Mime is any media

func (*MIME) IsPDF

func (m *MIME) IsPDF() bool

IsPDF Checks if Mime is PDF

func (*MIME) IsUrl

func (m *MIME) IsUrl() bool

IsUrl Checks if Path is a URL

func (*MIME) IsVideo

func (m *MIME) IsVideo() bool

IsVideo Checks if Mime is Video

func (*MIME) PermitsThumbnail

func (m *MIME) PermitsThumbnail() bool

PermitsThumbnail Checks if Mime Type Allows Thumbnail Generation. Image, Video, Audio, and PDF are allowed.

func (*MIME) ProtoMessage

func (*MIME) ProtoMessage()

func (*MIME) ProtoReflect

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

func (*MIME) Reset

func (x *MIME) Reset()

func (*MIME) String

func (x *MIME) String() string

type MIME_Type

type MIME_Type int32

File Content Type

const (
	// Other File Type - If cannot derive from Subtype
	MIME_TYPE_UNSPECIFIED MIME_Type = 0
	// Sound, Audio Files
	MIME_TYPE_AUDIO MIME_Type = 1
	// Document Files - PDF, Word, Excel, etc.
	MIME_TYPE_DOCUMENT MIME_Type = 2
	// Image Files
	MIME_TYPE_IMAGE MIME_Type = 3
	// Text Based Files
	MIME_TYPE_TEXT MIME_Type = 4
	// Video Files
	MIME_TYPE_VIDEO MIME_Type = 5
	// URL Links
	MIME_TYPE_URL MIME_Type = 6
	// Crypto Files
	MIME_TYPE_CRYPTO MIME_Type = 7
)

func (MIME_Type) Descriptor

func (MIME_Type) Descriptor() protoreflect.EnumDescriptor

func (MIME_Type) Enum

func (x MIME_Type) Enum() *MIME_Type

func (MIME_Type) EnumDescriptor deprecated

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

Deprecated: Use MIME_Type.Descriptor instead.

func (MIME_Type) Number

func (x MIME_Type) Number() protoreflect.EnumNumber

func (MIME_Type) String

func (x MIME_Type) String() string

func (MIME_Type) Type

type Metadata

type Metadata struct {

	// Unix timestamp
	Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// Node ID
	NodeId string `protobuf:"bytes,2,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
	// Signature of the message
	Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
	// Public Key of the message sender
	PublicKey []byte `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	// contains filtered or unexported fields
}

Shared Metadata for Messages on all Protocols

func (*Metadata) Descriptor deprecated

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

Deprecated: Use Metadata.ProtoReflect.Descriptor instead.

func (*Metadata) GetNodeId

func (x *Metadata) GetNodeId() string

func (*Metadata) GetPublicKey

func (x *Metadata) GetPublicKey() []byte

func (*Metadata) GetSignature

func (x *Metadata) GetSignature() []byte

func (*Metadata) GetTimestamp

func (x *Metadata) GetTimestamp() int64

func (*Metadata) ProtoMessage

func (*Metadata) ProtoMessage()

func (*Metadata) ProtoReflect

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

func (*Metadata) Reset

func (x *Metadata) Reset()

func (*Metadata) String

func (x *Metadata) String() string

type Network added in v0.14.3

type Network int

type ObjectDoc added in v0.14.3

type ObjectDoc struct {

	// Did is the identifier of the object.
	Did string `protobuf:"bytes,1,opt,name=did,proto3" json:"did,omitempty"`
	// Service is the service that created the object.
	Service string `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"`
	// Tags are the tags associated with the object.
	Tags []string `protobuf:"bytes,3,rep,name=tags,proto3" json:"tags,omitempty"`
	// Fields are the fields associated with the object.
	Fields map[string]*ObjectField `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

ObjectDoc is a document for an Object stored in the graph.

func (*ObjectDoc) Descriptor deprecated added in v0.14.3

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

Deprecated: Use ObjectDoc.ProtoReflect.Descriptor instead.

func (*ObjectDoc) GetDid added in v0.14.3

func (x *ObjectDoc) GetDid() string

func (*ObjectDoc) GetFields added in v0.14.3

func (x *ObjectDoc) GetFields() map[string]*ObjectField

func (*ObjectDoc) GetService added in v0.14.3

func (x *ObjectDoc) GetService() string

func (*ObjectDoc) GetTags added in v0.14.3

func (x *ObjectDoc) GetTags() []string

func (*ObjectDoc) ProtoMessage added in v0.14.3

func (*ObjectDoc) ProtoMessage()

func (*ObjectDoc) ProtoReflect added in v0.14.3

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

func (*ObjectDoc) Reset added in v0.14.3

func (x *ObjectDoc) Reset()

func (*ObjectDoc) String added in v0.14.3

func (x *ObjectDoc) String() string

type ObjectField added in v0.14.1

type ObjectField struct {

	// Name is the name of the field
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Type is the type of the field
	Type ObjectFieldType `protobuf:"varint,2,opt,name=type,proto3,enum=common.ObjectFieldType" json:"type,omitempty"`
	// Value is the value of the field
	//
	// Types that are assignable to Value:
	//	*ObjectField_StringValue
	//	*ObjectField_IntValue
	//	*ObjectField_FloatValue
	//	*ObjectField_BoolValue
	//	*ObjectField_DateValue
	//	*ObjectField_BlobValue
	//	*ObjectField_ReferenceValue
	Value isObjectField_Value `protobuf_oneof:"value"`
	// Metadata is additional info about the field
	Metadata map[string]string `` /* 158-byte string literal not displayed */
	// contains filtered or unexported fields
}

ObjectField is a field of an Object.

func (*ObjectField) Descriptor deprecated added in v0.14.1

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

Deprecated: Use ObjectField.ProtoReflect.Descriptor instead.

func (*ObjectField) GetBlobValue added in v0.14.1

func (x *ObjectField) GetBlobValue() []byte

func (*ObjectField) GetBoolValue added in v0.14.1

func (x *ObjectField) GetBoolValue() bool

func (*ObjectField) GetDateValue added in v0.14.3

func (x *ObjectField) GetDateValue() int64

func (*ObjectField) GetFloatValue added in v0.14.3

func (x *ObjectField) GetFloatValue() float64

func (*ObjectField) GetIntValue added in v0.14.1

func (x *ObjectField) GetIntValue() int32

func (*ObjectField) GetMetadata added in v0.14.3

func (x *ObjectField) GetMetadata() map[string]string

func (*ObjectField) GetName added in v0.14.1

func (x *ObjectField) GetName() string

func (*ObjectField) GetReferenceValue added in v0.14.1

func (x *ObjectField) GetReferenceValue() string

func (*ObjectField) GetStringValue added in v0.14.1

func (x *ObjectField) GetStringValue() string

func (*ObjectField) GetType added in v0.14.1

func (x *ObjectField) GetType() ObjectFieldType

func (*ObjectField) GetValue added in v0.14.1

func (m *ObjectField) GetValue() isObjectField_Value

func (*ObjectField) ProtoMessage added in v0.14.1

func (*ObjectField) ProtoMessage()

func (*ObjectField) ProtoReflect added in v0.14.1

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

func (*ObjectField) Reset added in v0.14.1

func (x *ObjectField) Reset()

func (*ObjectField) String added in v0.14.1

func (x *ObjectField) String() string

type ObjectFieldType added in v0.14.1

type ObjectFieldType int32

ObjectFieldType is the type of the field

const (
	// ObjectFieldTypeUnspecified is the default value
	ObjectFieldType_OBJECT_FIELD_TYPE_UNSPECIFIED ObjectFieldType = 0
	// ObjectFieldTypeString is a string or text field
	ObjectFieldType_OBJECT_FIELD_TYPE_STRING ObjectFieldType = 1
	// ObjectFieldTypeInt is an integer
	ObjectFieldType_OBJECT_FIELD_TYPE_INT ObjectFieldType = 2
	// ObjectFieldTypeFloat is a floating point number
	ObjectFieldType_OBJECT_FIELD_TYPE_FLOAT ObjectFieldType = 3
	// ObjectFieldTypeBool is a boolean
	ObjectFieldType_OBJECT_FIELD_TYPE_BOOL ObjectFieldType = 4
	// ObjectFieldTypeDateTime is a datetime
	ObjectFieldType_OBJECT_FIELD_TYPE_DATETIME ObjectFieldType = 5
	// ObjectFieldTypeBlob is a blob which is a byte array
	ObjectFieldType_OBJECT_FIELD_TYPE_BLOB ObjectFieldType = 6
	// ObjectFieldTypeReference is a reference to another object
	ObjectFieldType_OBJECT_FIELD_TYPE_REFERENCE ObjectFieldType = 7
)

func (ObjectFieldType) Descriptor added in v0.14.1

func (ObjectFieldType) Enum added in v0.14.1

func (x ObjectFieldType) Enum() *ObjectFieldType

func (ObjectFieldType) EnumDescriptor deprecated added in v0.14.1

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

Deprecated: Use ObjectFieldType.Descriptor instead.

func (ObjectFieldType) Number added in v0.14.1

func (ObjectFieldType) String added in v0.14.1

func (x ObjectFieldType) String() string

func (ObjectFieldType) Type added in v0.14.1

type ObjectField_BlobValue added in v0.14.1

type ObjectField_BlobValue struct {
	// Blob is the value of the field
	BlobValue []byte `protobuf:"bytes,8,opt,name=blob_value,json=blobValue,proto3,oneof"`
}

type ObjectField_BoolValue added in v0.14.1

type ObjectField_BoolValue struct {
	// Bool is the value of the field
	BoolValue bool `protobuf:"varint,6,opt,name=bool_value,json=boolValue,proto3,oneof"`
}

type ObjectField_DateValue added in v0.14.3

type ObjectField_DateValue struct {
	// Date is defined by milliseconds since epoch.
	DateValue int64 `protobuf:"varint,7,opt,name=date_value,json=dateValue,proto3,oneof"`
}

type ObjectField_FloatValue added in v0.14.3

type ObjectField_FloatValue struct {
	// Float is the value of the field
	FloatValue float64 `protobuf:"fixed64,5,opt,name=float_value,json=floatValue,proto3,oneof"`
}

type ObjectField_IntValue added in v0.14.1

type ObjectField_IntValue struct {
	// Int is the value of the field
	IntValue int32 `protobuf:"varint,4,opt,name=int_value,json=intValue,proto3,oneof"`
}

type ObjectField_ReferenceValue added in v0.14.1

type ObjectField_ReferenceValue struct {
	// Reference is the value of the field
	ReferenceValue string `protobuf:"bytes,9,opt,name=reference_value,json=referenceValue,proto3,oneof"`
}

type ObjectField_StringValue added in v0.14.1

type ObjectField_StringValue struct {
	// String is the value of the field
	StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"`
}

type Option added in v0.14.3

type Option func(*Did)

func WithFragment added in v0.14.3

func WithFragment(fragment string) Option

WithFragment adds a fragment to a DID

func WithNetwork added in v0.14.3

func WithNetwork(network string) Option

WithNetwork adds a network to a DID

func WithPath added in v0.14.3

func WithPath(p string) Option

WithPath adds a path to a DID

func WithQuery added in v0.14.3

func WithQuery(query string) Option

WithQuery adds a query to a DID

type Payload

type Payload struct {
	Items     []*Payload_Item `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`                           // Payload Items
	Owner     *Profile        `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"`                           // PROFILE: General Sender Info
	Size      int64           `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`                            // Payload Size in Bytes
	CreatedAt int64           `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // Payload Creation Time in Seconds
	// contains filtered or unexported fields
}

Payload is Data thats being Passed

func (*Payload) Descriptor deprecated

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

Deprecated: Use Payload.ProtoReflect.Descriptor instead.

func (*Payload) FileCount

func (p *Payload) FileCount() int

FileCount returns the number of files in the Payload

func (*Payload) GetCreatedAt

func (x *Payload) GetCreatedAt() int64

func (*Payload) GetItems

func (x *Payload) GetItems() []*Payload_Item

func (*Payload) GetOwner

func (x *Payload) GetOwner() *Profile

func (*Payload) GetSize

func (x *Payload) GetSize() int64

func (*Payload) IsFile

func (p *Payload) IsFile() bool

IsFile returns true if the Item is a File

func (*Payload) IsMultiple

func (p *Payload) IsMultiple() (bool, error)

IsMultiple returns true if the transfer is a multiple transfer. Error returned if No Items present in Payload

func (*Payload) IsSingle

func (p *Payload) IsSingle() (bool, error)

IsSingle returns true if the transfer is a single transfer. Error returned if No Items present in Payload

func (*Payload) MapFileItems

func (p *Payload) MapFileItems(fn PayloadItemFunc) error

MapFileItems performs method chaining on ONLY the FileItems in the Payload

func (*Payload) MapItems

func (p *Payload) MapItems(fn PayloadItemFunc) error

MapItems performs method chaining on the Items in the Payload

func (*Payload) MapItemsWithIndex

func (p *Payload) MapItemsWithIndex(fn PayloadItemFunc) error

MapItems performs method chaining on the Items in the Payload

func (*Payload) ProtoMessage

func (*Payload) ProtoMessage()

func (*Payload) ProtoReflect

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

func (*Payload) Reset

func (x *Payload) Reset()

func (*Payload) String

func (x *Payload) String() string

func (*Payload) URLCount

func (p *Payload) URLCount() int

URLCount returns the number of URLs in the Payload

type PayloadItemFunc

type PayloadItemFunc func(item *Payload_Item, index int, total int) error

** ─────────────────────────────────────────────────────── ** ─── Payload Management ──────────────────────────────── ** ─────────────────────────────────────────────────────── PayloadItemFunc is the Map function for PayloadItem

type Payload_Item

type Payload_Item struct {
	Mime *MIME `protobuf:"bytes,1,opt,name=mime,proto3" json:"mime,omitempty"`  // MIME of the Item
	Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` // Size of the Item in Bytes
	// Attached Data
	//
	// Types that are assignable to Data:
	//	*Payload_Item_File
	//	*Payload_Item_Url
	//	*Payload_Item_Message
	Data isPayload_Item_Data `protobuf_oneof:"data"`
	// Thumbnail of the Item
	Thumbnail *Thumbnail `protobuf:"bytes,6,opt,name=thumbnail,proto3" json:"thumbnail,omitempty"` // Thumbnail of the Item
	// contains filtered or unexported fields
}

Item in Payload

func NewFileItem

func NewFileItem(path string, tbuf []byte) (*Payload_Item, error)

NewFileItem creates a new transfer file item

func (*Payload_Item) Descriptor deprecated

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

Deprecated: Use Payload_Item.ProtoReflect.Descriptor instead.

func (*Payload_Item) GetData

func (m *Payload_Item) GetData() isPayload_Item_Data

func (*Payload_Item) GetFile

func (x *Payload_Item) GetFile() *FileItem

func (*Payload_Item) GetMessage

func (x *Payload_Item) GetMessage() string

func (*Payload_Item) GetMime

func (x *Payload_Item) GetMime() *MIME

func (*Payload_Item) GetSize

func (x *Payload_Item) GetSize() int64

func (*Payload_Item) GetThumbnail

func (x *Payload_Item) GetThumbnail() *Thumbnail

func (*Payload_Item) GetUrl

func (x *Payload_Item) GetUrl() string

func (*Payload_Item) ProtoMessage

func (*Payload_Item) ProtoMessage()

func (*Payload_Item) ProtoReflect

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

func (*Payload_Item) Reset

func (x *Payload_Item) Reset()

func (*Payload_Item) String

func (x *Payload_Item) String() string

type Payload_Item_File

type Payload_Item_File struct {
	File *FileItem `protobuf:"bytes,3,opt,name=file,proto3,oneof"` // FILE: File Item
}

type Payload_Item_Message

type Payload_Item_Message struct {
	Message string `protobuf:"bytes,5,opt,name=message,proto3,oneof"` // MESSAGE: Message Item
}

type Payload_Item_Url

type Payload_Item_Url struct {
	Url string `protobuf:"bytes,4,opt,name=url,proto3,oneof"` // URL: Url Item
}

type Peer

type Peer struct {
	SName        string       `protobuf:"bytes,1,opt,name=s_name,json=sName,proto3" json:"s_name,omitempty"`                       // User Sonr Domain
	Status       Peer_Status  `protobuf:"varint,2,opt,name=status,proto3,enum=common.Peer_Status" json:"status,omitempty"`         // Peer Status
	Device       *Peer_Device `protobuf:"bytes,3,opt,name=device,proto3" json:"device,omitempty"`                                  // Peer Device Info
	Profile      *Profile     `protobuf:"bytes,4,opt,name=profile,proto3" json:"profile,omitempty"`                                // Peers General Information
	PublicKey    []byte       `protobuf:"bytes,5,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`           // Public Key of the Peer
	PeerId       string       `protobuf:"bytes,6,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`                    // Peer ID
	LastModified int64        `protobuf:"varint,7,opt,name=last_modified,json=lastModified,proto3" json:"last_modified,omitempty"` // Last Modified Timestamp
	// contains filtered or unexported fields
}

Basic Info Sent to Peers to Establish Connections

func (*Peer) Arch

func (p *Peer) Arch() string

Arch returns Peer Device GOARCH

func (*Peer) Buffer

func (p *Peer) Buffer() ([]byte, error)

Buffer returns Peer as a buffer

func (*Peer) Descriptor deprecated

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

Deprecated: Use Peer.ProtoReflect.Descriptor instead.

func (*Peer) GetDevice

func (x *Peer) GetDevice() *Peer_Device

func (*Peer) GetLastModified

func (x *Peer) GetLastModified() int64

func (*Peer) GetPeerId added in v0.14.1

func (x *Peer) GetPeerId() string

func (*Peer) GetProfile

func (x *Peer) GetProfile() *Profile

func (*Peer) GetPublicKey

func (x *Peer) GetPublicKey() []byte

func (*Peer) GetSName

func (x *Peer) GetSName() string

func (*Peer) GetStatus

func (x *Peer) GetStatus() Peer_Status

func (*Peer) Libp2pID

func (p *Peer) Libp2pID() (peer.ID, error)

Libp2pID returns the PeerID based on PublicKey from Profile

func (*Peer) OS

func (p *Peer) OS() string

OS returns Peer Device GOOS

func (*Peer) ProtoMessage

func (*Peer) ProtoMessage()

func (*Peer) ProtoReflect

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

func (*Peer) PubKey

func (p *Peer) PubKey() (crypto.PubKey, error)

PubKey returns the Public Key from the Peer

func (*Peer) Reset

func (x *Peer) Reset()

func (*Peer) String

func (x *Peer) String() string

type Peer_Device

type Peer_Device struct {
	Id       string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`                             // Peer Device ID
	HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` // Peer Host Name
	Os       string `protobuf:"bytes,3,opt,name=os,proto3" json:"os,omitempty"`                             // Peer Operating System
	Arch     string `protobuf:"bytes,4,opt,name=arch,proto3" json:"arch,omitempty"`                         // Peer Architecture
	Model    string `protobuf:"bytes,5,opt,name=model,proto3" json:"model,omitempty"`                       // Peers Device Model
	// contains filtered or unexported fields
}

Peer Info for Device

func (*Peer_Device) Descriptor deprecated

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

Deprecated: Use Peer_Device.ProtoReflect.Descriptor instead.

func (*Peer_Device) GetArch

func (x *Peer_Device) GetArch() string

func (*Peer_Device) GetHostName

func (x *Peer_Device) GetHostName() string

func (*Peer_Device) GetId

func (x *Peer_Device) GetId() string

func (*Peer_Device) GetModel

func (x *Peer_Device) GetModel() string

func (*Peer_Device) GetOs

func (x *Peer_Device) GetOs() string

func (*Peer_Device) ProtoMessage

func (*Peer_Device) ProtoMessage()

func (*Peer_Device) ProtoReflect

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

func (*Peer_Device) Reset

func (x *Peer_Device) Reset()

func (*Peer_Device) String

func (x *Peer_Device) String() string

type Peer_Status

type Peer_Status int32

Peers Active Status

const (
	Peer_STATUS_UNSPECIFIED Peer_Status = 0 // Offline - Not Online or Not a Full Node
	Peer_STATUS_ONLINE      Peer_Status = 1 // Online - Full Node Available
	Peer_STATUS_AWAY        Peer_Status = 2 // Away - Not Online, but has a full node
	Peer_STATUS_BUSY        Peer_Status = 3 // Busy - Online, but busy with Transfer
)

func (Peer_Status) Descriptor

func (Peer_Status) Enum

func (x Peer_Status) Enum() *Peer_Status

func (Peer_Status) EnumDescriptor deprecated

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

Deprecated: Use Peer_Status.Descriptor instead.

func (Peer_Status) Number

func (x Peer_Status) Number() protoreflect.EnumNumber

func (Peer_Status) String

func (x Peer_Status) String() string

func (Peer_Status) Type

type Profile

type Profile struct {
	SName        string `protobuf:"bytes,1,opt,name=s_name,json=sName,proto3" json:"s_name,omitempty"`                       // Sonr Based Username
	FirstName    string `protobuf:"bytes,2,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"`           // General Info
	LastName     string `protobuf:"bytes,3,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"`              // General Info
	Picture      []byte `protobuf:"bytes,4,opt,name=picture,proto3" json:"picture,omitempty"`                                // Profile Picture
	Bio          string `protobuf:"bytes,6,opt,name=bio,proto3" json:"bio,omitempty"`                                        // User Biography
	LastModified int64  `protobuf:"varint,7,opt,name=last_modified,json=lastModified,proto3" json:"last_modified,omitempty"` // Last Modified Timestamp
	// contains filtered or unexported fields
}

General Information about Peer passed during Authentication

func NewDefaultProfile

func NewDefaultProfile(options ...DefaultProfileOption) *Profile

NewDefaultProfile creates a new default Profile

func (*Profile) Buffer

func (p *Profile) Buffer() ([]byte, error)

Buffer returns Peer as a buffer

func (*Profile) Descriptor deprecated

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

Deprecated: Use Profile.ProtoReflect.Descriptor instead.

func (*Profile) GetBio

func (x *Profile) GetBio() string

func (*Profile) GetFirstName

func (x *Profile) GetFirstName() string

func (*Profile) GetLastModified

func (x *Profile) GetLastModified() int64

func (*Profile) GetLastName

func (x *Profile) GetLastName() string

func (*Profile) GetPicture

func (x *Profile) GetPicture() []byte

func (*Profile) GetSName

func (x *Profile) GetSName() string

func (*Profile) ProtoMessage

func (*Profile) ProtoMessage()

func (*Profile) ProtoReflect

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

func (*Profile) Reset

func (x *Profile) Reset()

func (*Profile) String

func (x *Profile) String() string

type Service added in v0.14.3

type Service struct {

	// ID is the DID of the service.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Type is the type of the service.
	Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	// ServiceEndpoint is the endpoint of the service.
	ServiceEndpoint string `protobuf:"bytes,3,opt,name=service_endpoint,json=serviceEndpoint,proto3" json:"service_endpoint,omitempty"`
	// contains filtered or unexported fields
}

Service is a Application that runs on the Sonr network.

func (*Service) Descriptor deprecated added in v0.14.3

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

Deprecated: Use Service.ProtoReflect.Descriptor instead.

func (*Service) GetId added in v0.14.3

func (x *Service) GetId() string

func (*Service) GetServiceEndpoint added in v0.14.3

func (x *Service) GetServiceEndpoint() string

func (*Service) GetType added in v0.14.3

func (x *Service) GetType() string

func (*Service) ProtoMessage added in v0.14.3

func (*Service) ProtoMessage()

func (*Service) ProtoReflect added in v0.14.3

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

func (*Service) Reset added in v0.14.3

func (x *Service) Reset()

func (*Service) String added in v0.14.3

func (x *Service) String() string

type SupplyItem

type SupplyItem struct {
	Path      string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`                 // Supply Path
	Thumbnail []byte `protobuf:"bytes,2,opt,name=thumbnail,proto3,oneof" json:"thumbnail,omitempty"` // Supply Path of the Thumbnail
	// contains filtered or unexported fields
}

SupplyItem is an item supplied to be a payload

func (*SupplyItem) Descriptor deprecated

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

Deprecated: Use SupplyItem.ProtoReflect.Descriptor instead.

func (*SupplyItem) GetPath

func (x *SupplyItem) GetPath() string

func (*SupplyItem) GetThumbnail

func (x *SupplyItem) GetThumbnail() []byte

func (*SupplyItem) ProtoMessage

func (*SupplyItem) ProtoMessage()

func (*SupplyItem) ProtoReflect

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

func (*SupplyItem) Reset

func (x *SupplyItem) Reset()

func (*SupplyItem) String

func (x *SupplyItem) String() string

type Thumbnail

type Thumbnail struct {
	Buffer []byte `protobuf:"bytes,1,opt,name=buffer,proto3" json:"buffer,omitempty"` // Thumbnail Buffer
	Mime   *MIME  `protobuf:"bytes,2,opt,name=mime,proto3" json:"mime,omitempty"`     // Mime Type
	// contains filtered or unexported fields
}

Thumbnail of File

func (*Thumbnail) Descriptor deprecated

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

Deprecated: Use Thumbnail.ProtoReflect.Descriptor instead.

func (*Thumbnail) GetBuffer

func (x *Thumbnail) GetBuffer() []byte

func (*Thumbnail) GetMime

func (x *Thumbnail) GetMime() *MIME

func (*Thumbnail) ProtoMessage

func (*Thumbnail) ProtoMessage()

func (*Thumbnail) ProtoReflect

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

func (*Thumbnail) Reset

func (x *Thumbnail) Reset()

func (*Thumbnail) String

func (x *Thumbnail) String() string

type VerificationMethod added in v0.14.3

type VerificationMethod struct {

	// ID is the DID of the verification method.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Type is the type of the verification method.
	Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	// Controller is the DID of the controller of the verification method.
	Controller string `protobuf:"bytes,3,opt,name=controller,proto3" json:"controller,omitempty"`
	// PublicKeyHex is the public key of the verification method in hexidecimal.
	PublicKeyHex string `protobuf:"bytes,4,opt,name=public_key_hex,json=publicKeyHex,proto3" json:"public_key_hex,omitempty"` // optional
	// PublicKeyBase58 is the public key of the verification method in base58.
	PublicKeyBase58 string `protobuf:"bytes,5,opt,name=public_key_base58,json=publicKeyBase58,proto3" json:"public_key_base58,omitempty"` // optional
	// BlockchainAccountId is the blockchain account id of the verification method.
	BlockchainAccountId string `protobuf:"bytes,6,opt,name=blockchain_account_id,json=blockchainAccountId,proto3" json:"blockchain_account_id,omitempty"` // optional
	// contains filtered or unexported fields
}

VerificationMethod is a method that can be used to verify the DID.

func (*VerificationMethod) Descriptor deprecated added in v0.14.3

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

Deprecated: Use VerificationMethod.ProtoReflect.Descriptor instead.

func (*VerificationMethod) GetBlockchainAccountId added in v0.14.3

func (x *VerificationMethod) GetBlockchainAccountId() string

func (*VerificationMethod) GetController added in v0.14.3

func (x *VerificationMethod) GetController() string

func (*VerificationMethod) GetId added in v0.14.3

func (x *VerificationMethod) GetId() string

func (*VerificationMethod) GetPublicKeyBase58 added in v0.14.3

func (x *VerificationMethod) GetPublicKeyBase58() string

func (*VerificationMethod) GetPublicKeyHex added in v0.14.3

func (x *VerificationMethod) GetPublicKeyHex() string

func (*VerificationMethod) GetType added in v0.14.3

func (x *VerificationMethod) GetType() string

func (*VerificationMethod) ProtoMessage added in v0.14.3

func (*VerificationMethod) ProtoMessage()

func (*VerificationMethod) ProtoReflect added in v0.14.3

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

func (*VerificationMethod) Reset added in v0.14.3

func (x *VerificationMethod) Reset()

func (*VerificationMethod) String added in v0.14.3

func (x *VerificationMethod) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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