Skip to main content

SDK API Reference

Embedding a Signature

To embed a signature, use the embedSignature method. This operation embeds a verifiable signature into the image data.

func embedSignature(in ciImage: CIImage) async throws(ProcessError) -> Signing.Output

Input Parameters:

  • ciImage: A CIImage representing the source image to be protected

Return Value:

  • Signing.Output containing:
    • signatureId: Unique identifier (SignatureID) for the embedded signature
    • processedImage: The protected image as a CIImage

Example:

// Perform signing (runs on background threads)
let result = try await sashaSDK.embedSignature(image, options: options)

// Access results
let protectedImage = result.processedImage // CIImage
let signatureId = result.signatureId.value // UInt64

print("Signature embedded with ID: \(signatureId)")

Looking Up a Signature

To verify a signature, use the lookupSignature method. This operation checks for the presence of a valid signature.

func lookupSignature(in ciImage: CIImage) async throws(ProcessError) -> SignatureID

Input Parameters:

  • ciImage: A CIImage to scan for existing signatures

Return Value:

  • SignatureID containing the unique identifier of the detected signature

Throws:

  • ProcessError.decodingError if no signature is found or image cannot be processed

Example:

do {
// Scan for existing signature (non-blocking)
let signature = try await sashaSDK.lookupSignature(in: image)
print("Found signature with ID: \(signature.value)")
return signature.value
} catch SashaSDK.ProcessError.decodingError {
// No protection detected
print("No signature found in image")
return nil
}

Environment Configuration

SashaSDK supports two environments:

let prodConfig = SashaSDK.Configuration(
apiKey: "your-production-api-key"
)

Set the requested environment to run the SDK in as part of the Configuration object submitted to the init method.