Documentation
¶
Index ¶
- Constants
- Variables
- func AbiEncodePermission(p *Permission) (string, error)
- func Concat(slices [][]byte) []byte
- func ConcatBytes(slices ...[]byte) []byte
- func ConcatMap(ts []SessionsTopology, f func(SessionsTopology) []byte) []byte
- func DecodeRawPayload(address common.Address, chainID *big.Int, data []byte) (core.Payload, error)
- func EncodePermission(p *Permission) ([]byte, error)
- func EncodeSessionCallSignatures(callSignatures []SessionCallSignature, topology SessionsTopology, ...) ([]byte, error)
- func EncodeSessionPermissions(sp *SessionPermissions) ([]byte, error)
- func EncodeSessionsTopology(topology SessionsTopology) ([]byte, error)
- func FromNumber(n uint64) []byte
- func GenerateImplicitRequestMagic(attestation *Attestation, wallet common.Address) []byte
- func GetExplicitSigners(topology SessionsTopology) []common.Address
- func IsCompleteSessionsTopology(topology SessionsTopology) bool
- func IsCompleteTree(tree Tree) bool
- func IsEmptyTopology(st SessionsTopology) bool
- func IsIdentitySignerLeaf(st SessionsTopology) bool
- func IsImplicitBlacklistLeaf(st SessionsTopology) bool
- func IsSessionPermissionsLeaf(st SessionsTopology) bool
- func IsSessionsBranch(st SessionsTopology) bool
- func IsSessionsLeaf(st SessionsTopology) bool
- func IsSessionsNode(st SessionsTopology) bool
- func LeftPad(b []byte, length int) []byte
- func PadLeft(b []byte, length int) []byte
- func PadLeftNumber(n uint64, size int) []byte
- func PayloadWithAddress(payload core.Payload, address common.Address) (core.Payload, error)
- func RecoverSapientSignature(ctx context.Context, signer common.Address, payload core.Payload, ...) (core.ImageHash, error)
- func RecoverSapientSignatureCompact(ctx context.Context, signer common.Address, payload core.Payload, ...) (core.ImageHash, error)
- func SessionsTopologyToJSON(topology SessionsTopology) (string, error)
- func Subtrees(tree Tree) map[common.Hash]Tree
- type Attestation
- type AuthData
- type BehaviorOnError
- type Call
- type CallsPayload
- type ChainedSignature
- func (s ChainedSignature) Checkpoint() uint64
- func (s ChainedSignature) Checkpointer() common.Address
- func (s ChainedSignature) CheckpointerData() []byte
- func (s ChainedSignature) Data() ([]byte, error)
- func (s ChainedSignature) Join(payload core.Payload, other core.Signature[*WalletConfig]) (core.Signature[*WalletConfig], error)
- func (s ChainedSignature) Recover(ctx context.Context, payload core.Payload, provider *ethrpc.Provider, ...) (*WalletConfig, *big.Int, error)
- func (s ChainedSignature) Reduce(payload core.Payload) core.Signature[*WalletConfig]
- func (s ChainedSignature) String() string
- func (s ChainedSignature) Threshold() uint16
- func (s ChainedSignature) Write(writer io.Writer) error
- type ConfigUpdatePayload
- type DecodedPayload
- type DigestPayload
- type ExplicitSessionCallSignature
- type IdentitySignerLeaf
- type ImplicitBlacklistLeaf
- type ImplicitSessionCallSignature
- type MessagePayload
- type NoChainIDSignature
- func (s *NoChainIDSignature) Checkpoint() uint64
- func (s *NoChainIDSignature) Data() ([]byte, error)
- func (s *NoChainIDSignature) Join(payload core.Payload, other core.Signature[*WalletConfig]) (core.Signature[*WalletConfig], error)
- func (s *NoChainIDSignature) Recover(ctx context.Context, payload core.Payload, provider *ethrpc.Provider, ...) (*WalletConfig, *big.Int, error)
- func (s *NoChainIDSignature) Reduce(payload core.Payload) core.Signature[*WalletConfig]
- func (s *NoChainIDSignature) String() string
- func (s *NoChainIDSignature) Threshold() uint16
- func (s *NoChainIDSignature) Write(writer io.Writer) error
- type ParameterOperation
- type ParameterRule
- type PayloadCall
- type Permission
- type RSY
- type RegularSignature
- func (s *RegularSignature) Checkpoint() uint64
- func (s *RegularSignature) Data() ([]byte, error)
- func (s *RegularSignature) Join(payload core.Payload, other core.Signature[*WalletConfig]) (core.Signature[*WalletConfig], error)
- func (s *RegularSignature) Recover(ctx context.Context, payload core.Payload, provider *ethrpc.Provider, ...) (*WalletConfig, *big.Int, error)
- func (s *RegularSignature) Reduce(payload core.Payload) core.Signature[*WalletConfig]
- func (s *RegularSignature) String() string
- func (s *RegularSignature) Threshold() uint16
- func (s *RegularSignature) Write(writer io.Writer) error
- type SessionCallSignature
- type SessionPermissions
- type SessionPermissionsLeaf
- type SessionsTopology
- func AddExplicitSession(topology SessionsTopology, sp SessionPermissions) (SessionsTopology, error)
- func AddToImplicitBlacklist(topology SessionsTopology, addr common.Address) (SessionsTopology, error)
- func EmptySessionsTopology(identitySigner common.Address) SessionsTopology
- func MergeSessionsTopologies(a, b SessionsTopology) SessionsTopology
- func MinimiseSessionsTopology(topology SessionsTopology, explicitSigners []common.Address, ...) (SessionsTopology, error)
- func RemoveExplicitSession(topology SessionsTopology, signerAddr string) (SessionsTopology, error)
- func RemoveFromImplicitBlacklist(topology SessionsTopology, addr common.Address) (SessionsTopology, error)
- func SessionsTopologyFromJSON(data string) (SessionsTopology, error)
- type Signature
- type Tree
- type TreeLeaf
- type TreeNode
- type WalletConfig
- func (c *WalletConfig) BuildNoChainIDSignature(ctx context.Context, sign core.SigningFunction, validateSigningPower bool, ...) (core.Signature[*WalletConfig], error)
- func (c *WalletConfig) BuildRegularSignature(ctx context.Context, sign core.SigningFunction, validateSigningPower bool, ...) (core.Signature[*WalletConfig], error)
- func (c *WalletConfig) BuildSubdigestSignature(noChainID bool) (core.Signature[*WalletConfig], error)
- func (c *WalletConfig) Checkpoint() uint64
- func (c *WalletConfig) ImageHash() core.ImageHash
- func (c *WalletConfig) IsComplete() bool
- func (c *WalletConfig) IsUsable() error
- func (c *WalletConfig) Signers() map[common.Address]uint16
- func (c *WalletConfig) SignersWeight(signers []common.Address) uint16
- func (c *WalletConfig) Threshold() uint16
- type WalletConfigTree
- type WalletConfigTreeAddressLeaf
- type WalletConfigTreeAnyAddressSubdigestLeaf
- type WalletConfigTreeNestedLeaf
- type WalletConfigTreeNode
- type WalletConfigTreeNodeLeaf
- type WalletConfigTreeSapientSignerLeaf
- type WalletConfigTreeSubdigestLeaf
Constants ¶
const ( KindTransactions uint8 = 0x00 KindMessage uint8 = 0x01 KindConfigUpdate uint8 = 0x02 KindDigest uint8 = 0x03 )
const ( MAX_PERMISSIONS_COUNT = (1 << 7) - 1 MAX_RULES_COUNT = (1 << 8) - 1 )
const ( SESSIONS_FLAG_PERMISSIONS = 0 SESSIONS_FLAG_NODE = 1 SESSIONS_FLAG_BRANCH = 2 SESSIONS_FLAG_BLACKLIST = 3 SESSIONS_FLAG_IDENTITY_SIGNER = 4 )
const ( FLAG_SIGNATURE_HASH = 0x00 FLAG_ADDRESS = 0x01 FLAG_SIGNATURE_ERC1271 = 0x02 FLAG_NODE = 0x03 FLAG_BRANCH = 0x04 FLAG_SUBDIGEST = 0x05 FLAG_NESTED = 0x06 FLAG_SIGNATURE_ETH_SIGN = 0x07 FLAG_SIGNATURE_ANY_ADDRESS_SUBDIGEST = 0x08 FLAG_SIGNATURE_SAPIENT = 0x09 FLAG_SIGNATURE_SAPIENT_COMPACT = 0x0A )
Variables ¶
var ACCEPT_IMPLICIT_REQUEST_MAGIC_PREFIX = keccak256([]byte("acceptImplicitRequest"))
ACCEPT_IMPLICIT_REQUEST_MAGIC_PREFIX is the magic prefix for acceptImplicitRequest
var Core core.Core[*WalletConfig, core.Signature[*WalletConfig]] = v3Core{}
Functions ¶
func AbiEncodePermission ¶
func AbiEncodePermission(p *Permission) (string, error)
AbiEncodePermission packs a Permission into an ABI-encoded hex string.
func ConcatBytes ¶
ConcatBytes concatenates multiple byte slices.
func ConcatMap ¶
func ConcatMap(ts []SessionsTopology, f func(SessionsTopology) []byte) []byte
ConcatMap applies f to each element of ts and concatenates the results.
func DecodeRawPayload ¶
func EncodePermission ¶
func EncodePermission(p *Permission) ([]byte, error)
EncodePermission encodes a Permission into bytes.
func EncodeSessionCallSignatures ¶
func EncodeSessionCallSignatures(callSignatures []SessionCallSignature, topology SessionsTopology, explicitSigners, implicitSigners []common.Address) ([]byte, error)
EncodeSessionCallSignatures encodes the call signatures for contract validation.
func EncodeSessionPermissions ¶
func EncodeSessionPermissions(sp *SessionPermissions) ([]byte, error)
EncodeSessionPermissions encodes a SessionPermissions structure into bytes.
func EncodeSessionsTopology ¶
func EncodeSessionsTopology(topology SessionsTopology) ([]byte, error)
EncodeSessionsTopology encodes the topology for contract validation.
func FromNumber ¶
FromNumber converts a uint64 to a 1-byte slice (assumes value fits in 1 byte).
func GenerateImplicitRequestMagic ¶
func GenerateImplicitRequestMagic(attestation *Attestation, wallet common.Address) []byte
GenerateImplicitRequestMagic generates the magic value for an implicit request
func GetExplicitSigners ¶
func GetExplicitSigners(topology SessionsTopology) []common.Address
GetExplicitSigners returns all explicit session permission signers from the topology.
func IsCompleteSessionsTopology ¶
func IsCompleteSessionsTopology(topology SessionsTopology) bool
IsCompleteSessionsTopology checks that there is exactly one identity signer leaf and one implicit-blacklist leaf.
func IsCompleteTree ¶
func IsEmptyTopology ¶
func IsEmptyTopology(st SessionsTopology) bool
func IsIdentitySignerLeaf ¶
func IsIdentitySignerLeaf(st SessionsTopology) bool
func IsImplicitBlacklistLeaf ¶
func IsImplicitBlacklistLeaf(st SessionsTopology) bool
func IsSessionPermissionsLeaf ¶
func IsSessionPermissionsLeaf(st SessionsTopology) bool
func IsSessionsBranch ¶
func IsSessionsBranch(st SessionsTopology) bool
func IsSessionsLeaf ¶
func IsSessionsLeaf(st SessionsTopology) bool
func IsSessionsNode ¶
func IsSessionsNode(st SessionsTopology) bool
func PadLeftNumber ¶
PadLeftNumber converts a number to a big-endian byte slice of fixed size.
func PayloadWithAddress ¶
func RecoverSapientSignature ¶
func SessionsTopologyToJSON ¶
func SessionsTopologyToJSON(topology SessionsTopology) (string, error)
sessionsTopologyToJSON returns the JSON representation of the topology. For node types, it returns a hex string; for session-permissions leaves, it calls the permission package encoder for JSON; for other leaves it returns the object as is; for branches, it maps recursively.
Types ¶
type Attestation ¶
type Attestation struct { ApprovedSigner common.Address `json:"approvedSigner"` IdentityType []byte `json:"identityType"` // bytes4 IssuerHash []byte `json:"issuerHash"` // bytes32 AudienceHash []byte `json:"audienceHash"` // bytes32 ApplicationData []byte `json:"applicationData"` // bytes AuthData AuthData `json:"authData"` }
Attestation implements the Attestation interface
func AttestationFromJson ¶
func AttestationFromJson(jsonStr string) (*Attestation, error)
FromJson parses a JSON string into an Attestation
func AttestationFromParsed ¶
func AttestationFromParsed(parsed map[string]interface{}) (*Attestation, error)
FromParsed reconstructs an Attestation from parsed JSON
func (*Attestation) Encode ¶
func (a *Attestation) Encode() []byte
Encode converts an Attestation to its binary representation
func (*Attestation) EncodeForJson ¶
func (a *Attestation) EncodeForJson() interface{}
EncodeForJson returns a JSON-friendly representation of the attestation
func (*Attestation) Hash ¶
func (a *Attestation) Hash() []byte
Hash computes the Keccak256 hash of the encoded attestation
func (*Attestation) ToJson ¶
func (a *Attestation) ToJson() (string, error)
ToJson converts the attestation to a JSON string
type AuthData ¶
type AuthData struct {
RedirectUrl string `json:"redirectUrl"`
}
AuthData represents authentication data with a redirect URL
type BehaviorOnError ¶
type BehaviorOnError int
const ( BehaviorOnErrorIgnore BehaviorOnError = 0 BehaviorOnErrorRevert BehaviorOnError = 1 BehaviorOnErrorAbort BehaviorOnError = 2 )
type CallsPayload ¶
type CallsPayload struct { Calls []Call Space *big.Int Nonce *big.Int // contains filtered or unexported fields }
func DecodeCalls ¶
func NewCallsPayload ¶
func (CallsPayload) ABIEncode ¶
func (p CallsPayload) ABIEncode() walletstage1.PayloadDecoded
func (CallsPayload) Digest ¶
func (p CallsPayload) Digest() core.PayloadDigest
type ChainedSignature ¶
type ChainedSignature []core.Signature[*WalletConfig]
func (ChainedSignature) Checkpoint ¶
func (s ChainedSignature) Checkpoint() uint64
func (ChainedSignature) Checkpointer ¶
func (s ChainedSignature) Checkpointer() common.Address
func (ChainedSignature) CheckpointerData ¶
func (s ChainedSignature) CheckpointerData() []byte
func (ChainedSignature) Data ¶
func (s ChainedSignature) Data() ([]byte, error)
func (ChainedSignature) Join ¶
func (s ChainedSignature) Join(payload core.Payload, other core.Signature[*WalletConfig]) (core.Signature[*WalletConfig], error)
func (ChainedSignature) Recover ¶
func (s ChainedSignature) Recover(ctx context.Context, payload core.Payload, provider *ethrpc.Provider, signerSignatures ...core.SignerSignatures) (*WalletConfig, *big.Int, error)
func (ChainedSignature) Reduce ¶
func (s ChainedSignature) Reduce(payload core.Payload) core.Signature[*WalletConfig]
func (ChainedSignature) String ¶
func (s ChainedSignature) String() string
func (ChainedSignature) Threshold ¶
func (s ChainedSignature) Threshold() uint16
type ConfigUpdatePayload ¶
type ConfigUpdatePayload struct { ImageHash core.ImageHashable // contains filtered or unexported fields }
func DecodeConfigUpdate ¶
func NewConfigUpdatePayload ¶
func (ConfigUpdatePayload) ABIEncode ¶
func (p ConfigUpdatePayload) ABIEncode() walletstage1.PayloadDecoded
func (ConfigUpdatePayload) Digest ¶
func (p ConfigUpdatePayload) Digest() core.PayloadDigest
type DecodedPayload ¶
type DecodedPayload struct { Kind uint8 NoChainId bool Calls []Call Space *big.Int Nonce *big.Int Message []byte ImageHash common.Hash Digest common.Hash ParentWallets []common.Address }
func DecodeABIPayload ¶
func DecodeABIPayload(input string) (DecodedPayload, error)
type DigestPayload ¶
func NewDigestPayload ¶
func (DigestPayload) ABIEncode ¶
func (p DigestPayload) ABIEncode() walletstage1.PayloadDecoded
func (DigestPayload) Digest ¶
func (p DigestPayload) Digest() core.PayloadDigest
type ExplicitSessionCallSignature ¶
type ExplicitSessionCallSignature struct { PermissionIndex *big.Int // expected to be within byte-range SessionSignature RSY }
ExplicitSessionCallSignature represents a call signature that carries a permission index and a session signature.
type IdentitySignerLeaf ¶
type IdentitySignerLeaf struct { Type string `json:"type"` // must be "identity-signer" IdentitySigner common.Address `json:"identitySigner"` }
IdentitySignerLeaf is a leaf that holds the identity signer.
type ImplicitBlacklistLeaf ¶
type ImplicitBlacklistLeaf struct { Type string `json:"type"` // must be "implicit-blacklist" Blacklist []common.Address `json:"blacklist"` }
ImplicitBlacklistLeaf is a leaf that holds a blacklist.
type ImplicitSessionCallSignature ¶
type ImplicitSessionCallSignature struct { Attestation Attestation IdentitySignature RSY SessionSignature RSY }
ImplicitSessionCallSignature represents a call signature that carries an attestation, an identity signature and a session signature.
type MessagePayload ¶
type MessagePayload struct { Message []byte // contains filtered or unexported fields }
func DecodeMessage ¶
func NewMessagePayload ¶
func (MessagePayload) ABIEncode ¶
func (p MessagePayload) ABIEncode() walletstage1.PayloadDecoded
func (MessagePayload) Digest ¶
func (p MessagePayload) Digest() core.PayloadDigest
type NoChainIDSignature ¶
type NoChainIDSignature struct {
*Signature
}
func (*NoChainIDSignature) Checkpoint ¶
func (s *NoChainIDSignature) Checkpoint() uint64
func (*NoChainIDSignature) Data ¶
func (s *NoChainIDSignature) Data() ([]byte, error)
func (*NoChainIDSignature) Join ¶
func (s *NoChainIDSignature) Join(payload core.Payload, other core.Signature[*WalletConfig]) (core.Signature[*WalletConfig], error)
func (*NoChainIDSignature) Recover ¶
func (s *NoChainIDSignature) Recover(ctx context.Context, payload core.Payload, provider *ethrpc.Provider, signerSignatures ...core.SignerSignatures) (*WalletConfig, *big.Int, error)
func (*NoChainIDSignature) Reduce ¶
func (s *NoChainIDSignature) Reduce(payload core.Payload) core.Signature[*WalletConfig]
func (*NoChainIDSignature) String ¶
func (s *NoChainIDSignature) String() string
func (*NoChainIDSignature) Threshold ¶
func (s *NoChainIDSignature) Threshold() uint16
type ParameterOperation ¶
type ParameterOperation uint8
ParameterOperation represents the comparison operation for a parameter rule.
const ( EQUAL ParameterOperation = iota NOT_EQUAL GREATER_THAN_OR_EQUAL LESS_THAN_OR_EQUAL )
type ParameterRule ¶
type ParameterRule struct { Cumulative bool `json:"cumulative"` Operation ParameterOperation `json:"operation"` Value []byte `json:"value"` Offset *big.Int `json:"offset"` Mask []byte `json:"mask"` }
ParameterRule defines one rule for comparing a parameter.
func (*ParameterRule) MarshalJSON ¶
func (r *ParameterRule) MarshalJSON() ([]byte, error)
ParameterRuleToJSON converts a ParameterRule to a JSON string.
type PayloadCall ¶
type PayloadCall interface { // HashCall returns a []byte representing the call data to be hashed. HashCall() []byte }
--- PayloadCall interface ---
For hashing calls we assume a minimal interface.
type Permission ¶
type Permission struct { Target common.Address `json:"target"` Rules []ParameterRule `json:"rules"` }
Permission represents a permission with a target address and a set of parameter rules.
func (*Permission) MarshalJSON ¶
func (p *Permission) MarshalJSON() ([]byte, error)
PermissionToJSON converts a Permission to its JSON string representation.
type RegularSignature ¶
type RegularSignature struct {
*Signature
}
func (*RegularSignature) Checkpoint ¶
func (s *RegularSignature) Checkpoint() uint64
func (*RegularSignature) Data ¶
func (s *RegularSignature) Data() ([]byte, error)
func (*RegularSignature) Join ¶
func (s *RegularSignature) Join(payload core.Payload, other core.Signature[*WalletConfig]) (core.Signature[*WalletConfig], error)
func (*RegularSignature) Recover ¶
func (s *RegularSignature) Recover(ctx context.Context, payload core.Payload, provider *ethrpc.Provider, signerSignatures ...core.SignerSignatures) (*WalletConfig, *big.Int, error)
func (*RegularSignature) Reduce ¶
func (s *RegularSignature) Reduce(payload core.Payload) core.Signature[*WalletConfig]
func (*RegularSignature) String ¶
func (s *RegularSignature) String() string
func (*RegularSignature) Threshold ¶
func (s *RegularSignature) Threshold() uint16
type SessionCallSignature ¶
type SessionCallSignature interface {
// contains filtered or unexported methods
}
SessionCallSignature is a union interface for both kinds.
type SessionPermissions ¶
type SessionPermissions struct { Signer common.Address `json:"signer"` ValueLimit *big.Int `json:"valueLimit"` Deadline *big.Int `json:"deadline"` Permissions []Permission `json:"permissions"` }
SessionPermissions groups a signer with its associated permissions.
func DecodeSessionPermissions ¶
func DecodeSessionPermissions(b []byte) (SessionPermissions, error)
DecodeSessionPermissions decodes a byte slice into a SessionPermissions structure.
func GetSessionPermissions ¶
func GetSessionPermissions(topology SessionsTopology, addr common.Address) *SessionPermissions
getSessionPermissions searches for an explicit session permission leaf with the given signer.
func (*SessionPermissions) MarshalJSON ¶
func (sp *SessionPermissions) MarshalJSON() ([]byte, error)
SessionPermissionsToJSON converts SessionPermissions to its JSON string representation.
func (*SessionPermissions) UnmarshalJSON ¶
func (sp *SessionPermissions) UnmarshalJSON(data []byte) error
SessionPermissionsFromJSON parses a JSON string into a SessionPermissions struct.
type SessionPermissionsLeaf ¶
type SessionPermissionsLeaf struct { SessionPermissions Type string `json:"type"` // must be "session-permissions" }
SessionPermissionsLeaf embeds SessionPermissions and adds a type field.
type SessionsTopology ¶
type SessionsTopology struct { Branch []SessionsTopology // non-nil if this is a branch Leaf interface{} // one of *ImplicitBlacklistLeaf, *IdentitySignerLeaf, *SessionPermissionsLeaf; non-nil if leaf Node []byte // non-nil if a node (hashed value) }
SessionsTopology is a union type that can be either a branch (slice), a leaf, or a node (hash bytes).
func AddExplicitSession ¶
func AddExplicitSession(topology SessionsTopology, sp SessionPermissions) (SessionsTopology, error)
addExplicitSession adds a new session-permissions leaf. If a session for the given signer already exists, it returns an error. Otherwise it merges the new leaf into the topology and then balances it.
func AddToImplicitBlacklist ¶
func AddToImplicitBlacklist(topology SessionsTopology, addr common.Address) (SessionsTopology, error)
addToImplicitBlacklist adds an address to the blacklist in the implicit-blacklist leaf.
func EmptySessionsTopology ¶
func EmptySessionsTopology(identitySigner common.Address) SessionsTopology
EmptySessionsTopology generates an empty topology given the identity signer.
func MergeSessionsTopologies ¶
func MergeSessionsTopologies(a, b SessionsTopology) SessionsTopology
MergeSessionsTopologies merges two topologies into a branch.
func MinimiseSessionsTopology ¶
func MinimiseSessionsTopology(topology SessionsTopology, explicitSigners []common.Address, implicitSigners []common.Address) (SessionsTopology, error)
minimiseSessionsTopology rolls up unused signers into a hashed node. If a session-permissions leaf is for a signer in explicitSigners, it is not rolled up.
func RemoveExplicitSession ¶
func RemoveExplicitSession(topology SessionsTopology, signerAddr string) (SessionsTopology, error)
removeExplicitSession removes any explicit session-permissions leaf that has a signer matching the given address. If the removal causes a branch to become empty, it returns nil; if exactly one child remains, it collapses it.
func RemoveFromImplicitBlacklist ¶
func RemoveFromImplicitBlacklist(topology SessionsTopology, addr common.Address) (SessionsTopology, error)
removeFromImplicitBlacklist removes an address from the implicit blacklist.
func SessionsTopologyFromJSON ¶
func SessionsTopologyFromJSON(data string) (SessionsTopology, error)
sessionsTopologyFromJSON parses the JSON string into a SessionsTopology.
func (SessionsTopology) MarshalJSON ¶
func (st SessionsTopology) MarshalJSON() ([]byte, error)
MarshalJSON implements custom marshaling.
func (*SessionsTopology) UnmarshalJSON ¶
func (st *SessionsTopology) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom unmarshaling. It accepts three JSON forms:
- A JSON array → branch
- A JSON string starting with "0x" → node
- A JSON object that must include a "type" field → leaf
type Tree ¶
type Tree = core.ImageHashable
func SessionsTopologyToGenericTree ¶
func SessionsTopologyToGenericTree(topology SessionsTopology) (Tree, error)
type WalletConfig ¶
type WalletConfig struct { Threshold_ uint16 `json:"threshold" toml:"threshold"` // WARNING: contract code is uint64 Checkpoint_ uint64 `json:"checkpoint" toml:"checkpoint"` Tree WalletConfigTree `json:"tree" toml:"tree"` Checkpointer common.Address `json:"checkpointer,omitempty" toml:"checkpointer,omitempty"` }
func (*WalletConfig) BuildNoChainIDSignature ¶
func (c *WalletConfig) BuildNoChainIDSignature(ctx context.Context, sign core.SigningFunction, validateSigningPower bool, checkpointerData ...[]byte) (core.Signature[*WalletConfig], error)
func (*WalletConfig) BuildRegularSignature ¶
func (c *WalletConfig) BuildRegularSignature(ctx context.Context, sign core.SigningFunction, validateSigningPower bool, checkpointerData ...[]byte) (core.Signature[*WalletConfig], error)
func (*WalletConfig) BuildSubdigestSignature ¶
func (c *WalletConfig) BuildSubdigestSignature(noChainID bool) (core.Signature[*WalletConfig], error)
func (*WalletConfig) Checkpoint ¶
func (c *WalletConfig) Checkpoint() uint64
func (*WalletConfig) ImageHash ¶
func (c *WalletConfig) ImageHash() core.ImageHash
func (*WalletConfig) IsComplete ¶
func (c *WalletConfig) IsComplete() bool
func (*WalletConfig) IsUsable ¶
func (c *WalletConfig) IsUsable() error
func (*WalletConfig) SignersWeight ¶
func (c *WalletConfig) SignersWeight(signers []common.Address) uint16
func (*WalletConfig) Threshold ¶
func (c *WalletConfig) Threshold() uint16
type WalletConfigTree ¶
type WalletConfigTree interface { core.ImageHashable // contains filtered or unexported methods }
func DecodeWalletConfigTree ¶
func DecodeWalletConfigTree(object any) (WalletConfigTree, error)
func WalletConfigTreeNodes ¶
func WalletConfigTreeNodes(nodes ...WalletConfigTree) WalletConfigTree
type WalletConfigTreeAddressLeaf ¶
type WalletConfigTreeAddressLeaf struct { Weight uint8 `json:"weight" toml:"weight"` Address common.Address `json:"address" toml:"address"` }
func (*WalletConfigTreeAddressLeaf) ImageHash ¶
func (l *WalletConfigTreeAddressLeaf) ImageHash() core.ImageHash
type WalletConfigTreeAnyAddressSubdigestLeaf ¶
type WalletConfigTreeAnyAddressSubdigestLeaf struct {
Digest common.Hash `json:"digest" toml:"digest"`
}
func (WalletConfigTreeAnyAddressSubdigestLeaf) ImageHash ¶
func (l WalletConfigTreeAnyAddressSubdigestLeaf) ImageHash() core.ImageHash
type WalletConfigTreeNestedLeaf ¶
type WalletConfigTreeNestedLeaf struct { Weight uint8 `json:"weight" toml:"weight"` Threshold uint16 `json:"threshold" toml:"threshold"` Tree WalletConfigTree `json:"tree" toml:"tree"` }
func (*WalletConfigTreeNestedLeaf) ImageHash ¶
func (l *WalletConfigTreeNestedLeaf) ImageHash() core.ImageHash
type WalletConfigTreeNode ¶
type WalletConfigTreeNode struct { Left WalletConfigTree `json:"left" toml:"left"` Right WalletConfigTree `json:"right" toml:"right"` }
func (*WalletConfigTreeNode) ImageHash ¶
func (n *WalletConfigTreeNode) ImageHash() core.ImageHash
type WalletConfigTreeNodeLeaf ¶
func (WalletConfigTreeNodeLeaf) ImageHash ¶
func (l WalletConfigTreeNodeLeaf) ImageHash() core.ImageHash
type WalletConfigTreeSapientSignerLeaf ¶
type WalletConfigTreeSapientSignerLeaf struct { Weight uint8 `json:"weight" toml:"weight"` Address common.Address `json:"address" toml:"address"` ImageHash_ core.ImageHash `json:"imageHash" toml:"imageHash"` }
func (*WalletConfigTreeSapientSignerLeaf) ImageHash ¶
func (l *WalletConfigTreeSapientSignerLeaf) ImageHash() core.ImageHash
type WalletConfigTreeSubdigestLeaf ¶
type WalletConfigTreeSubdigestLeaf struct {
Subdigest common.Hash `json:"subdigest" toml:"subdigest"`
}
func (WalletConfigTreeSubdigestLeaf) ImageHash ¶
func (l WalletConfigTreeSubdigestLeaf) ImageHash() core.ImageHash