handler

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: MIT Imports: 54 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeNode

func DecodeNode(encoded []byte) (ipld.Node, error)

func EncodeNode

func EncodeNode(node ipld.Node) ([]byte, error)

func GenerateKeys added in v0.4.8

func GenerateKeys() (string, error)

func InitGenesis added in v0.4.8

func InitGenesis(hostName string, moniker string, cidlink datamodel.Link, priv *ecdsa.PrivateKey) (string, string, error)

func PlaygroundHandler added in v0.4.6

func PlaygroundHandler(anconCtx sdk.AnconSyncContext,
	adapter *ethereum.OnchainAdapter, proofs *proofsignature.IavlProofAPI) gin.HandlerFunc

func RenderPlayground added in v0.4.8

func RenderPlayground(w http.ResponseWriter, r *http.Request)

renderPlayground renders the Playground GUI

Types

type AvailableDid

type AvailableDid string
const (
	DidTypeEthr AvailableDid = "ethr"
	DidTypeWeb  AvailableDid = "web"
	DidTypeKey  AvailableDid = "key"
)

type Commit added in v0.4.9

type Commit struct {
	LastHash []byte
	Height   int64
}

type DagBlockResult added in v0.6.0

type DagBlockResult struct {
	Issuer        string         `json:"issuer"`
	Timestamp     int64          `json:"timestamp"`
	Content       datamodel.Node `json:"content"`
	ContentHash   datamodel.Link `json:"content_hash"`
	CommitHash    string         `json:"commit_hash"`
	Height        int64
	Signature     string `json:"signature"`
	Digest        string `json:"digest"`
	Network       string `json:"network"`
	Key           string `json:"key"`
	RootKey       string
	LastBlockHash string
	ParentHash    string `json:"parent_hash"`
}

type DagJsonHandler added in v0.4.6

type DagJsonHandler struct {
	*sdk.AnconSyncContext
	Proof         *proofsignature.IavlProofService
	IPFSHost      string
	RootKey       string
	Moniker       string
	PreviousBlock datamodel.Link
}

func (*DagJsonHandler) Apply added in v0.6.0

func (dagctx *DagJsonHandler) Apply(args *DagBlockResult) datamodel.Node

func (*DagJsonHandler) ApplyFocusedTransform added in v0.6.0

func (dagctx *DagJsonHandler) ApplyFocusedTransform(node datamodel.Node, mutations []Mutation) (datamodel.Node, error)

func (*DagJsonHandler) DagJsonRead added in v0.4.6

func (dagctx *DagJsonHandler) DagJsonRead(c *gin.Context)

@BasePath /v0 DagJsonRead godoc @Summary Reads JSON from a dag-json block @Schemes @Description Returns JSON @Tags dag-json @Accept json @Produce json @Success 200 @Router /v0/dagjson/{cid}/{path} [get]

func (*DagJsonHandler) DagJsonWrite added in v0.4.6

func (dagctx *DagJsonHandler) DagJsonWrite(c *gin.Context)

@BasePath /v0 DagJsonWrite godoc @Summary Stores JSON as dag-json @Schemes @Description Writes a dag-json block which syncs with IPFS. Returns a CID. @Tags dag-json @Accept json @Produce json @Success 201 {string} cid @Router /v0/dagjson [post]

func (*DagJsonHandler) Update added in v0.6.0

func (dagctx *DagJsonHandler) Update(c *gin.Context)

@BasePath /v0 Update godoc @Summary Stores JSON as dag-json @Schemes @Description updates a dag-json block which syncs with IPFS. Returns a CID. @Tags dag-json @Accept json @Produce json @Success 200 {string} cid @Router /v0/dagjson [put]

func (*DagJsonHandler) UserDag added in v1.0.0

func (dagctx *DagJsonHandler) UserDag(c *gin.Context)

@BasePath /v0 UserDag godoc @Summary Reads JSON from a dag-json block @Schemes @Description Returns JSON @Tags dag-json @Accept json @Produce json @Success 200 @Router /v0/dag/topics/ [get]

type Did added in v0.4.6

type Did struct {
	*sdk.AnconSyncContext
	Proof    *proofsignature.IavlProofService
	IPFSHost string
	RootKey  string
	Moniker  string
}

func (*Did) AddDid added in v0.4.6

func (dagctx *Did) AddDid(didType AvailableDid, domainName string, addr string, pubbytes []byte) (ipld.Link, string, error)

func (*Did) BuildDidKey added in v0.4.6

func (dagctx *Did) BuildDidKey() (*did.Doc, error)

BuildDidKey ....

func (*Did) BuildDidWeb added in v0.4.6

func (dagctx *Did) BuildDidWeb(vanityName string, pubkey []byte) (*did.Doc, error)

BuildDidWeb ....

func (*Did) BuildEthrDid added in v0.6.0

func (dagctx *Did) BuildEthrDid(name string, pubkey []byte) (*did.Doc, error)

BuildDidWeb ....

func (*Did) CreateDid added in v0.6.0

func (dagctx *Did) CreateDid(c *gin.Context)

func (*Did) ParseDIDWeb added in v0.4.6

func (dagctx *Did) ParseDIDWeb(id string, useHTTP bool) (string, string, error)

func (*Did) ReadDid added in v0.4.6

func (dagctx *Did) ReadDid(c *gin.Context)

func (*Did) ReadDidWebUrl added in v0.4.6

func (dagctx *Did) ReadDidWebUrl(c *gin.Context)

type FileHandler added in v0.4.6

type FileHandler struct {
	*sdk.AnconSyncContext
	RootKey string
	Moniker string
}

func (*FileHandler) FileRead added in v0.4.6

func (dagctx *FileHandler) FileRead(c *gin.Context)

@BasePath /v0 FileRead godoc @Summary Reads JSON from a dag-json block @Schemes @Description Returns JSON @Tags file @Accept json @Produce json @Success 200 @Router /v0/file/{cid}/{path} [get]

func (*FileHandler) FileWrite added in v0.4.6

func (dagctx *FileHandler) FileWrite(c *gin.Context)

@BasePath /v0 FileWrite godoc @Summary Stores files @Schemes @Description Writes a raw block which syncs with IPFS. Returns a CID. @Tags file @Accept json @Produce json @Success 201 {string} cid @Router /v0/file [post]

func (*FileHandler) UploadContract added in v0.4.8

func (dagctx *FileHandler) UploadContract(c *gin.Context)

@BasePath /v0 UploadContract godoc @Summary Upload hybrid smartcontracts @Schemes @Description Execute library smartcontracts. @Tags file @Accept json @Produce json @Success 201 {string} cid @Router /v0/code [post]

type Mutation added in v0.6.0

type Mutation struct {
	Path          string
	PreviousValue string
	NextValue     interface{}
	NextValueKind datamodel.Kind
}

type OidcHandler added in v1.0.0

type OidcHandler struct {
	*sdk.AnconSyncContext

	Provider *oidc.Provider
	Config   oauth2.Config
	Verifier *oidc.IDTokenVerifier
}

func NewOidcHandler added in v1.0.0

func NewOidcHandler(ctx *sdk.AnconSyncContext, clientId string, clientSecretKey string, redirectURL string) *OidcHandler

func (*OidcHandler) OIDCCallback added in v1.0.0

func (ctx *OidcHandler) OIDCCallback(c *gin.Context)

func (*OidcHandler) OIDCRequest added in v1.0.0

func (ctx *OidcHandler) OIDCRequest(c *gin.Context)

type ProofHandler added in v0.4.6

type ProofHandler struct {
	*sdk.AnconSyncContext

	LastCommit *Commit

	RootKey string
	// contains filtered or unexported fields
}

func NewProofHandler added in v0.4.6

func NewProofHandler(ctx *sdk.AnconSyncContext, privateKeyPath string) *ProofHandler

func (*ProofHandler) Commit added in v0.4.9

func (h *ProofHandler) Commit() (int64, string, error)

func (*ProofHandler) Create added in v0.4.6

func (dagctx *ProofHandler) Create(c *gin.Context)

@BasePath /v0 Create godoc @Summary Create @Schemes @Description Writes an ics23 proof @Tags proofs @Accept json @Produce json @Success 201 {string} cid @Router /v0/proofs [post]

func (*ProofHandler) GetProofAPI added in v0.4.8

func (h *ProofHandler) GetProofAPI() *proofsignature.IavlProofAPI

func (*ProofHandler) GetProofService added in v0.4.8

func (h *ProofHandler) GetProofService() *proofsignature.IavlProofService

func (*ProofHandler) Read added in v0.4.6

func (dagctx *ProofHandler) Read(c *gin.Context)

@BasePath /v0 Read godoc @Summary Reads an existing proof @Schemes @Description Returns JSON @Tags proofs @Accept json @Produce json @Success 200 @Router /v0/proofs/get/{path} [get]

func (*ProofHandler) ReadCurrentRootHash added in v0.4.6

func (dagctx *ProofHandler) ReadCurrentRootHash(c *gin.Context)

@BasePath /v0 Verify godoc @Summary Verifies an ics23 proofs @Schemes @Description Verifies an ics23 proof @Tags proofs @Accept json @Produce json @Success 201 {string} cid @Router /v0/proofs/verify [post]

func (*ProofHandler) VerifyGenesis added in v0.4.8

func (h *ProofHandler) VerifyGenesis(moniker string, key string) ([]byte, error)

Directories

Path Synopsis
Package hexutil implements hex encoding with 0x prefix.
Package hexutil implements hex encoding with 0x prefix.

Jump to

Keyboard shortcuts

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