Constructors

Methods

  • Advance the chain: increment sequence, return the new sequence and prevHash.

    Returns {
        sequence: number;
        prevHash: string;
    }

    • sequence: number
    • prevHash: string
  • Compute the SHA-256 hash of an event's preimage. Preimage format: ${sequence}|${type}|${timestamp}|${agentId}|${prevHash}|${payloadHash}

    Parameters

    • event: {
          sequence: number;
          type: ProvenanceEventType;
          timestamp: string;
          agentId: string;
          prevHash: string;
          payloadHash: string;
      }
      • sequence: number
      • type: ProvenanceEventType
      • timestamp: string
      • agentId: string
      • prevHash: string
      • payloadHash: string
    • algorithm: string = 'sha256'

    Returns string

  • Compute the SHA-256 hash of a payload object using canonical JSON. Canonical = sorted keys recursively for deterministic output.

    Parameters

    • payload: Record<string, unknown>
    • algorithm: string = 'sha256'

    Returns string