Module iota::intent
Module defining the Intent type used for domain-separated signing.
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:
scope— what the type of the message isversion— the intent versionapp_id— 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.
- Struct
Intent - Function
new - Function
scope - Function
version - Function
app_id - Function
scope_transaction_data - Function
scope_transaction_effects - Function
scope_checkpoint_summary - Function
scope_personal_message - Function
scope_sender_signed_transaction - Function
scope_proof_of_possession - Function
scope_bridge_event_deprecated - Function
scope_consensus_block - Function
scope_discovery_peers - Function
scope_authority_capabilities - Function
version_v0 - Function
app_id_iota - Function
app_id_consensus - Function
iota_transaction - Function
iota_personal_message - Function
to_bytes
Struct Intent
A signing intent used for domain separation.
public struct Intent has copy, drop, store
Function new
Create a new Intent with the given scope, version, and app id.
public fun new(scope: u8, version: u8, app_id: u8): iota::intent::Intent
Implementation
Function scope
Returns the scope byte of the intent.
public fun scope(self: &iota::intent::Intent): u8
Function version
Returns the version byte of the intent.
public fun version(self: &iota::intent::Intent): u8
Function app_id
Returns the app id byte of the intent.
public fun app_id(self: &iota::intent::Intent): u8
Function scope_transaction_data
Used for a user signature on transaction data.
public fun scope_transaction_data(): u8
Implementation
public fun scope_transaction_data(): u8 { 0 }
Function scope_transaction_effects
Used for an authority signature on transaction effects.
public fun scope_transaction_effects(): u8
Implementation
public fun scope_transaction_effects(): u8 { 1 }
Function scope_checkpoint_summary
Used for an authority signature on a checkpoint summary.
public fun scope_checkpoint_summary(): u8
Implementation
public fun scope_checkpoint_summary(): u8 { 2 }
Function scope_personal_message
Used for a user signature on a personal message.
public fun scope_personal_message(): u8
Implementation
public fun scope_personal_message(): u8 { 3 }
Function scope_sender_signed_transaction
Used for an authority signature on a user signed transaction.
public fun scope_sender_signed_transaction(): u8
Implementation
public fun scope_sender_signed_transaction(): u8 { 4 }
Function scope_proof_of_possession
Used as a signature representing an authority's proof of possession of its authority key.
public fun scope_proof_of_possession(): u8
Implementation
public fun scope_proof_of_possession(): u8 { 5 }
Function scope_bridge_event_deprecated
Deprecated. Should not be reused.
public fun scope_bridge_event_deprecated(): u8
Implementation
public fun scope_bridge_event_deprecated(): u8 { 6 }
Function scope_consensus_block
Used for consensus authority signature on block's digest.
public fun scope_consensus_block(): u8
Implementation
public fun scope_consensus_block(): u8 { 7 }
Function scope_discovery_peers
Used for reporting peer addresses in discovery.
public fun scope_discovery_peers(): u8
Implementation
public fun scope_discovery_peers(): u8 { 8 }
Function scope_authority_capabilities
Used for authority capabilities from non-committee authorities.
public fun scope_authority_capabilities(): u8
Implementation
public fun scope_authority_capabilities(): u8 { 9 }
Function version_v0
Intent version 0.
public fun version_v0(): u8
Implementation
public fun version_v0(): u8 { 0 }
Function app_id_iota
The IOTA application.
public fun app_id_iota(): u8
Implementation
public fun app_id_iota(): u8 { 0 }
Function app_id_consensus
The Consensus application.
public fun app_id_consensus(): u8
Implementation
public fun app_id_consensus(): u8 { 1 }
Function iota_transaction
Returns the standard IOTA transaction intent (scope=0, version=0, app_id=0).
public fun iota_transaction(): iota::intent::Intent
Implementation
public fun iota_transaction(): Intent {
Intent { scope: scope_transaction_data(), version: version_v0(), app_id: app_id_iota() }
}
Function iota_personal_message
Returns the standard IOTA personal message intent (scope=3, version=0, app_id=0).
public fun iota_personal_message(): iota::intent::Intent
Implementation
public fun iota_personal_message(): Intent {
Intent { scope: scope_personal_message(), version: version_v0(), app_id: app_id_iota() }
}
Function to_bytes
Returns the intent bytes as a 3-byte vector.
public fun to_bytes(self: &iota::intent::Intent): vector<u8>