Documentation
¶
Index ¶
- Variables
- func GenerateAppSessionIDV1(definition AppDefinitionV1) (string, error)
- func GenerateRebalanceBatchIDV1(sessionVersions []AppSessionVersionV1) (string, error)
- func GenerateRebalanceTransactionIDV1(batchID, sessionID, asset string) (string, error)
- func GenerateSessionKeyStateIDV1(userAddress, sessionKey string, version uint64) (string, error)
- func PackAppSessionKeyStateV1(state AppSessionKeyStateV1) ([]byte, error)
- func PackAppStateUpdateV1(stateUpdate AppStateUpdateV1) ([]byte, error)
- func PackAppV1(app AppV1) ([]byte, error)
- func PackCreateAppSessionRequestV1(definition AppDefinitionV1, sessionData string) ([]byte, error)
- type AppAllocationV1
- type AppDefinitionV1
- type AppInfoV1
- type AppParticipantV1
- type AppSessionInfoV1
- type AppSessionKeyStateV1
- type AppSessionKeyValidatorV1
- type AppSessionSignerTypeV1
- type AppSessionSignerV1
- type AppSessionStatus
- type AppSessionV1
- type AppSessionVersionV1
- type AppStateUpdateIntent
- type AppStateUpdateV1
- type AppV1
- type AssetAllowanceV1
- type GetAppSessionKeyOwnerFuncV1
- type SessionKeyV1
- type SignedAppStateUpdateV1
Constants ¶
This section is empty.
Variables ¶
var AppIDV1Regex = regexp.MustCompile(`^[a-z0-9][-a-z0-9]{0,65}$`)
Functions ¶
func GenerateAppSessionIDV1 ¶
func GenerateAppSessionIDV1(definition AppDefinitionV1) (string, error)
GenerateAppSessionIDV1 generates a deterministic app session ID from the definition using ABI encoding.
func GenerateRebalanceBatchIDV1 ¶
func GenerateRebalanceBatchIDV1(sessionVersions []AppSessionVersionV1) (string, error)
GenerateRebalanceBatchIDV1 creates a deterministic batch ID from session versions using ABI encoding. The batch ID is generated by hashing the list of (sessionID, version) pairs.
func GenerateRebalanceTransactionIDV1 ¶
GenerateRebalanceTransactionIDV1 creates a deterministic transaction ID for a rebalance transaction using ABI encoding.
func GenerateSessionKeyStateIDV1 ¶
GenerateSessionKeyStateIDV1 generates a deterministic ID from user_address, session_key, and version.
func PackAppSessionKeyStateV1 ¶
func PackAppSessionKeyStateV1(state AppSessionKeyStateV1) ([]byte, error)
PackAppSessionKeyStateV1 packs the session key state for signing using ABI encoding. This is used to generate a deterministic hash that the user signs when registering/updating a session key. The user_sig field is excluded from packing since it is the signature itself.
func PackAppStateUpdateV1 ¶
func PackAppStateUpdateV1(stateUpdate AppStateUpdateV1) ([]byte, error)
PackAppStateUpdateV1 packs the AppStateUpdate for signing using ABI encoding. This is used to generate a deterministic hash that participants sign when updating an app session state.
func PackCreateAppSessionRequestV1 ¶
func PackCreateAppSessionRequestV1(definition AppDefinitionV1, sessionData string) ([]byte, error)
PackCreateAppSessionRequestV1 packs the Definition and SessionData for signing using ABI encoding. This is used to generate a deterministic hash that participants sign when creating an app session.
Types ¶
type AppAllocationV1 ¶
AppAllocationV1 represents the allocation of assets to a participant in an app session.
type AppDefinitionV1 ¶
type AppDefinitionV1 struct {
ApplicationID string
Participants []AppParticipantV1
Quorum uint8
Nonce uint64
}
AppDefinitionV1 represents the definition for an app session.
type AppParticipantV1 ¶
AppParticipantV1 represents the definition for an app participant.
type AppSessionInfoV1 ¶
type AppSessionInfoV1 struct {
AppSessionID string
AppDefinition AppDefinitionV1
IsClosed bool
SessionData string
Version uint64
Allocations []AppAllocationV1
}
AppSessionInfoV1 represents information about an application session.
type AppSessionKeyStateV1 ¶
type AppSessionKeyStateV1 struct {
// ID Hash(user_address + session_key + version)
// UserAddress is the user wallet address
UserAddress string
// SessionKey is the session key address for delegation
SessionKey string
// Version is the version of the session key format
Version uint64
// ApplicationID is the application IDs associated with this session key
ApplicationIDs []string
// AppSessionID is the application session IDs associated with this session key
AppSessionIDs []string
// ExpiresAt is Unix timestamp in seconds indicating when the session key expires
ExpiresAt time.Time
// UserSig is the user's signature over the session key metadata to authorize the registration/update of the session key
UserSig string
}
AppSessionKeyStateV1 represents the state of a session key.
type AppSessionKeyValidatorV1 ¶
type AppSessionKeyValidatorV1 struct {
// contains filtered or unexported fields
}
func NewAppSessionKeySigValidatorV1 ¶
func NewAppSessionKeySigValidatorV1(ownerGetter GetAppSessionKeyOwnerFuncV1) *AppSessionKeyValidatorV1
type AppSessionSignerTypeV1 ¶
type AppSessionSignerTypeV1 uint8
const ( AppSessionSignerTypeV1_Wallet AppSessionSignerTypeV1 = 0xA1 AppSessionSignerTypeV1_SessionKey AppSessionSignerTypeV1 = 0xA2 )
func (AppSessionSignerTypeV1) String ¶
func (t AppSessionSignerTypeV1) String() string
type AppSessionSignerV1 ¶
func NewAppSessionKeySignerV1 ¶
func NewAppSessionKeySignerV1(signer sign.Signer) (*AppSessionSignerV1, error)
func NewAppSessionWalletSignerV1 ¶
func NewAppSessionWalletSignerV1(signer sign.Signer) (*AppSessionSignerV1, error)
type AppSessionStatus ¶
type AppSessionStatus uint8
const ( AppSessionStatusVoid AppSessionStatus = iota AppSessionStatusOpen AppSessionStatusClosed )
func (*AppSessionStatus) Scan ¶
func (s *AppSessionStatus) Scan(src any) error
func (AppSessionStatus) String ¶
func (status AppSessionStatus) String() string
type AppSessionV1 ¶
type AppSessionV1 struct {
SessionID string
ApplicationID string
Participants []AppParticipantV1
Quorum uint8
Nonce uint64
Status AppSessionStatus
Version uint64
SessionData string
CreatedAt time.Time
UpdatedAt time.Time
}
AppSessionV1 represents an application session in the V1 API.
type AppSessionVersionV1 ¶
AppSessionVersionV1 represents a session ID and version pair for rebalancing operations.
type AppStateUpdateIntent ¶
type AppStateUpdateIntent uint8
const ( AppStateUpdateIntentOperate AppStateUpdateIntent = iota AppStateUpdateIntentDeposit AppStateUpdateIntentWithdraw AppStateUpdateIntentClose AppStateUpdateIntentRebalance )
func (AppStateUpdateIntent) GatedAction ¶
func (intent AppStateUpdateIntent) GatedAction() core.GatedAction
func (AppStateUpdateIntent) String ¶
func (intent AppStateUpdateIntent) String() string
type AppStateUpdateV1 ¶
type AppStateUpdateV1 struct {
AppSessionID string
Intent AppStateUpdateIntent
Version uint64
Allocations []AppAllocationV1
SessionData string
}
AppStateUpdateV1 represents the current state of an application session.
type AppV1 ¶
type AppV1 struct {
ID string
OwnerWallet string
Metadata string
Version uint64
CreationApprovalNotRequired bool
}
AppV1 represents an application registry entry.
type AssetAllowanceV1 ¶
AssetAllowanceV1 represents an asset allowance with usage tracking.
type SessionKeyV1 ¶
type SessionKeyV1 struct {
ID uint
SessionKey string
Application string
Allowances []AssetAllowanceV1
Scope *string
ExpiresAt time.Time
CreatedAt time.Time
}
SessionKeyV1 represents a session key with spending allowances.
type SignedAppStateUpdateV1 ¶
type SignedAppStateUpdateV1 struct {
AppStateUpdate AppStateUpdateV1
QuorumSigs []string
}
SignedAppStateUpdateV1 represents a signed application session state update.