mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
Refactored the SonrApp struct by reorganizing and grouping the keepers and other fields.
This commit is contained in:
committed by
Prad Nukala (aider)
parent
f6b04e1599
commit
6c1c3d5f8f
Vendored
-23
@@ -1,23 +0,0 @@
|
||||
package env
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-webauthn/webauthn/protocol"
|
||||
)
|
||||
|
||||
// Default Key in gRPC Metadata for the Session ID
|
||||
const MetadataSessionIDKey = "sonr-session-id"
|
||||
|
||||
// SonrContext is the context for the Sonr API
|
||||
type SonrContext struct {
|
||||
Context context.Context
|
||||
SessionID string `json:"session_id"`
|
||||
UserAddress string `json:"user_address"`
|
||||
ValidatorAddress string `json:"validator_address"`
|
||||
ServiceOrigin string `json:"service_origin"`
|
||||
PeerID string `json:"peer_id"`
|
||||
ChainID string `json:"chain_id"`
|
||||
Token string `json:"token"`
|
||||
Challenge protocol.URLEncodedBase64 `json:"challenge"`
|
||||
}
|
||||
Vendored
-37
@@ -1,37 +0,0 @@
|
||||
package env
|
||||
|
||||
import (
|
||||
"github.com/ipfs/kubo/client/rpc"
|
||||
)
|
||||
|
||||
var (
|
||||
ChainID = "testnet"
|
||||
ValAddr = "val1"
|
||||
NodeDir = ".sonr"
|
||||
)
|
||||
|
||||
// Initialize initializes the local configuration values
|
||||
func init() {
|
||||
}
|
||||
|
||||
// SetLocalContextSessionID sets the session ID for the local context
|
||||
func SetLocalValidatorAddress(address string) {
|
||||
ValAddr = address
|
||||
}
|
||||
|
||||
// SetLocalContextChainID sets the chain ID for the local
|
||||
func SetLocalChainID(id string) {
|
||||
ChainID = id
|
||||
}
|
||||
|
||||
// IPFSClient is an interface for interacting with an IPFS node.
|
||||
type IPFSClient = *rpc.HttpApi
|
||||
|
||||
// NewLocalClient creates a new IPFS client that connects to the local IPFS node.
|
||||
func GetIPFSClient() (IPFSClient, error) {
|
||||
rpcClient, err := rpc.NewLocalApi()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rpcClient, nil
|
||||
}
|
||||
Reference in New Issue
Block a user