starknet

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefStarkJsonData = StarkJsonData{
	Types: map[string]caigo.TypeDef{
		"StarkNetDomain": caigo.TypeDef{
			Definitions: []caigo.Definition{
				{
					Name: "name",
					Type: "felt",
				},
				{
					Name: "version",
					Type: "felt",
				},
				{
					Name: "chainId",
					Type: "felt",
				},
			},
		},
		"Server": {
			Definitions: []caigo.Definition{
				{
					Name: "name",
					Type: "felt",
				},
				{
					Name: "url",
					Type: "felt",
				},
				{
					Name: "did",
					Type: "felt",
				},
			},
		},
		"SignData": {
			Definitions: []caigo.Definition{
				{
					Name: "type",
					Type: "felt",
				},
				{
					Name: "server",
					Type: "Server",
				},
				{
					Name: "nonce",
					Type: "felt",
				},
				{
					Name: "did",
					Type: "felt",
				},
				{
					Name: "created",
					Type: "felt",
				},
			},
		},
	},
	PrimaryType: "SignData",
	Domain: caigo.Domain{
		Name:    "TaskOn",
		Version: "1",
		ChainId: "1",
	},
}
View Source
var DefStarkJsonDataBindAddress = StarkJsonData{
	Types: map[string]caigo.TypeDef{
		"StarkNetDomain": caigo.TypeDef{
			Definitions: []caigo.Definition{
				{
					Name: "name",
					Type: "felt",
				},
				{
					Name: "version",
					Type: "felt",
				},
				{
					Name: "chainId",
					Type: "felt",
				},
			},
		},
		"SignData": {
			Definitions: []caigo.Definition{
				{
					Name: "server_name",
					Type: "felt",
				},
				{
					Name: "timestamp",
					Type: "felt",
				},
				{
					Name: "address",
					Type: "felt",
				},
				{
					Name: "user_id",
					Type: "felt",
				},
				{
					Name: "chain_type",
					Type: "felt",
				},
			},
		},
	},
	PrimaryType: "SignData",
	Domain: caigo.Domain{
		Name:    "TaskOn",
		Version: "1",
		ChainId: "1",
	},
}

Functions

This section is empty.

Types

type DefinitionSpec

type DefinitionSpec struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type StarkJsonData

type StarkJsonData struct {
	Types       map[string]caigo.TypeDef `json:"types"`
	PrimaryType string                   `json:"primaryType"`
	Domain      caigo.Domain             `json:"domain"`
}

type StarkJsonMessage

type StarkJsonMessage struct {
	Type   string `json:"type"`
	Server struct {
		Name string `json:"name"`
		Url  string `json:"url"`
		Did  string `json:"did"`
	} `json:"server"`
	Nonce   string `json:"nonce"`
	Did     string `json:"did"`
	Created int    `json:"created"`
}

func (*StarkJsonMessage) FmtDefinitionEncoding

func (self *StarkJsonMessage) FmtDefinitionEncoding(field string) (fmtEnc []*big.Int)

type StarkJsonMessageBindAddr added in v0.2.2

type StarkJsonMessageBindAddr struct {
	ServerName string `json:"server_name"` // taskon
	Timestamp  int64  `json:"timestamp"`   // timestamp in second
	Address    string `json:"address"`
	UserId     int64  `json:"user_id"`
	ChainType  string `json:"chain_type"` // evm or solana
}

func (*StarkJsonMessageBindAddr) FmtDefinitionEncoding added in v0.2.2

func (self *StarkJsonMessageBindAddr) FmtDefinitionEncoding(field string) (fmtEnc []*big.Int)

type StarkNetProcessor

type StarkNetProcessor struct {
	// contains filtered or unexported fields
}

func NewStarkNetProcessor

func NewStarkNetProcessor(rpc string) *StarkNetProcessor

func (StarkNetProcessor) GetCredentialJsons

func (s StarkNetProcessor) GetCredentialJsons(presentation string) ([]string, error)

func (StarkNetProcessor) Sign

func (s StarkNetProcessor) Sign(did string, index int, msg []byte) ([]byte, error)

func (StarkNetProcessor) VerifyCredential

func (s StarkNetProcessor) VerifyCredential(credential string, trustedDIDs []string) error

func (StarkNetProcessor) VerifyPresentation

func (s StarkNetProcessor) VerifyPresentation(presentation string, requiredTypes []*modules.VCFilter) error

func (StarkNetProcessor) VerifySig

func (s StarkNetProcessor) VerifySig(did string, index int, msg []byte, sig []byte, pubkeyBytes []byte) error

func (StarkNetProcessor) VerifySigOld

func (s StarkNetProcessor) VerifySigOld(did string, index int, msg []byte, sig []byte, pubkeyBytes []byte) error

type Types

type Types struct {
	StarkNetDomain []DefinitionSpec `json:"StarkNetDomain"`
	Server         []DefinitionSpec `json:"Server"`
	SignData       []DefinitionSpec `json:"SignData"`
}

Jump to

Keyboard shortcuts

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