Skip to main content

Intent

type Intent

A Signing Intent

An intent is a compact struct that serves as the domain separator for a message that a signature commits to. It consists of three parts: 1. IntentScope (what the type of the message is) 2. IntentVersion 3. IntentAppId (what application the signature refers to).

The serialization of an Intent is a 3-byte array where each field is represented by a byte and it is prepended onto a message before it is signed in IOTA.

BCS

The BCS serialized form for this type is defined by the following ABNF:

```text intent = intent-scope intent-version intent-app-id ```

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

func IntentFromBytes

func IntentFromBytes(bytes []byte) (*Intent, error)

Create a signing intent from bytes.

func IntentFromHex

func IntentFromHex(hex string) (*Intent, error)

Create a signing intent from a hex string.

func IntentNewConsensusApp

func IntentNewConsensusApp(scope IntentScope) *Intent

Create a new Consensus app signing intent.

func IntentNewIotaApp

func IntentNewIotaApp(scope IntentScope) *Intent

Create a new IOTA app signing intent.

func IntentNewIotaTransaction

func IntentNewIotaTransaction() *Intent

Create a new IOTA transaction signing intent.

func IntentNewPersonalMessage

func IntentNewPersonalMessage() *Intent

Create a new IOTA personal message signing intent.

func LiftFromExternalIntent

func LiftFromExternalIntent(handle uint64) *Intent

func NewIntent

func NewIntent(scope IntentScope, version IntentVersion, appId IntentAppId) *Intent

Create a new signing intent.

func (*Intent) AppId

func (_self *Intent) AppId() IntentAppId

Get the app id of the signing intent.

func (*Intent) DebugString

func (_self *Intent) DebugString() string

func (*Intent) Destroy

func (object *Intent) Destroy()

func (*Intent) Eq

func (_self *Intent) Eq(other *Intent) bool

func (*Intent) Hash

func (_self *Intent) Hash() uint64

func (*Intent) Ne

func (_self *Intent) Ne(other *Intent) bool

func (*Intent) Scope

func (_self *Intent) Scope() IntentScope

Get the scope of the signing intent.

func (*Intent) ToBytes

func (_self *Intent) ToBytes() []byte

Convert the signing intent to bytes.

func (*Intent) Version

func (_self *Intent) Version() IntentVersion

Get the version of the signing intent.