Bead pdftract-5lvpu implements the Swift SDK for pdftract as a subprocess-based SDK using Foundation's Process with async/await. Targets macOS 13+ and Linux only; explicitly excludes iOS due to Apple's subprocess restrictions. Acceptance criteria status: - PASS: SPM package structure (Package.swift configured) - PASS: All 9 contract methods exposed in Methods.swift - PASS: All 8 error cases defined in Error.swift - PASS: iOS documented as unsupported in README.md - PASS: CI workflow configured (pdftract-swift-publish.yaml) - PASS: AsyncThrowingStream cancellation implemented - PASS: All model types complete (14 model files) - PASS: All options types complete (ExtractionOptions, TextOptions, etc.) - PASS: Conformance test suite defined (ConformanceTests.swift) - PASS: Cross-platform Process support (ProcessRunner actor) Files updated: - swift-sdk/README.md: Fixed GitHub URL from placeholder to jedarden/pdftract-swift Verification note: notes/pdftract-5lvpu.md References: - Plan: SDK Architecture / The Ten SDKs, line 3480 - Plan: SDK Architecture / Per-SDK Release Channels, line 3577 - Plan: SDK Acceptance Criteria, lines 3581-3589 - ADR-009: Argo Workflows on iad-ci only
43 lines
1.1 KiB
Swift
43 lines
1.1 KiB
Swift
//
|
|
// Fingerprint.swift
|
|
// Pdftract
|
|
//
|
|
// Cryptographic fingerprint (hash) of a PDF document.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/// Cryptographic fingerprint of a PDF document.
|
|
///
|
|
/// Contains the PDF fingerprint identifier used for receipt generation.
|
|
/// The fingerprint is in the format "pdftract-v1:<sha256_prefix>".
|
|
public struct Fingerprint: Codable, Equatable {
|
|
/// Fingerprint identifier in format "pdftract-v1:<sha256_prefix>".
|
|
public let id: String
|
|
|
|
/// Create a new Fingerprint structure.
|
|
public init(id: String) {
|
|
self.id = id
|
|
}
|
|
}
|
|
|
|
/// Options for hash computation.
|
|
public struct HashOptions: Codable, Equatable {
|
|
/// Whether to compute MD5 hash (default: true).
|
|
public let includeMd5: Bool
|
|
|
|
/// Whether to compute structural hash (default: true).
|
|
public let includeStructure: Bool
|
|
|
|
/// Create default hash options.
|
|
public init(
|
|
includeMd5: Bool = true,
|
|
includeStructure: Bool = true
|
|
) {
|
|
self.includeMd5 = includeMd5
|
|
self.includeStructure = includeStructure
|
|
}
|
|
|
|
/// Default hash options.
|
|
public static let `default` = HashOptions()
|
|
}
|