Tutorial

Legal Evidence Collection

Create a court-admissible evidence chain. For legal and forensic professionals.

90 min
Advanced
Web + Mobile
Enterprise

Overview

Build an evidence collection system that:
• Maintains strict chain of custody
• Generates court-admissible certificates
• Provides forensic verification
• Meets legal standards

For lawyers, investigators, forensic experts, and law enforcement.

Prerequisites

• Immutis Business or Enterprise plan
• Secure device (managed device)
• Understanding of evidence handling protocols
• Legal case management system (optional)

Step 1: Chain of Custody Setup

// Every piece of evidence tracks its full history
interface EvidenceChain {
  id: string
  caseId: string
  collectorId: string
  collectedAt: Date
  location: { lat: number; lng: number }
  hash: string  // Cryptographic seal
  custody: CustodyRecord[]
}

interface CustodyRecord {
  transferredTo: string  // User ID
  transferredAt: Date
  purpose: string  // "analysis" | "review" | "court"
  receivedBy: string
  signature?: string
}

Step 2: Evidence Collection

// Collect with full documentation
const collectEvidence = async (caseId, metadata) => {
  // Capture multiple angles for thorough documentation
  const photos = []
  
  for (const angle of ['overview', 'detail', 'context']) {
    const evidence = await immutis.capture({
      type: 'photo',
      location: true,
      timestamp: true,
      metadata: {
        caseId,
        angle,
        collectorId: currentUser.id,
        collectionPoint: 'crime-scene' // or 'evidence-room', 'lab', etc.
      }
    })
    photos.push(evidence)
  }
  
  // Create chain of custody record
  const chain = {
    id: caseId,
    collectorId: currentUser.id,
    collectedAt: new Date(),
    custody: [{
      transferredTo: currentUser.id,
      transferredAt: new Date(),
      purpose: 'collection'
    }]
  }
  
  return { photos, chain }
}

Step 3: Secure Storage

// Evidence must be stored securely
const storeEvidence = async (evidence, chain) => {
  // Store in approved evidence management system
  await evidenceVault.store({
    evidence: evidence.id,
    hash: evidence.hash,
    chain: chain,
    encrypted: true  // Always encrypt at rest
  })
  
  // Generate integrity report
  const integrityReport = {
    algorithm: 'SHA-256',
    hash: evidence.hash,
    timestamp: evidence.createdAt,
    device: evidence.deviceId,
    location: evidence.location
  }
  
  await db.integrityReports.create(integrityReport)
}

Step 4: Verification Workflow

// Verify before any legal proceeding
const verifyForCourt = async (evidenceId) => {
  // 1. Cryptographic verification
  const cryptoVerify = await immutis.verify(evidenceId, {
    standards: ['sha256', 'hardware']
  })
  
  // 2. Chain of custody verification
  const custodyVerify = await verifyCustody(evidenceId)
  
  // 3. Generate verification report
  return {
    crypto: cryptoVerify,
    custody: custodyVerify,
    valid: cryptoVerify.valid && custodyVerify.valid
  }
}

Step 5: Generate Certificate

// Generate forensic certificate for court
const generateLegalCertificate = async (evidenceId) => {
  const certificate = await immutis.certify({
    evidenceId,
    format: 'forensic',
    include: [
      'captured_at',
      'device_info',
      'location',
      'hardware_attestation',
      'chain_of_custody',
      'hash'
    ]
  })
  
  // Certificate includes:
  // - Original evidence hash
  // - Capture device details
  // - GPS coordinates
  // - Hardware attestation proof
  // - Timestamp from multiple sources
  
  return certificate
}

Step 6: Court Presentation

// Prepare for court exhibit
const prepareExhibit = async (caseId) => {
  const evidences = await getEvidenceForCase(caseId)
  
  // Verify all evidence
  const verifications = await Promise.all(
    evidences.map(e => verifyForCourt(e.id))
  )
  
  // Generate exhibit package
  const exhibit = {
    caseNumber: caseId,
    preparedAt: new Date(),
    preparedBy: currentUser.id,
    evidence: evidences.map((e, i) => ({
      ...e,
      verification: verifications[i]
    })),
    certificates: await Promise.all(
      evidences.map(e => generateLegalCertificate(e.id))
    )
  }
  
  // Export as sealed PDF
  return exportAsPDF(exhibit)
}

Legal Standards

This system meets requirements for:
• Federal Rules of Evidence
• Daubert standard for expert testimony  
• Chain of custody documentation
• Digital evidence handling (NIST guidelines)
• Law enforcement evidence protocols