xsessions

package
v0.0.0-...-00a565c Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SESSION_TYPE_HASH         = ctypes.HexToBN("0x1aa0e1c56b45cf06a54534fa1707c54e520b842feb21d03b7deddb6f1e340c")
	STARKNET_MESSAGE          = ctypes.UTF8StrToBig("StarkNet Message")
	STARKNET_DOMAIN_TYPE_HASH = ctypes.HexToBN("0x13cda234a04d66db62c06b8e3ad5f91bd0c67286c2c7519a826cf49da6ba478")
	POLICY_TYPE_HASH          = ctypes.HexToBN("0x2f0026e78543f036f33e26a8f5891b88c58dc1e20cbbfaf0bb53274da6fa568")
)

Functions

func WithSessionKeyPlugin

func WithSessionKeyPlugin(pluginClassHash string, token *SessionKeyToken) caigo.AccountOptionFunc

Types

type Policy

type Policy struct {
	ContractAddress string `json:"contractAddress"`
	Selector        string `json:"selector"`
}

type Session

type Session struct {
	Key      string   `json:"key"`
	Expires  *big.Int `json:"expires"`
	Policies []Policy `json:"policies"`
}

type SessionKeyPlugin

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

func (*SessionKeyPlugin) PluginCall

func (plugin *SessionKeyPlugin) PluginCall(calls []ctypes.FunctionCall) (ctypes.FunctionCall, error)

type SessionKeyToken

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

func SignToken

func SignToken(privateKey, chainId, sessionPublicKey, accountAddress string, duration time.Duration, policies []Policy) (*SessionKeyToken, error)

type SignedSession

type SignedSession struct {
	ChainID        string     `json:"cahinId"`
	AccountAddress string     `json:"account"`
	Root           string     `json:"root"`
	Signature      []*big.Int `json:"Signature"`
}

Jump to

Keyboard shortcuts

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