Documentation ¶
Index ¶
- Constants
- Variables
- func AuthMiddleware(params MiddlewareParams) resty.RequestMiddleware
- func CheckJWTTokenExpiration(tokenString string) (bool, error)
- func IssueJWT(client resty.Client, wallet Wallet) (string, error)
- func ValidateEtherumWallet(wallet string) bool
- func ValidateSolanaWallet(wallet string) bool
- func ValidateSuiWallet(walletAddress string) bool
- func VerifyEtherumMessage(signature string, message, walletAddress string) (bool, error)
- func VerifySolanaMessage(message, signature, publicKey string) (bool, error)
- func VerifySuiMessage(signature string, message, walletAddress string) (bool, error)
- type ACL
- type ACLImpl
- type ACLRequest
- type AcceptedDataAssetResponse
- type AccountCreateRequest
- type AccountUpdateRequest
- type Accounts
- type AccountsImpl
- type Auth
- type AuthImpl
- type AuthRequest
- type ComputeRequestAcceptRequest
- type ComputeRequestCreateRequest
- type ComputeRequestReceivedResponse
- type ComputeRequestResponse
- type ComputingProcessResponse
- type Config
- type CreateDataAssetRequest
- type DataAsset
- type DataAssetIDRequestAndResponse
- type DataAssetImpl
- func (u *DataAssetImpl) DeleteAsset(id int64) (MessageResponse, error)
- func (u *DataAssetImpl) Download(id int64) (*FileResponse, error)
- func (u *DataAssetImpl) Get(id int64) (PublicDataAsset, error)
- func (u *DataAssetImpl) GetCreatedByMe(page int, page_size int) (HelperPaginatedResponse[[]PublicDataAsset], error)
- func (u *DataAssetImpl) GetReceivedByMe(page int, page_size int) (HelperPaginatedResponse[[]PublicDataAsset], error)
- func (u *DataAssetImpl) Share(id int64, shareDetails []ShareDataAssetRequest) ([]PublicACL, error)
- func (u *DataAssetImpl) UpdateAsset(id string, dataAssetInput UpdateDataAssetRequest) (PublicDataAsset, error)
- func (u *DataAssetImpl) UpdateFile(id string, fileName string, fileContent []byte, aclList *[]ACLRequest, ...) (PublicDataAsset, error)
- func (u *DataAssetImpl) Upload(dataAssetInput CreateDataAssetRequest) (DataAssetIDRequestAndResponse, error)
- func (u *DataAssetImpl) UploadFile(fileName string, fileContent []byte, aclList *[]ACLRequest, ...) (DataAssetIDRequestAndResponse, error)
- type DataModel
- type DataModelCreateRequest
- type DataModelImpl
- func (u *DataModelImpl) Create(dataModelInput DataModelCreateRequest) (DataModelResponse, error)
- func (u *DataModelImpl) GetAll(page int, page_size int) (HelperPaginatedResponse[[]DataModelResponse], error)
- func (u *DataModelImpl) GetById(id int64) (DataModelResponse, error)
- func (u *DataModelImpl) GetMy(page int, page_size int) (HelperPaginatedResponse[[]DataModelResponse], error)
- func (u *DataModelImpl) Update(id int64, dataModelInput DataModelUpdateRequest) (DataModelResponse, error)
- type DataModelResponse
- type DataModelUpdateRequest
- type DeleteACLRequest
- type Error
- type EtherumService
- type FileResponse
- type HelperLinks
- type HelperMeta
- type HelperPaginatedResponse
- type MessageResponse
- type MiddlewareParams
- type ModelWalletAddress
- type MyAccountResponse
- type ParsedKeypair
- type PublicACL
- type PublicAccountResponse
- type PublicDataAsset
- type ResponsesMessageResponse
- type SDK
- type SDKConfig
- type ShareDataAssetRequest
- type SigFlag
- type SignaturePubkeyPair
- type SolanaService
- type SuiService
- type TokenResponse
- type TypesAccessLevel
- type TypesComputeOperation
- type UpdateDataAssetRequest
- type Wallet
- type WalletCreateRequest
- type WalletDetails
- type WalletImpl
- type WalletInterface
- type WalletService
- type WalletSignMessageType
- type WalletTypeEnum
Constants ¶
View Source
const ( AcceptComputeRequest = "/compute-requests/{id}/accept" DownloadDataAssetByID = "/data-assets/{id}/download" GetDataAssetsByDataModelID = "/data-models/{id}/data-assets" CreateAccount = "/accounts" RemoveWallet = "/accounts/me/wallets/{address}" RefreshToken = "/auth/refresh-token" GetComputeRequests = "/compute-requests/me" AuthenticateAccount = "/auth" GetComputeRequestsReceived = "/compute-requests/received" GetDataAssetByID = "/data-assets/{id}" UpdateDataAssetByID = "/data-assets/{id}" DeleteDataAssetByID = "/data-assets/{id}" GetDataModelsByUser = "/data-models/me" GetComputeRequest = "/compute-requests/{id}" GetCreatedDataAssets = "/data-assets/created" GetDataModelByID = "/data-models/{id}" UpdateDataModel = "/data-models/{id}" GetMyAccount = "/accounts/me" UpdateAccount = "/accounts/me" AddWallet = "/accounts/me/wallets" DeleteAssignedRoleByACL = "/data-assets/{id}/acl/delete" GetAllDataAssetsThatTheAuthenticatedUserHasAccessTo = "/data-assets/me" GetReceivedDataAssets = "/data-assets/received" GetAccount = "/accounts/{did}" GenerateSignMessage = "/auth/message" CreateComputeRequest = "/compute-requests" CreateComputingProcess = "/compute-requests/{id}/start" CreateANewDataAsset = "/data-assets" AssignACLItemsToDataAsset = "/data-assets/{id}/acl" UpdateACLItemsToDataAsset = "/data-assets/{id}/acl" GetDataModels = "/data-models" CreateDataModel = "/data-models" )
View Source
const ( SUI_PRIVATE_KEY_PREFIX = "suiprivkey" PRIVATE_KEY_SIZE = 32 SUI_ADDRESS_LENGTH = 20 )
View Source
const SignatureScheme = 3
Variables ¶
View Source
var SIGNATURE_FLAG_TO_SCHEME = map[byte]string{
0x00: "ED25519",
}
View Source
var UNPROTECTED_ROUTES = []string{GenerateSignMessage, RefreshToken, AuthenticateAccount}
Functions ¶
func AuthMiddleware ¶
func AuthMiddleware(params MiddlewareParams) resty.RequestMiddleware
func CheckJWTTokenExpiration ¶
func ValidateEtherumWallet ¶
func ValidateSolanaWallet ¶
func ValidateSuiWallet ¶
func VerifyEtherumMessage ¶
func VerifySolanaMessage ¶
Types ¶
type ACL ¶
type ACL interface { Add(id int64, aclList []ACLRequest) (PublicACL, error) Update(id int64, aclList []ACLRequest) (PublicACL, error) Delete(id int64, aclList []ACLRequest) (string, error) }
type ACLRequest ¶
type ACLRequest struct { Address string `json:"address"` Roles []TypesAccessLevel `json:"roles"` }
type AccountCreateRequest ¶
type AccountUpdateRequest ¶
type Accounts ¶
type Accounts interface { Create(accountDetails AccountCreateRequest) (string, error) GetMe() (MyAccountResponse, error) UpdateMe(updateDetails AccountUpdateRequest) (MyAccountResponse, error) }
type AccountsImpl ¶
type AccountsImpl struct { Config Config Wallet WalletInterface }
func NewAccountsImpl ¶
func NewAccountsImpl(config Config) *AccountsImpl
func (*AccountsImpl) Create ¶
func (u *AccountsImpl) Create(accountDetails AccountCreateRequest) (string, error)
func (*AccountsImpl) GetMe ¶
func (u *AccountsImpl) GetMe() (MyAccountResponse, error)
func (*AccountsImpl) UpdateMe ¶
func (u *AccountsImpl) UpdateMe(updateDetails AccountUpdateRequest) (MyAccountResponse, error)
type AuthImpl ¶
type AuthImpl struct {
Config Config
}
func NewAuthImpl ¶
func (*AuthImpl) GetMessage ¶
func (*AuthImpl) GetRefreshToken ¶
type AuthRequest ¶
type ComputeRequestAcceptRequest ¶
type ComputeRequestAcceptRequest struct {
DataAssetId int `json:"data_asset_id"`
}
type ComputeRequestCreateRequest ¶
type ComputeRequestCreateRequest struct { Description string `json:"description"` Title string `json:"title"` ComputeFieldName string `json:"compute_field_name"` ComputeOperation interface{} `json:"compute_operation"` ComputeOperationParam *int `json:"compute_operation_param"` DataModelId int `json:"data_model_id"` }
type ComputeRequestReceivedResponse ¶
type ComputeRequestReceivedResponse struct { ComputeOperationParam *int `json:"compute_operation_param"` CreatedAt *string `json:"created_at"` Description *string `json:"description"` Title *string `json:"title"` ComputeFieldName *string `json:"compute_field_name"` CreatedBy *string `json:"created_by"` DataAssetsIds *[]int `json:"data_assets_ids"` DataModelId *int `json:"data_model_id"` Id *int `json:"id"` UpdatedAt *string `json:"updated_at"` ComputeOperation *string `json:"compute_operation"` }
type ComputeRequestResponse ¶
type ComputeRequestResponse struct { Description *string `json:"description"` Title *string `json:"title"` ComputeFieldName *string `json:"compute_field_name"` CreatedAt *string `json:"created_at"` ComputeOperationParam *int `json:"compute_operation_param"` CreatedBy *string `json:"created_by"` DataModelId *int `json:"data_model_id"` Id *int `json:"id"` UpdatedAt *string `json:"updated_at"` AcceptedDataAssets *[]AcceptedDataAssetResponse `json:"accepted_data_assets"` ComputeOperation *string `json:"compute_operation"` }
type CreateDataAssetRequest ¶
type DataAsset ¶
type DataAsset interface { Upload(dataAssetInput CreateDataAssetRequest) (DataAssetIDRequestAndResponse, error) UploadFile(fileName string, fileContent []byte, aclList *[]ACLRequest, expirationDate *time.Time) (DataAssetIDRequestAndResponse, error) GetCreatedByMe(page int, page_size int) (HelperPaginatedResponse[[]PublicDataAsset], error) GetReceivedByMe(page int, page_size int) (HelperPaginatedResponse[[]PublicDataAsset], error) Get(id int64) (PublicDataAsset, error) UpdateAsset(id string, dataAssetInput UpdateDataAssetRequest) (PublicDataAsset, error) UpdateFile(id string, fileName string, fileContent []byte, aclList *[]ACLRequest, expirationDate *time.Time) (PublicDataAsset, error) DeleteAsset(id int64) (MessageResponse, error) Download(id int64) (*FileResponse, error) }
type DataAssetIDRequestAndResponse ¶
type DataAssetIDRequestAndResponse struct {
Id int `json:"id"`
}
type DataAssetImpl ¶
type DataAssetImpl struct {
Config Config
}
func NewDataAssetImpl ¶
func NewDataAssetImpl(config Config) *DataAssetImpl
func (*DataAssetImpl) DeleteAsset ¶
func (u *DataAssetImpl) DeleteAsset(id int64) (MessageResponse, error)
func (*DataAssetImpl) Download ¶
func (u *DataAssetImpl) Download(id int64) (*FileResponse, error)
func (*DataAssetImpl) Get ¶
func (u *DataAssetImpl) Get(id int64) (PublicDataAsset, error)
func (*DataAssetImpl) GetCreatedByMe ¶
func (u *DataAssetImpl) GetCreatedByMe(page int, page_size int) (HelperPaginatedResponse[[]PublicDataAsset], error)
func (*DataAssetImpl) GetReceivedByMe ¶
func (u *DataAssetImpl) GetReceivedByMe(page int, page_size int) (HelperPaginatedResponse[[]PublicDataAsset], error)
func (*DataAssetImpl) Share ¶
func (u *DataAssetImpl) Share(id int64, shareDetails []ShareDataAssetRequest) ([]PublicACL, error)
func (*DataAssetImpl) UpdateAsset ¶
func (u *DataAssetImpl) UpdateAsset(id string, dataAssetInput UpdateDataAssetRequest) (PublicDataAsset, error)
func (*DataAssetImpl) UpdateFile ¶
func (u *DataAssetImpl) UpdateFile(id string, fileName string, fileContent []byte, aclList *[]ACLRequest, expirationDate *time.Time) (PublicDataAsset, error)
func (*DataAssetImpl) Upload ¶
func (u *DataAssetImpl) Upload(dataAssetInput CreateDataAssetRequest) (DataAssetIDRequestAndResponse, error)
func (*DataAssetImpl) UploadFile ¶
func (u *DataAssetImpl) UploadFile(fileName string, fileContent []byte, aclList *[]ACLRequest, expirationDate *time.Time) (DataAssetIDRequestAndResponse, error)
type DataModel ¶
type DataModel interface { GetAll(page int, page_size int) (HelperPaginatedResponse[[]DataModelResponse], error) Create(dataModelInput DataModelCreateRequest) (DataModelResponse, error) GetMy(page int, page_size int) (HelperPaginatedResponse[[]DataModelResponse], error) GetById(id int64) (DataModelResponse, error) Update(id int64, dataModelInput DataModelUpdateRequest) (DataModelResponse, error) }
type DataModelCreateRequest ¶
type DataModelImpl ¶
type DataModelImpl struct {
Config Config
}
func NewDataModelImpl ¶
func NewDataModelImpl(config Config) *DataModelImpl
func (*DataModelImpl) Create ¶
func (u *DataModelImpl) Create(dataModelInput DataModelCreateRequest) (DataModelResponse, error)
func (*DataModelImpl) GetAll ¶
func (u *DataModelImpl) GetAll(page int, page_size int) (HelperPaginatedResponse[[]DataModelResponse], error)
func (*DataModelImpl) GetById ¶
func (u *DataModelImpl) GetById(id int64) (DataModelResponse, error)
func (*DataModelImpl) GetMy ¶
func (u *DataModelImpl) GetMy(page int, page_size int) (HelperPaginatedResponse[[]DataModelResponse], error)
func (*DataModelImpl) Update ¶
func (u *DataModelImpl) Update(id int64, dataModelInput DataModelUpdateRequest) (DataModelResponse, error)
type DataModelResponse ¶
type DataModelUpdateRequest ¶
type DeleteACLRequest ¶
type DeleteACLRequest struct {
Addresses []string `json:"addresses"`
}
type EtherumService ¶
type EtherumService struct { WalletPrivateKey *ecdsa.PrivateKey WalletAddress string }
func NewEtherumService ¶
func NewEtherumService(walletPrivateKey string) *EtherumService
func (*EtherumService) GetWallet ¶
func (es *EtherumService) GetWallet() string
func (*EtherumService) SignMessage ¶
func (es *EtherumService) SignMessage(message string) (WalletSignMessageType, error)
type FileResponse ¶
type HelperLinks ¶
type HelperMeta ¶
type HelperPaginatedResponse ¶
type HelperPaginatedResponse[T any] struct { Data T `json:"data"` Links HelperLinks `json:"links"` Meta HelperMeta `json:"meta"` }
type MessageResponse ¶
type MessageResponse struct {
Message string `json:"message"`
}
type MiddlewareParams ¶
type MiddlewareParams struct { Client *resty.Client Wallet WalletService }
type ModelWalletAddress ¶
type MyAccountResponse ¶
type MyAccountResponse struct { Username string `json:"username"` UsernameUpdatedAt string `json:"username_updated_at"` WalletAddresses []ModelWalletAddress `json:"wallet_addresses"` CreatedAt string `json:"created_at"` Did string `json:"did"` ProfilePicture *string `json:"profile_picture"` StorageSize int `json:"storage_size"` UpdatedAt string `json:"updated_at"` }
type ParsedKeypair ¶
type PublicAccountResponse ¶
type PublicDataAsset ¶
type PublicDataAsset struct { Type string `json:"type"` CreatedAt *string `json:"created_at"` CreatedBy string `json:"created_by"` DataModelId *int `json:"data_model_id"` ExpirationDate *string `json:"expiration_date"` Fid string `json:"fid"` Name string `json:"name"` TransactionId string `json:"transaction_id"` UpdatedAt *string `json:"updated_at"` Acl []PublicACL `json:"acl"` Id int `json:"id"` Size int `json:"size"` Tags *[]string `json:"tags"` }
type ResponsesMessageResponse ¶
type ResponsesMessageResponse struct {
Message string `json:"message"`
}
type SDK ¶
type SDK struct { DataAssets DataAsset DataModel DataModel Account *AccountsImpl ACL ACL Auth Auth }
func (*SDK) Reinitialize ¶
type SDKConfig ¶
type SDKConfig struct { ApiKey string WalletDetails WalletDetails URL string }
type ShareDataAssetRequest ¶
type ShareDataAssetRequest struct {
}type SignaturePubkeyPair ¶
type SolanaService ¶
type SolanaService struct {
// contains filtered or unexported fields
}
func NewSolanaService ¶
func NewSolanaService(walletPrivateKey string) *SolanaService
func (*SolanaService) GetWallet ¶
func (ss *SolanaService) GetWallet() string
func (*SolanaService) SignMessage ¶
func (ss *SolanaService) SignMessage(message string) (WalletSignMessageType, error)
type SuiService ¶
type SuiService struct {
// contains filtered or unexported fields
}
func NewSuiService ¶
func NewSuiService(walletPrivateKey string) *SuiService
Note this is a custom implementation of Sui Wallet in go.
func (*SuiService) GetWallet ¶
func (es *SuiService) GetWallet() string
func (*SuiService) SignMessage ¶
func (es *SuiService) SignMessage(message string) (WalletSignMessageType, error)
type TokenResponse ¶
type TokenResponse struct {
Token string `json:"token"`
}
type TypesAccessLevel ¶
type TypesAccessLevel string
const ( RoleView TypesAccessLevel = "view" RoleUpdate TypesAccessLevel = "update" RoleDelete TypesAccessLevel = "delete" )
type TypesComputeOperation ¶
type TypesComputeOperation string
const ( ComputeOperationAdd TypesComputeOperation = "add" ComputeOperationSubtract TypesComputeOperation = "subtract" ComputeOperationMultiply TypesComputeOperation = "multiply" ComputeOperationDivide TypesComputeOperation = "divide" ComputeOperationSum TypesComputeOperation = "sum" ComputeOperationGreaterThan TypesComputeOperation = "greater_than" ComputeOperationGreaterThanOrEqual TypesComputeOperation = "greater_than_or_equal" ComputeOperationLessThan TypesComputeOperation = "less_than" ComputeOperationEqual TypesComputeOperation = "equal" ComputeOperationNotEqual TypesComputeOperation = "not_equal" ComputeOperationExponential TypesComputeOperation = "exponential" ComputeOperationRemainder TypesComputeOperation = "remainder" )
type UpdateDataAssetRequest ¶
type Wallet ¶
type Wallet interface {
SignMessage(message string) (WalletSignMessageType, error)
}
type WalletCreateRequest ¶
type WalletCreateRequest struct {
Address string `json:"address"`
}
type WalletDetails ¶
type WalletDetails struct { PrivateKey string WalletType WalletTypeEnum }
type WalletImpl ¶
type WalletImpl struct {
Config Config
}
func NewWalletImpl ¶
func NewWalletImpl(config Config) *WalletImpl
func (*WalletImpl) Add ¶
func (u *WalletImpl) Add(address string) (MyAccountResponse, error)
func (*WalletImpl) Remove ¶
func (u *WalletImpl) Remove(address string) (MyAccountResponse, error)
type WalletInterface ¶
type WalletInterface interface { Add(address string) (MyAccountResponse, error) Remove(address string) (MyAccountResponse, error) }
type WalletService ¶
type WalletService struct { Wallet Wallet WalletType WalletTypeEnum WalletPrivKey string }
func NewWalletService ¶
func NewWalletService(walletPrivateKey string, walletType WalletTypeEnum) (*WalletService, error)
func (*WalletService) SignMessage ¶
func (ws *WalletService) SignMessage(message string) (WalletSignMessageType, error)
type WalletSignMessageType ¶
type WalletTypeEnum ¶
type WalletTypeEnum string
const ( Ethereum WalletTypeEnum = "ethereum" Solana WalletTypeEnum = "solana" Sui WalletTypeEnum = "sui" )
Click to show internal directories.
Click to hide internal directories.