Skip to content

threefold.models_to_move.flow #

fn Flow.new #

fn Flow.new(flow_uuid string) Flow

new creates a new Flow The flow_uuid should be a UUID string The ID is managed by the database

fn FlowStep.new #

fn FlowStep.new(step_order u32) FlowStep

new creates a new flow step

fn SignatureRequirement.new #

fn SignatureRequirement.new(flow_step_id u32, public_key string, message string) SignatureRequirement

new creates a new signature requirement

struct Flow #

@[heap]
struct Flow {
pub mut:
	id         u32        // Unique flow ID
	flow_uuid  string     // A unique UUID for the flow, for external reference
	name       string     // Name of the flow
	status     string     // Current status of the flow (e.g., "Pending", "InProgress", "Completed", "Failed")
	steps      []FlowStep // Steps involved in this flow
	created_at u64        // Creation timestamp
	updated_at u64        // Last update timestamp
}

Flow represents a signing flow

fn (Flow) name #

fn (mut f Flow) name(name string) Flow

name sets the name of the flow (builder pattern)

fn (Flow) status #

fn (mut f Flow) status(status string) Flow

status sets the status of the flow (builder pattern)

fn (Flow) add_step #

fn (mut f Flow) add_step(step FlowStep) Flow

add_step adds a step to the flow (builder pattern)

fn (Flow) get_step_by_order #

fn (f Flow) get_step_by_order(order u32) ?FlowStep

get_step_by_order gets a step by its order number

fn (Flow) get_pending_steps #

fn (f Flow) get_pending_steps() []FlowStep

get_pending_steps returns all steps with "Pending" status

fn (Flow) get_completed_steps #

fn (f Flow) get_completed_steps() []FlowStep

get_completed_steps returns all steps with "Completed" status

fn (Flow) is_completed #

fn (f Flow) is_completed() bool

is_completed returns true if all steps are completed

fn (Flow) get_next_step #

fn (f Flow) get_next_step() ?FlowStep

get_next_step returns the next step that needs to be processed

struct FlowStep #

@[heap]
struct FlowStep {
pub mut:
	id          u32     // Unique step ID
	description ?string // Optional description for the step
	step_order  u32     // Order of this step within the flow
	status      string  // Current status of the flow step (e.g., "Pending", "InProgress", "Completed", "Failed")
	created_at  u64     // Creation timestamp
	updated_at  u64     // Last update timestamp
}

FlowStep represents a step within a signing flow

fn (FlowStep) description #

fn (mut fs FlowStep) description(description string) FlowStep

description sets the description for the flow step (builder pattern)

fn (FlowStep) status #

fn (mut fs FlowStep) status(status string) FlowStep

status sets the status for the flow step (builder pattern)

fn (FlowStep) is_pending #

fn (fs FlowStep) is_pending() bool

is_pending returns true if the step is pending

fn (FlowStep) is_in_progress #

fn (fs FlowStep) is_in_progress() bool

is_in_progress returns true if the step is in progress

fn (FlowStep) is_completed #

fn (fs FlowStep) is_completed() bool

is_completed returns true if the step is completed

fn (FlowStep) is_failed #

fn (fs FlowStep) is_failed() bool

is_failed returns true if the step has failed

fn (FlowStep) start #

fn (mut fs FlowStep) start()

start marks the step as in progress

fn (FlowStep) complete #

fn (mut fs FlowStep) complete()

complete marks the step as completed

fn (FlowStep) fail #

fn (mut fs FlowStep) fail()

fail marks the step as failed

fn (FlowStep) reset #

fn (mut fs FlowStep) reset()

reset resets the step to pending status

struct SignatureRequirement #

@[heap]
struct SignatureRequirement {
pub mut:
	id           u32     // Unique signature requirement ID
	flow_step_id u32     // Foreign key to the FlowStep this requirement belongs to
	public_key   string  // The public key required to sign the message
	message      string  // The plaintext message to be signed
	signed_by    ?string // The public key of the entity that signed the message, if signed
	signature    ?string // The signature, if signed
	status       string  // Current status of the signature requirement (e.g., "Pending", "SentToClient", "Signed", "Failed", "Error")
	created_at   u64     // Creation timestamp
	updated_at   u64     // Last update timestamp
}

SignatureRequirement represents a signature requirement for a flow step

fn (SignatureRequirement) signed_by #

fn (mut sr SignatureRequirement) signed_by(signed_by string) SignatureRequirement

signed_by sets the public key of the signer (builder pattern)

fn (SignatureRequirement) signature #

fn (mut sr SignatureRequirement) signature(signature string) SignatureRequirement

signature sets the signature (builder pattern)

fn (SignatureRequirement) status #

fn (mut sr SignatureRequirement) status(status string) SignatureRequirement

status sets the status (builder pattern)

fn (SignatureRequirement) is_pending #

fn (sr SignatureRequirement) is_pending() bool

is_pending returns true if the signature requirement is pending

fn (SignatureRequirement) is_sent_to_client #

fn (sr SignatureRequirement) is_sent_to_client() bool

is_sent_to_client returns true if the signature requirement has been sent to client

fn (SignatureRequirement) is_signed #

fn (sr SignatureRequirement) is_signed() bool

is_signed returns true if the signature requirement has been signed

fn (SignatureRequirement) is_failed #

fn (sr SignatureRequirement) is_failed() bool

is_failed returns true if the signature requirement has failed

fn (SignatureRequirement) has_error #

fn (sr SignatureRequirement) has_error() bool

has_error returns true if the signature requirement has an error

fn (SignatureRequirement) send_to_client #

fn (mut sr SignatureRequirement) send_to_client()

send_to_client marks the requirement as sent to client

fn (SignatureRequirement) sign #

fn (mut sr SignatureRequirement) sign(signed_by string, signature string)

sign completes the signature requirement with signature data

fn (SignatureRequirement) fail #

fn (mut sr SignatureRequirement) fail()

fail marks the signature requirement as failed

fn (SignatureRequirement) error #

fn (mut sr SignatureRequirement) error()

error marks the signature requirement as having an error

fn (SignatureRequirement) reset #

fn (mut sr SignatureRequirement) reset()

reset resets the signature requirement to pending status

fn (SignatureRequirement) validate_signature #

fn (sr SignatureRequirement) validate_signature() bool

validate_signature validates that the signature matches the expected public key

Todo: implement actual cryptographic validation