Documentation
¶
Overview ¶
Package aleo_utils implements Aleo-compatible Schnorr signing.
Index ¶
Constants ¶
View Source
const ( PRIVATE_KEY_SIZE = 59 ADDRESS_SIZE = 63 SIGNATURE_SIZE = 216 MESSAGE_FORMAT_BLOCK_SIZE = 16 * 32 MAX_FORMAT_MESSAGE_CHUNKS = 32 )
Variables ¶
View Source
var ErrNoModule = errors.New("session module is closed")
View Source
var ErrNoRuntime = errors.New("no runtime, create new wrapper")
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session interface {
// NewPrivateKey returns a newly generated private key as a byte slice and the
// corresponding address. The caller is responsible for zeroizing the returned
// slice when it is no longer needed (see ZeroizePrivateKey).
NewPrivateKey() (key []byte, address string, err error)
FormatMessage(message []byte, targetChunks int) (formattedMessage []byte, err error)
RecoverMessage(formattedMessage []byte) (message []byte, err error)
HashMessageToString(message []byte) (hash string, err error)
HashMessage(message []byte) (hash []byte, err error)
// Sign creates an Aleo-compatible Schnorr signature. The private key is not
// copied as a string and is wiped from WASM memory immediately after use.
Sign(key []byte, message []byte) (signature string, err error)
Close()
}
Provides access to wrapper functionality. A session is not goroutine safe so you need to create a new one for every goroutine
type Wrapper ¶
Wrapper is an interface for Aleo Wrapper session manager. Create an instance of a Wrapper using NewWrapper, then create a new Session to use the signing functionality.
func NewWrapper ¶
NewWrapper creates Leo contract compatible Schnorr wrapper manager. The second argument is a cleanup function, which destroys wrapper runtime. aleoWrapper cannot be used after the cleanup function is called, and must be recreated using this function.
Click to show internal directories.
Click to hide internal directories.