Documentation
¶
Index ¶
- Constants
- Variables
- type AccountInfo
- func (*AccountInfo) Descriptor() ([]byte, []int)
- func (m *AccountInfo) GetAddress() string
- func (m *AccountInfo) GetBalance() int32
- func (m *AccountInfo) GetIndex() uint32
- func (m *AccountInfo) GetLabel() string
- func (m *AccountInfo) GetNetwork() string
- func (m *AccountInfo) Marshal() (dAtA []byte, err error)
- func (m *AccountInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *AccountInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*AccountInfo) ProtoMessage()
- func (m *AccountInfo) Reset()
- func (m *AccountInfo) Size() (n int)
- func (m *AccountInfo) String() string
- func (m *AccountInfo) Unmarshal(dAtA []byte) error
- func (m *AccountInfo) XXX_DiscardUnknown()
- func (m *AccountInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AccountInfo) XXX_Merge(src proto.Message)
- func (m *AccountInfo) XXX_Size() int
- func (m *AccountInfo) XXX_Unmarshal(b []byte) error
- type Context
- type DIDConfig
- type DIDOption
- type IPFSNode
- type Node
- type NodeCallback
- type PeerInfo
- func (*PeerInfo) Descriptor() ([]byte, []int)
- func (m *PeerInfo) GetId() string
- func (m *PeerInfo) GetMultiaddr() string
- func (m *PeerInfo) GetName() string
- func (m *PeerInfo) GetPeerId() string
- func (m *PeerInfo) Marshal() (dAtA []byte, err error)
- func (m *PeerInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *PeerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PeerInfo) ProtoMessage()
- func (m *PeerInfo) Reset()
- func (m *PeerInfo) Size() (n int)
- func (m *PeerInfo) String() string
- func (m *PeerInfo) Unmarshal(dAtA []byte) error
- func (m *PeerInfo) XXX_DiscardUnknown()
- func (m *PeerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PeerInfo) XXX_Merge(src proto.Message)
- func (m *PeerInfo) XXX_Size() int
- func (m *PeerInfo) XXX_Unmarshal(b []byte) error
- type PeerNode
- type SNRPubKey
- type WalletInfo
- func (*WalletInfo) Descriptor() ([]byte, []int)
- func (m *WalletInfo) GetAlgorithm() string
- func (m *WalletInfo) GetController() string
- func (m *WalletInfo) GetCreatedAt() int64
- func (m *WalletInfo) GetDiscoveredPaths() []int32
- func (m *WalletInfo) GetLastUpdated() int64
- func (m *WalletInfo) Marshal() (dAtA []byte, err error)
- func (m *WalletInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *WalletInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*WalletInfo) ProtoMessage()
- func (m *WalletInfo) Reset()
- func (m *WalletInfo) Size() (n int)
- func (m *WalletInfo) String() string
- func (m *WalletInfo) Unmarshal(dAtA []byte) error
- func (m *WalletInfo) XXX_DiscardUnknown()
- func (m *WalletInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *WalletInfo) XXX_Merge(src proto.Message)
- func (m *WalletInfo) XXX_Size() int
- func (m *WalletInfo) XXX_Unmarshal(b []byte) error
Constants ¶
const (
// CURRENT_CHAIN_ID is the current chain ID.
CURRENT_CHAIN_ID = "sonrdevnet-1"
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AccountInfo ¶
type AccountInfo struct { // Address is the associated Sonr address. Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Credentials is a list of all credentials associated with the account. Network string `protobuf:"bytes,2,opt,name=network,proto3" json:"network,omitempty"` // Label is the label of the account. Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` // Index is the index of the account. Index uint32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"` // Balance is the balance of the account. Balance int32 `protobuf:"varint,5,opt,name=balance,proto3" json:"balance,omitempty"` }
Account is used for storing all credentials and their locations to be encrypted.
func (*AccountInfo) Descriptor ¶
func (*AccountInfo) Descriptor() ([]byte, []int)
func (*AccountInfo) GetAddress ¶
func (m *AccountInfo) GetAddress() string
func (*AccountInfo) GetBalance ¶
func (m *AccountInfo) GetBalance() int32
func (*AccountInfo) GetIndex ¶
func (m *AccountInfo) GetIndex() uint32
func (*AccountInfo) GetLabel ¶
func (m *AccountInfo) GetLabel() string
func (*AccountInfo) GetNetwork ¶
func (m *AccountInfo) GetNetwork() string
func (*AccountInfo) Marshal ¶
func (m *AccountInfo) Marshal() (dAtA []byte, err error)
func (*AccountInfo) MarshalToSizedBuffer ¶
func (m *AccountInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*AccountInfo) ProtoMessage ¶
func (*AccountInfo) ProtoMessage()
func (*AccountInfo) Reset ¶
func (m *AccountInfo) Reset()
func (*AccountInfo) Size ¶
func (m *AccountInfo) Size() (n int)
func (*AccountInfo) String ¶
func (m *AccountInfo) String() string
func (*AccountInfo) Unmarshal ¶
func (m *AccountInfo) Unmarshal(dAtA []byte) error
func (*AccountInfo) XXX_DiscardUnknown ¶
func (m *AccountInfo) XXX_DiscardUnknown()
func (*AccountInfo) XXX_Marshal ¶
func (m *AccountInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AccountInfo) XXX_Merge ¶
func (m *AccountInfo) XXX_Merge(src proto.Message)
func (*AccountInfo) XXX_Size ¶
func (m *AccountInfo) XXX_Size() int
func (*AccountInfo) XXX_Unmarshal ¶
func (m *AccountInfo) XXX_Unmarshal(b []byte) error
type Context ¶ added in v0.4.4
type Context struct { Ctx context.Context ClientContext client.Context HomeDir string RepoPath string NodeRESTUri string NodeGRPCUri string NodeFaucetUri string Rendevouz string BsMultiaddrs []string // contains filtered or unexported fields }
`Context` is a struct that contains the information needed to run the `go-ipfs` node. @property {string} HomeDir - The home directory of the user running the application. @property {string} RepoPath - The path to the IPFS repo. @property {string} NodeRESTUri - The REST endpoint of the node. @property {string} NodeGRPCUri - The GRPC endpoint of the node. @property {string} NodeFaucetUri - The URI of the faucet service. @property {string} Rendevouz - The rendevouz point for the swarm. @property {[]string} BsMultiaddrs - The bootstrap multiaddrs. @property encPubKey - The public key of the encryption key pair. @property encPrivKey - The private key used to encrypt the data.
func NewContext ¶ added in v0.4.4
NewContext creates a new context object, initializes the encryption keys, and returns the context object
func (*Context) DecryptMessage ¶ added in v0.4.4
The recipient can decrypt the message using their private key and the sender's public key. When you decrypt, you must use the same nonce you used to encrypt the message. One way to achieve this is to store the nonce alongside the encrypted message. Above, we stored the nonce in the first 24 bytes of the encrypted text.
func (*Context) EncryptMessage ¶ added in v0.4.4
Write encrypts a message using the box algorithm This encrypts msg and appends the result to the nonce.
type DIDConfig ¶ added in v0.4.4
type DIDConfig struct { // Method is the DID method name Method string `json:"method"` // Network is the DID network name Network string `json:"network"` // Identifier is the DID identifier Identifier string `json:"identifier"` // Path is the DID path Path string `json:"path"` // Fragment is the DID fragment Fragment string `json:"fragment"` }
DIDConfig is a DID URI config
func DefaultDidUriConfig ¶ added in v0.4.4
func DefaultDidUriConfig() *DIDConfig
DefaultDidUriConfig returns a new DID URI config with default values
type DIDOption ¶ added in v0.4.4
type DIDOption func(*DIDConfig)
DIDOption is a function that configures a DID URI config
func WithFragment ¶ added in v0.4.4
WithFragment sets the DID fragment
func WithIdentifier ¶ added in v0.4.4
WithIdentifier sets the DID identifier
func WithMethod ¶ added in v0.4.4
WithMethod sets the DID method name
func WithNetwork ¶ added in v0.4.4
WithNetwork sets the DID network name
type IPFSNode ¶ added in v0.4.4
type IPFSNode interface { Node // Get the IPFS Core API CoreAPI() icore.CoreAPI // Add a file to the network Add(data []byte) (string, error) // AddEncrypted adds a file to the network, encrypted with the given public key. Encrypt(file []byte, pubKey []byte) []byte // AddPath adds a file to the network AddPath(path string) (string, error) // Get a file from the network Get(hash string) ([]byte, error) // GetDecrypted takes a cid and a public key and returns the decrypted file. Decrypt(bz []byte, pubKey []byte) ([]byte, bool) // GetPath gets a file from the network GetPath(hash string) (map[string]files.Node, error) // It's returning a DocumentStore for the given username. LoadDocsStore(username string) (iface.DocumentStore, error) // It's returning a DocumentStore for the given username. LoadEventLogStore(username string) (iface.EventLogStore, error) // It's returning a KeyValueStore for the given username. LoadKeyValueStore(username string) (iface.KeyValueStore, error) }
`IPFSNode` is an interface that defines the methods that a Highway node must implement. @property Add - This is the function that adds a file to the IPFS network. @property {error} Connect - Connects to a peer @property CoreAPI - This is the IPFS Core API. @property Get - Get a file from the network @property {string} MultiAddr - The multiaddr of the node @property PeerID - The peer ID of the node @property GetDecrypted - This is a method that takes a cid and a public key and returns the decrypted file. @property AddEncrypted - Add a file to the network, encrypted with the given public key.
type Node ¶ added in v0.4.4
type Node interface { // Context returns protocol.Context Context() *Context WrapClientContext(c client.Context) *Context // PeerID returns the peer ID of the node PeerID() peer.ID // Connect to a peer Connect(peers ...string) error // MultiAddrs returns the multiaddr of the node MultiAddrs() string // Close the node Close() error }
`Node` is an interface that defines the methods that a node must implement to be used by the Motor library. @property PeerID - The peer ID of the node. @property {error} Connect - Connect to a peer @property {string} MultiAddrs - The multiaddr of the node @property {error} Close - Close the node
type NodeCallback ¶ added in v0.4.4
NodeCallback is an interface with three methods: OnDiscover, OnLinking, and OnTopicMessage. @property OnDiscover - This is called when a node is discovered. The data is the data that was sent by the node. @property OnLinking - This is called when a node is linking to the gateway. @property OnTopicMessage - This is the callback that will be called when a message is received on a topic.
func DefaultCallback ¶ added in v0.4.4
func DefaultCallback() NodeCallback
It returns a pointer to a defaultCallback struct
type PeerInfo ¶
type PeerInfo struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` PeerId string `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` Multiaddr string `protobuf:"bytes,4,opt,name=multiaddr,proto3" json:"multiaddr,omitempty"` }
Basic Info Sent to Peers to Establish Connections
func (*PeerInfo) Descriptor ¶
func (*PeerInfo) GetMultiaddr ¶
func (*PeerInfo) MarshalToSizedBuffer ¶
func (*PeerInfo) ProtoMessage ¶
func (*PeerInfo) ProtoMessage()
func (*PeerInfo) XXX_DiscardUnknown ¶
func (m *PeerInfo) XXX_DiscardUnknown()
func (*PeerInfo) XXX_Marshal ¶
func (*PeerInfo) XXX_Unmarshal ¶
type PeerNode ¶ added in v0.4.4
type PeerNode interface { Node // NewStream creates a new stream to a peer NewStream(to peer.ID, protocol protocol.ID, msg proto.Message) error // SetStreamHandler sets the handler for a given protocol SetStreamHandler(protocol protocol.ID, handler network.StreamHandler) // Publish a message to a topic Publish(topic string, message []byte, opts ...ps.TopicOpt) error // Subscribe to a topic Subscribe(topic string, handlers ...func(msg *ps.Message)) (*ps.Subscription, error) }
`PeerNode` is an interface that defines the methods that a node must implement to be used by the Motor library. @property PeerID - The peer ID of the node. @property {error} Connect - Connect to a peer @property {string} MultiAddrs - The multiaddresses of the node. @property {error} NewStream - This is the function that allows you to create a new stream to a peer. @property {error} Publish - Publish a message to a topic. @property SetStreamHandler - This is a function that sets the handler for a given protocol. @property Subscribe - Subscribe to a topic. @property {error} Close - Closes the node.
type SNRPubKey ¶ added in v0.4.4
type SNRPubKey interface { cryptotypes.PubKey Bech32(pfix string) (string, error) Multibase() string Raw() []byte }
`SNRPubKey` is a `PubKey` that has a `DID` and a `Multibase` @property {string} DID - The DID of the SNR @property {string} Multibase - The multibase encoding of the DID.
type WalletInfo ¶
type WalletInfo struct { // Controller is the associated Sonr address. Controller string `protobuf:"bytes,1,opt,name=controller,proto3" json:"controller,omitempty"` // DiscoverPaths is a list of all known hardened coin type paths. DiscoveredPaths []int32 `protobuf:"varint,2,rep,packed,name=discovered_paths,json=discoveredPaths,proto3" json:"discovered_paths,omitempty"` // Algorithm is the algorithm of the wallet. CMP is the default. Algorithm string `protobuf:"bytes,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"` // CreatedAt is the time the wallet was created. CreatedAt int64 `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // LastUpdated is the last time the wallet was updated. LastUpdated int64 `protobuf:"varint,5,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` }
func (*WalletInfo) Descriptor ¶
func (*WalletInfo) Descriptor() ([]byte, []int)
func (*WalletInfo) GetAlgorithm ¶
func (m *WalletInfo) GetAlgorithm() string
func (*WalletInfo) GetController ¶
func (m *WalletInfo) GetController() string
func (*WalletInfo) GetCreatedAt ¶
func (m *WalletInfo) GetCreatedAt() int64
func (*WalletInfo) GetDiscoveredPaths ¶
func (m *WalletInfo) GetDiscoveredPaths() []int32
func (*WalletInfo) GetLastUpdated ¶
func (m *WalletInfo) GetLastUpdated() int64
func (*WalletInfo) Marshal ¶
func (m *WalletInfo) Marshal() (dAtA []byte, err error)
func (*WalletInfo) MarshalToSizedBuffer ¶
func (m *WalletInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*WalletInfo) ProtoMessage ¶
func (*WalletInfo) ProtoMessage()
func (*WalletInfo) Reset ¶
func (m *WalletInfo) Reset()
func (*WalletInfo) Size ¶
func (m *WalletInfo) Size() (n int)
func (*WalletInfo) String ¶
func (m *WalletInfo) String() string
func (*WalletInfo) Unmarshal ¶
func (m *WalletInfo) Unmarshal(dAtA []byte) error
func (*WalletInfo) XXX_DiscardUnknown ¶
func (m *WalletInfo) XXX_DiscardUnknown()
func (*WalletInfo) XXX_Marshal ¶
func (m *WalletInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*WalletInfo) XXX_Merge ¶
func (m *WalletInfo) XXX_Merge(src proto.Message)
func (*WalletInfo) XXX_Size ¶
func (m *WalletInfo) XXX_Size() int
func (*WalletInfo) XXX_Unmarshal ¶
func (m *WalletInfo) XXX_Unmarshal(b []byte) error