Documentation ¶
Overview ¶
Package base91 implements base91 encoding, fork from https://github.com/mtraver/base91
Index ¶
- Constants
- func AESDecrypt(secret, b []byte) []byte
- func AESEncrypt(secret, b []byte, sid string) []byte
- func Base91Decode(src string) ([]byte, error)
- func Base91Encode(src []byte) string
- func CheckTestEnvironment(ctx context.Context) bool
- func CheckUnique(args ...any) bool
- func CreateTransactionRequestUntilSufficient(ctx context.Context, client *mixin.Client, id, raw string) (*mixin.SafeTransactionRequest, error)
- func DecodeHexOrPanic(s string) []byte
- func ECDHEd25519(priv, pub string) [32]byte
- func EnableTestEnvironment(ctx context.Context) context.Context
- func ExpandTilde(path string) string
- func ExtraLimit(tx mixinnet.Transaction) int
- func Fingerprint(public string) []byte
- func HandleCORS(handler http.Handler) http.Handler
- func HandleNotFound(w http.ResponseWriter, r *http.Request)
- func HandlePanic(w http.ResponseWriter, r *http.Request, rcv any)
- func MarshalJSONOrPanic(v any) []byte
- func MarshalPanic(m encoding.BinaryMarshaler) []byte
- func NormalizeCurve(crv uint8) uint8
- func OpenSQLite3ReadOnlyStore(path string) (*sql.DB, error)
- func OpenSQLite3Store(path, schema string) (*sql.DB, error)
- func ReadUsers(ctx context.Context, client *mixin.Client, ids []string) ([]*mixin.User, error)
- func RenderError(w http.ResponseWriter, r *http.Request, err error)
- func RenderJSON(w http.ResponseWriter, r *http.Request, status int, data any)
- func SafeAssetBalance(ctx context.Context, client *mixin.Client, members []string, threshold int, ...) (*common.Integer, error)
- func SafeAssetIdChain(chainId string) byte
- func SafeAssetIdChainNoPanic(chainId string) byte
- func SafeChainAssetId(chain byte) string
- func SafeChainCurve(chain byte) byte
- func SafeCurveChain(crv byte) byte
- func SafeReadMultisigRequestUntilSufficient(ctx context.Context, client *mixin.Client, id string) (*mixin.SafeMultisigRequest, error)
- func SafeReadTransactionRequestUntilSufficient(ctx context.Context, client *mixin.Client, id string) (*mixin.SafeTransactionRequest, error)
- func SendTransactionUntilSufficient(ctx context.Context, client *mixin.Client, members []string, threshold int, ...) (*mixin.SafeTransactionRequest, error)
- func SignMultisigUntilSufficient(ctx context.Context, client *mixin.Client, requestId, raw string, ...) (*mixin.SafeMultisigRequest, error)
- func SignTransactionUntilSufficient(ctx context.Context, client *mixin.Client, requestId, raw string, ...) (*mixin.SafeTransactionRequest, error)
- func StateName(state int) string
- func UniqueId(a, b string) string
- func VerifyKernelTransaction(ctx context.Context, reader KernelTransactionReader, out *mtg.Action, ...) (*common.VersionedTransaction, error)
- func WriteStorageUntilSufficient(ctx context.Context, client *mixin.Client, extra []byte, sTraceId string, ...) (crypto.Hash, error)
- type AccountProposal
- type Encoding
- type KernelTransactionReader
- type Operation
- type Request
Constants ¶
const ( SafeChainBitcoin = bitcoin.ChainBitcoin SafeChainLitecoin = bitcoin.ChainLitecoin SafeChainEthereum = ethereum.ChainEthereum SafeChainPolygon = ethereum.ChainPolygon SafeBitcoinChainId = "c6d0c728-2624-429b-8e0d-d9d19b6592fa" SafeEthereumChainId = "43d61dcd-e413-450d-80b8-101d5e903357" SafeLitecoinChainId = "76c802a2-7c88-447f-a93e-c29c9e5dd9c8" SafePolygonChainId = "b7938396-3f94-4e0a-9179-d3440718156f" )
const ( OperationTypeWrapper = 0 OperationTypeKeygenInput = 1 OperationTypeSignInput = 2 OperationTypeKeygenOutput = 11 OperationTypeSignOutput = 12 CurveSecp256k1ECDSABitcoin = 1 CurveSecp256k1ECDSAEthereum = 2 CurveSecp256k1SchnorrBitcoin = 3 CurveEdwards25519Default = 4 CurveEdwards25519Mixin = 5 CurveSecp256k1ECDSALitecoin = 100 + CurveSecp256k1ECDSABitcoin CurveSecp256k1ECDSABitcoinCash = 110 + CurveSecp256k1ECDSABitcoin CurveSecp256k1ECDSAMVM = 100 + CurveSecp256k1ECDSAEthereum CurveSecp256k1ECDSAPolygon = 110 + CurveSecp256k1ECDSAEthereum )
const ( RequestRoleHolder = 1 RequestRoleSigner = 2 RequestRoleObserver = 3 RequestFlagNone = 0 RequestFlagCustomObserverKey = 1 RequestStateInitial = 1 RequestStatePending = 2 RequestStateDone = 3 RequestStateFailed = 4 ActionMigrateSafeToken = 99 // Observer can terminate all signer and keeper nodes ActionTerminate = 100 ActionObserverAddKey = 101 ActionObserverRequestSignerKeys = 102 ActionObserverUpdateNetworkStatus = 103 ActionObserverHolderDeposit = 104 ActionObserverSetOperationParams = 106 // For all Bitcoin like chains ActionBitcoinSafeProposeAccount = 110 ActionBitcoinSafeApproveAccount = 111 ActionBitcoinSafeProposeTransaction = 112 ActionBitcoinSafeApproveTransaction = 113 ActionBitcoinSafeRevokeTransaction = 114 ActionBitcoinSafeCloseAccount = 115 // For Mixin Kernel mainnet ActionMixinSafeProposeAccount = 120 ActionMixinSafeApproveAccount = 121 ActionMixinSafeProposeTransaction = 122 ActionMixinSafeApproveTransaction = 123 ActionMixinSafeRevokeTransaction = 124 // For all Ethereum like chains ActionEthereumSafeProposeAccount = 130 ActionEthereumSafeApproveAccount = 131 ActionEthereumSafeProposeTransaction = 132 ActionEthereumSafeApproveTransaction = 133 ActionEthereumSafeRevokeTransaction = 134 ActionEthereumSafeCloseAccount = 135 ActionEthereumSafeRefundTransaction = 136 FlagProposeNormalTransaction = 0 FlagProposeRecoveryTransaction = 1 )
Variables ¶
This section is empty.
Functions ¶
func AESDecrypt ¶
func AESEncrypt ¶
func Base91Decode ¶
func Base91Encode ¶
func CheckTestEnvironment ¶
func CheckUnique ¶
func CreateTransactionRequestUntilSufficient ¶ added in v0.13.0
func DecodeHexOrPanic ¶
func ECDHEd25519 ¶
func ExpandTilde ¶ added in v0.9.6
func ExtraLimit ¶ added in v0.13.0
func ExtraLimit(tx mixinnet.Transaction) int
func Fingerprint ¶ added in v0.3.0
func HandleCORS ¶ added in v0.9.3
TODO may consider a whitelist in the case of Ethereum scams
func HandleNotFound ¶ added in v0.9.3
func HandleNotFound(w http.ResponseWriter, r *http.Request)
func HandlePanic ¶ added in v0.9.3
func HandlePanic(w http.ResponseWriter, r *http.Request, rcv any)
func MarshalJSONOrPanic ¶ added in v0.9.3
func MarshalPanic ¶
func MarshalPanic(m encoding.BinaryMarshaler) []byte
func NormalizeCurve ¶ added in v0.2.0
func RenderError ¶ added in v0.9.3
func RenderError(w http.ResponseWriter, r *http.Request, err error)
func RenderJSON ¶ added in v0.9.3
func SafeAssetBalance ¶ added in v0.13.0
func SafeAssetIdChain ¶ added in v0.13.0
func SafeAssetIdChainNoPanic ¶ added in v0.13.0
func SafeChainAssetId ¶ added in v0.13.0
func SafeChainCurve ¶ added in v0.13.0
func SafeCurveChain ¶ added in v0.13.0
func SafeReadMultisigRequestUntilSufficient ¶ added in v0.13.0
func SafeReadTransactionRequestUntilSufficient ¶ added in v0.13.0
func SignMultisigUntilSufficient ¶ added in v0.13.0
func SignTransactionUntilSufficient ¶ added in v0.13.0
func VerifyKernelTransaction ¶
func VerifyKernelTransaction(ctx context.Context, reader KernelTransactionReader, out *mtg.Action, timeout time.Duration) (*common.VersionedTransaction, error)
TODO the output should include the snapshot signature, then it can just be verified against the active kernel nodes public key
Types ¶
type AccountProposal ¶ added in v0.8.0
type Encoding ¶
type Encoding struct {
// contains filtered or unexported fields
}
An Encoding is a base 91 encoding/decoding scheme defined by a 91-character alphabet.
func (*Encoding) Decode ¶
Decode decodes src using the encoding enc. It writes at most DecodedLen(len(src)) bytes to dst and returns the number of bytes written. If src contains invalid base91 data, it will return the number of bytes successfully written and CorruptInputError.
func (*Encoding) DecodedLen ¶
DecodedLen returns the maximum length in bytes of the decoded data corresponding to n bytes of base91-encoded data.
func (*Encoding) Encode ¶
Encode encodes src using the encoding enc, writing bytes to dst. It returns the number of bytes written, because the exact output size cannot be known before encoding takes place. EncodedLen(len(src)) may be used to determine an upper bound on the output size when allocating a dst slice.
func (*Encoding) EncodedLen ¶
EncodedLen returns an upper bound on the length in bytes of the base91 encoding of an input buffer of length n. The true encoded length may be shorter.
type KernelTransactionReader ¶ added in v0.16.0
type Operation ¶
func DecodeOperation ¶
type Request ¶
type Request struct { Id string MixinHash crypto.Hash MixinIndex int AssetId string Amount decimal.Decimal Role uint8 Action uint8 Curve uint8 Holder string ExtraHEX string State uint8 CreatedAt time.Time Sequence uint64 Output *mtg.Action }