📋

Loan Application Workflow

Multi-step approval workflows with cryptographic signing at each stage. Automated routing based on loan amount, applicant criteria, and risk assessment.

The Challenge

Financial institutions process loan applications through multiple stages:

  • Initial application submission and validation
  • Credit check and risk assessment
  • Multi-level approval based on loan amount
  • Document collection and verification
  • Final approval and disbursement
  • Audit trail for regulatory compliance

The Sorcha Solution

Automated loan application workflow with:

  • Cryptographic signing at each workflow stage
  • JSON Logic-based routing for approval levels
  • Immutable audit trail in distributed ledger
  • Real-time status notifications via SignalR
  • Selective data disclosure to different participants

Blueprint Example: Loan Application Processing

var loanWorkflow = Blueprint.Create("LoanApplicationWorkflow")
    // Receive loan application
    .AddSource<LoanApplication>(config => config
        .FromQueue("loan-applications")
        .WithDeduplication())

    // Validate application data
    .Validate<LoanApplication>(validation => validation
        .AgainstSchema("loan-application-schema-v1")
        .CheckRequiredDocuments()
        .ValidateApplicantInfo())

    // Sign initial submission
    .Sign(signature => signature
        .WithAlgorithm(CryptoAlgorithm.ED25519)
        .UsingKey("loan-processor-key")
        .IncludeTimestamp())

    // Credit check and risk assessment
    .Transform<LoanApplication, AssessedLoan>(loan =>
        loan
            .PerformCreditCheck()
            .CalculateRiskScore()
            .DetermineEligibility())

    // Dynamic routing based on loan amount using JSON Logic
    .Route(routing => routing
        .When(loan => loan.Amount < 10000)
            .ToDestination("auto-approval-queue")
        .When(loan => loan.Amount >= 10000 && loan.Amount < 50000)
            .ToDestination("manager-approval-queue")
        .When(loan => loan.Amount >= 50000)
            .ToDestination("director-approval-queue")
        .Otherwise()
            .ToDestination("manual-review-queue"))

    // Record in distributed ledger
    .Audit(audit => audit
        .CreateLedgerEntry()
        .WithDIDReference()
        .StoreInRegisterService()
        .EnableODataQuery())

    // Notify stakeholders via SignalR
    .Publish(notification => notification
        .ToApplicant("application-status-update")
        .ToProcessor("new-application-assigned")
        .ToCompliance("application-submitted"))

    .Build();

Business Benefits

Automated Routing: JSON Logic ensures applications go to the right approver instantly
Full Transparency: Every stage cryptographically signed and recorded
Real-Time Updates: SignalR notifications keep all parties informed
Compliance Ready: Complete audit trail with DID URIs for regulatory requirements
💰

Expense Approval Workflow

Dynamic routing with JSON Logic evaluation based on expense amounts. Automatic escalation and multi-level approval workflows with real-time notifications.

The Challenge

Organizations need efficient expense approval processes that:

  • Route expenses to appropriate approvers based on amount
  • Support multi-level approval chains
  • Provide real-time status updates
  • Maintain audit trails for compliance
  • Handle policy exceptions and escalations

The Sorcha Solution

Intelligent expense approval with:

  • JSON Logic expressions for dynamic routing rules
  • Automatic escalation to higher approval levels
  • Real-time SignalR notifications to approvers
  • Cryptographic proof of approval actions
  • Policy enforcement with schema validation

Blueprint Example: Expense Approval with Dynamic Routing

var expenseWorkflow = Blueprint.Create("ExpenseApprovalWorkflow")
    // Receive expense submission
    .AddSource<ExpenseReport>(config => config
        .FromAPI("expense-submission-endpoint")
        .WithRealTimeProcessing())

    // Validate against expense policy
    .Validate<ExpenseReport>(validation => validation
        .AgainstSchema("expense-policy-schema")
        .CheckReceiptsAttached()
        .ValidateCategoryRules())

    // JSON Logic routing based on amount and department
    .Route(routing => routing
        // Small expenses: auto-approve
        .When(expense =>
            expense.Amount < 100)
            .ToDestination("auto-approve")

        // Medium expenses: manager approval
        .When(expense =>
            expense.Amount >= 100 && expense.Amount < 1000)
            .ToDestination("manager-approval")

        // Large expenses: director approval
        .When(expense =>
            expense.Amount >= 1000 && expense.Amount < 5000)
            .ToDestination("director-approval")

        // Very large: CFO approval required
        .When(expense =>
            expense.Amount >= 5000)
            .ToDestination("cfo-approval")

        // Policy violations: manual review
        .When(expense =>
            expense.HasPolicyViolation)
            .ToDestination("compliance-review"))

    // Sign approval decision
    .Sign(signature => signature
        .WithAlgorithm(CryptoAlgorithm.ED25519)
        .UsingApproverKey()
        .IncludeApprovalReason())

    // Store in distributed ledger
    .Audit(audit => audit
        .RecordApprovalChain()
        .WithTimestamp()
        .StoreInRegisterService())

    // Real-time notifications
    .Publish(notification => notification
        .ToSubmitter("expense-status-change")
        .ToApprover("new-expense-pending")
        .ToFinance("expense-approved"))

    .Build();

Business Benefits

Policy Enforcement: JSON Logic ensures expenses follow company policies automatically
Fast Processing: 1.16ms latency enables instant routing decisions
Real-Time Updates: SignalR keeps everyone informed of approval status
Audit Compliance: Every approval cryptographically signed and recorded
📦

Purchase Order Processing

End-to-end procurement workflows with vendor validation, approval chains, and cryptographic transaction records in a distributed ledger.

The Challenge

Purchase order processing involves complex workflows:

  • Vendor validation and approval
  • Multi-step approval based on purchase value
  • Budget verification and allocation
  • Goods receipt and invoice matching
  • Payment authorization and processing
  • Audit trail for financial compliance

The Sorcha Solution

Comprehensive purchase order workflow with:

  • Vendor verification with cryptographic validation
  • Budget checks using JSON Logic rules
  • Multi-party signature collection
  • Three-way matching (PO, goods receipt, invoice)
  • Immutable transaction records with DID URIs

Blueprint Example: Purchase Order Workflow

var purchaseOrderWorkflow = Blueprint.Create("PurchaseOrderProcessing")
    // Receive PO request
    .AddSource<PurchaseOrder>(config => config
        .FromProcurementSystem("po-requests")
        .WithValidation())

    // Validate vendor and budget
    .Validate<PurchaseOrder>(validation => validation
        .CheckApprovedVendor()
        .VerifyBudgetAvailability()
        .ValidateLineItems())

    // Multi-party signing
    .Sign(signature => signature
        .WithAlgorithm(CryptoAlgorithm.NISTP256)
        .RequireSignatures()
        .FromRequester()
        .FromManager()
        .FromProcurement())

    // Route based on value and category
    .Route(routing => routing
        .When(po => po.TotalValue < 5000)
            .ToDestination("auto-process")
        .When(po => po.TotalValue >= 5000 && po.TotalValue < 50000)
            .ToDestination("director-approval")
        .When(po => po.TotalValue >= 50000)
            .ToDestination("executive-approval")
        .When(po => po.IsInternational)
            .ToDestination("international-review"))

    // Store in distributed ledger with DID
    .Audit(audit => audit
        .CreatePORecord()
        .WithDIDURI()
        .EnableODataQueries()
        .ChainToPreviousTransaction())

    // Notify all stakeholders
    .Publish(notification => notification
        .ToRequester("po-status-update")
        .ToVendor("po-issued")
        .ToReceiving("po-goods-pending")
        .ToAccounts("po-payment-pending"))

    // Handle goods receipt
    .OnEvent("goods-received", receipt =>
        receipt
            .ValidateAgainstPO()
            .RecordInLedger()
            .TriggerInvoiceMatching())

    .Build();

Business Benefits

Fraud Prevention: Multi-party signatures and vendor validation prevent unauthorized purchases
Budget Control: Real-time budget verification ensures spending stays within limits
Process Efficiency: Automated routing and approvals reduce procurement cycle time
Audit Ready: Complete PO lifecycle recorded in distributed ledger with DID URIs
📊

Selective Data Disclosure Workflows

Control exactly which data participants can access using JSON Pointers (RFC 6901). Enable secure collaboration with cryptographic guarantees and fine-grained access control.

The Challenge

Sharing sensitive data requires precise control over:

  • Which fields each participant can access
  • Who can see personally identifiable information (PII)
  • Preventing unauthorized data exposure
  • Maintaining audit trails of data access
  • Supporting multi-party collaboration safely

The Sorcha Solution

Selective data disclosure using:

  • JSON Pointers (RFC 6901) for field-level access control
  • Cryptographic proof of data integrity
  • Role-based access policies
  • Immutable disclosure audit trail
  • Schema validation for disclosed data

Blueprint Example: Selective Survey Data Sharing

var dataDisclosureWorkflow = Blueprint.Create("SelectiveDataDisclosure")
    // Receive data disclosure request
    .AddSource<DisclosureRequest>(config => config
        .FromAPI("disclosure-requests")
        .WithAuthentication())

    // Validate requester permissions
    .Validate<DisclosureRequest>(validation => validation
        .CheckRequesterAuthorization()
        .ValidateAccessPolicy()
        .VerifyDataOwnerConsent())

    // Apply JSON Pointers for selective disclosure
    .Transform<DisclosureRequest, FilteredData>(request =>
        request
            // Allow researcher to see aggregate data only
            .When(role => role == "Researcher")
                .DiscloseFields("/surveyId", "/aggregateResults")

            // Allow data steward to see identifiers but not PII
            .When(role => role == "DataSteward")
                .DiscloseFields("/surveyId", "/submissionDate", "/statusCode")

            // Allow principal investigator to see all non-PII fields
            .When(role => role == "PrincipalInvestigator")
                .DiscloseFields("/surveyId", "/responses", "/demographics")
                .ExcludeFields("/personalInfo/name", "/personalInfo/email")

            // Data owner sees everything
            .When(role => role == "DataOwner")
                .DiscloseAll())

    // Sign disclosed data
    .Sign(signature => signature
        .WithAlgorithm(CryptoAlgorithm.ED25519)
        .IncludeDisclosurePolicy()
        .IncludeAccessTimestamp())

    // Record disclosure in ledger
    .Audit(audit => audit
        .RecordDataAccess()
        .WithDIDReference()
        .LogDisclosedFields()
        .LogRequesterIdentity()
        .EnableComplianceQuery())

    // Notify data custodian
    .Publish(notification => notification
        .ToDataOwner("data-accessed")
        .ToRequester("data-disclosure-granted")
        .ToCompliance("disclosure-logged"))

    // Validate disclosed data integrity
    .Validate<FilteredData>(validation => validation
        .AgainstSchema("filtered-data-schema")
        .EnsureNoPIILeakage()
        .VerifySignature())

    .Build();

Business Benefits

Privacy Protection: JSON Pointers ensure only authorized fields are shared
Compliance: GDPR, HIPAA-ready with field-level access control and audit trails
Collaboration: Enable secure multi-party research and analysis
Transparency: Complete audit trail of who accessed what data when
📝

Multi-Step Survey Collection

Complex survey workflows with conditional logic, data validation, and cryptographic protection of respondent data.

The Challenge

Research and customer feedback surveys require:

  • Multi-step conditional flows based on responses
  • Data validation at each step
  • Protection of sensitive respondent information
  • Progress tracking and resume capability
  • Aggregate analysis while preserving privacy

The Sorcha Solution

Intelligent survey workflows with:

  • JSON Logic for conditional question flows
  • JSON Schema validation for each response
  • Encrypted storage of sensitive responses
  • State management for partial submissions
  • Selective disclosure for different analysts

Blueprint Example: Multi-Step Survey Workflow

var surveyWorkflow = Blueprint.Create("MultiStepSurveyCollection")
    // Receive survey response
    .AddSource<SurveyResponse>(config => config
        .FromWebForm("survey-endpoint")
        .WithSessionManagement())

    // Validate current step
    .Validate<SurveyResponse>(validation => validation
        .AgainstSchema("survey-step-schema")
        .CheckRequiredFields()
        .ValidateResponseTypes())

    // Conditional routing based on responses
    .Route(routing => routing
        // Basic demographic questions for everyone
        .When(response => response.Step == 1)
            .ToDestination("demographic-processing")

        // Conditional follow-up based on age
        .When(response =>
            response.Step == 2 && response.Age < 25)
            .ToDestination("youth-specific-questions")

        .When(response =>
            response.Step == 2 && response.Age >= 25)
            .ToDestination("adult-specific-questions")

        // Income-based routing
        .When(response =>
            response.Step == 3 && response.Income > 100000)
            .ToDestination("high-income-questions")

        // Final step: thank you
        .When(response => response.IsComplete)
            .ToDestination("completion-processing"))

    // Encrypt sensitive fields
    .Transform<SurveyResponse, ProtectedResponse>(response =>
        response
            .EncryptField("/personalInfo/email")
            .EncryptField("/personalInfo/phone")
            .HashField("/personalInfo/postalCode"))

    // Sign and store
    .Sign(signature => signature
        .WithAlgorithm(CryptoAlgorithm.ED25519)
        .IncludeSessionId())

    .Audit(audit => audit
        .RecordSubmission()
        .WithAnonymizedIdentifier()
        .EnableAggregateAnalysis())

    // Notify researcher of completion
    .Publish(notification => notification
        .ToRespondent("survey-progress-saved")
        .ToResearcher("new-response-received"))

    .Build();

Business Benefits

Smart Routing: JSON Logic creates personalized survey paths
Data Quality: Schema validation ensures clean, analyzable data
Privacy First: Encryption and selective disclosure protect respondents
Research Ready: Aggregate analysis without compromising individual privacy

Ready to Build Your Workflow?

These production-ready examples are running in the Sorcha project today