.NET verifier SDK: Image extraction
ImagePayload
Section titled “ImagePayload”Class in Verifiabl.Verifier.Extraction.Images
The Verifiabl QR code found in an image file.
The payload text is encrypted, but treat it as sensitive and keep it out of logs.
public sealed class ImagePayloadInheritance: System.Object
ImagePayload(string?)
Section titled “ImagePayload(string?)”Constructor
Create an instance for an adapter or test fake. This reads nothing.
public ImagePayload(string? qrCode)| Parameter | Type | Description |
|---|---|---|
qrCode |
System. |
QrCode
Section titled “QrCode”Property
The text of the image’s Verifiabl QR code, unchanged, or null when it has none.
public string? QrCode { get; }Returns: System.String
ToString()
Section titled “ToString()”Method
Whether a QR code was found only, so the object is safe to log.
public override string ToString()Returns: System.String
ImageReadOptions
Section titled “ImageReadOptions”Class in Verifiabl.Verifier.Extraction.Images
Options for reading the QR code in an image file.
public sealed class ImageReadOptionsInheritance: System.Object
Timeout
Section titled “Timeout”Property
Time budget for reading an image file, including reading a stream,
decoding and reading the QR code. Defaults to 30 seconds. It is separate
from Verifiabl., which covers the
verification call that follows.
public TimeSpan Timeout { get; set; }Returns: System.TimeSpan
ImageVerificationResult
Section titled “ImageVerificationResult”Class in Verifiabl.Verifier.Extraction.Images
A verified image file and the QR code read from it.
public sealed class ImageVerificationResultInheritance: System.Object
ImageVerificationResult(VerificationResult, ImagePayload)
Section titled “ImageVerificationResult(VerificationResult, ImagePayload)”Constructor
Create a result for an adapter or test fake. This does not perform verification.
public ImageVerificationResult(VerificationResult verification, ImagePayload payload)| Parameter | Type | Description |
|---|---|---|
verification |
Verifiabl. |
|
payload |
Verifiabl. |
Verification
Section titled “Verification”Property
The verified payslip data, not an assessment of the image’s visible contents.
public VerificationResult Verification { get; }Returns: Verifiabl.Verifier.VerificationResult
Payload
Section titled “Payload”Property
The QR code read from the image.
public ImagePayload Payload { get; }Returns: Verifiabl.Verifier.Extraction.Images.ImagePayload
ToString()
Section titled “ToString()”Method
The reference and schema only, so the result is safe to log.
public override string ToString()Returns: System.String
PayslipImageReader
Section titled “PayslipImageReader”Class in Verifiabl.Verifier.Extraction.Images
Reads the Verifiabl QR code in a PNG, JPEG or WebP file, such as a photo or screenshot of a payslip.
The file is decoded and its QR codes are read in the WebAssembly sandbox. Only QR codes shaped like a Verifiabl payload are read; other codes in the image are ignored. Scan links are never fetched and the text is returned unchanged.
public static class PayslipImageReaderInheritance: System.Object
MaxFileBytes
Section titled “MaxFileBytes”Field
The largest image file read: 20 MiB, the same limit as the Verifiabl portal.
public const int MaxFileBytes = 20971520Returns: System.Int32
Read(byte[], CancellationToken)
Section titled “Read(byte[], CancellationToken)”Method
Read the QR code on the calling thread, without a time budget.
public static ImagePayload Read(byte[] file, CancellationToken cancellationToken = default)| Parameter | Type | Description |
|---|---|---|
file |
System. |
The image file’s bytes, at most Verifiabl.. |
cancellationToken |
System. |
Stops reading within about 50 milliseconds. |
Returns: Verifiabl.Verifier.Extraction.Images.ImagePayload, The QR code found, or an empty Verifiabl..
Exceptions
| Type | Condition |
|---|---|
Verifiabl. |
The file is too large, cannot be decoded, or shows two different Verifiabl QR codes. |
System. |
Wasmtime’s native library could not be loaded. |
ReadAsync(byte[], ImageReadOptions?, CancellationToken)
Section titled “ReadAsync(byte[], ImageReadOptions?, CancellationToken)”Method
Read the QR code within Verifiabl..
Decoding runs on the thread pool, at most one read for each processor at a
time across the process, so the time budget ends the wait even if
decoding a hostile file is slow.
The budget starts once the sandbox’s module is compiled, which the first
read in a process waits for; see Verifiabl..
public static Task<ImagePayload> ReadAsync(byte[] file, ImageReadOptions? options = null, CancellationToken cancellationToken = default)| Parameter | Type | Description |
|---|---|---|
file |
System. |
The image file’s bytes, at most Verifiabl.. |
options |
Verifiabl. |
Optional settings, such as the time budget. |
cancellationToken |
System. |
Cancels reading. |
Returns: System.Threading.Tasks.Task{Verifiabl.Verifier.Extraction.Images.ImagePayload}, The QR code found, or an empty Verifiabl..
Exceptions
| Type | Condition |
|---|---|
Verifiabl. |
The file is too large, cannot be decoded, shows two different Verifiabl QR codes, or reading took longer than the time budget. |
System. |
Wasmtime’s native library could not be loaded. |
ReadAsync(Stream, ImageReadOptions?, CancellationToken)
Section titled “ReadAsync(Stream, ImageReadOptions?, CancellationToken)”Method
Read the QR code from a stream within Verifiabl..
The stream is read to its end and not disposed.
The time budget covers reading the stream and decoding it. The stream is only read, never abandoned: if it ignores cancellation, this call waits for its read to return, so the stream is not used after the call ends.
public static Task<ImagePayload> ReadAsync(Stream file, ImageReadOptions? options = null, CancellationToken cancellationToken = default)| Parameter | Type | Description |
|---|---|---|
file |
System. |
The image file’s bytes, at most Verifiabl.. |
options |
Verifiabl. |
Optional settings, such as the time budget. |
cancellationToken |
System. |
Cancels reading. |
Returns: System.Threading.Tasks.Task{Verifiabl.Verifier.Extraction.Images.ImagePayload}, The QR code found, or an empty Verifiabl..
Exceptions
| Type | Condition |
|---|---|
Verifiabl. |
The file is too large, cannot be decoded, shows two different Verifiabl QR codes, or reading took longer than the time budget. |
System. |
Wasmtime’s native library could not be loaded. |
VerifierClientImageExtensions
Section titled “VerifierClientImageExtensions”Class in Verifiabl.Verifier.Extraction.Images
Verifies a payslip from an image file, such as a photo or screenshot of its QR code.
public static class VerifierClientImageExtensionsInheritance: System.Object
VerifyImageAsync(IVerifierClient, byte[], ImageReadOptions?, Guid?, CancellationToken)
Section titled “VerifyImageAsync(IVerifierClient, byte[], ImageReadOptions?, Guid?, CancellationToken)”Method
Read the Verifiabl QR code in a PNG, JPEG or WebP file and verify it with
Verifiabl..
Each call without idempotencyKey is a new verification
with a new key. To retry a failed call without a second charge, pass the
failure’s Verifiabl. within 1 hour.
Reading takes up to Verifiabl. and verification
up to the client’s own timeout, so the call can take their sum.
public static Task<ImageVerificationResult> VerifyImageAsync(this IVerifierClient client, byte[] file, ImageReadOptions? options = null, Guid? idempotencyKey = null, CancellationToken cancellationToken = default)| Parameter | Type | Description |
|---|---|---|
client |
Verifiabl. |
Any verifier client, including a fake or decorator. |
file |
System. |
The image file’s bytes, at most Verifiabl.. |
options |
Verifiabl. |
Optional settings, such as the time budget. |
idempotencyKey |
System. |
The key of an earlier attempt to verify this image, from Verifiabl. or one you saved before the first attempt, or null for a new verification. See Verifiabl.. |
cancellationToken |
System. |
Cancels reading and verification. |
Returns: System.Threading.Tasks.Task{Verifiabl.Verifier.Extraction.Images.ImageVerificationResult}, The verified payslip and the QR code it was read from.
Exceptions
| Type | Condition |
|---|---|
Verifiabl. |
No single Verifiabl QR code could be read. Nothing was sent to Verifiabl. |
Verifiabl. |
The payload could not be verified, or verification could not be completed; see Verifiabl.. |
System. |
Wasmtime’s native library could not be loaded. |
VerifyImageAsync(IVerifierClient, Stream, ImageReadOptions?, Guid?, CancellationToken)
Section titled “VerifyImageAsync(IVerifierClient, Stream, ImageReadOptions?, Guid?, CancellationToken)”Method
Read the Verifiabl QR code in an image stream and verify it. The stream is read to its end and not disposed.
Each call without idempotencyKey is a new verification
with a new key. To retry a failed call without a second charge, pass the
failure’s Verifiabl. within 1 hour.
Reading takes up to Verifiabl. and verification
up to the client’s own timeout, so the call can take their sum.
public static Task<ImageVerificationResult> VerifyImageAsync(this IVerifierClient client, Stream file, ImageReadOptions? options = null, Guid? idempotencyKey = null, CancellationToken cancellationToken = default)| Parameter | Type | Description |
|---|---|---|
client |
Verifiabl. |
Any verifier client, including a fake or decorator. |
file |
System. |
The image file’s bytes, at most Verifiabl.. |
options |
Verifiabl. |
Optional settings, such as the time budget. |
idempotencyKey |
System. |
The key of an earlier attempt to verify this image, from Verifiabl. or one you saved before the first attempt, or null for a new verification. See Verifiabl.. |
cancellationToken |
System. |
Cancels reading and verification. |
Returns: System.Threading.Tasks.Task{Verifiabl.Verifier.Extraction.Images.ImageVerificationResult}, The verified payslip and the QR code it was read from.
Exceptions
| Type | Condition |
|---|---|
Verifiabl. |
No single Verifiabl QR code could be read. Nothing was sent to Verifiabl. |
Verifiabl. |
The payload could not be verified, or verification could not be completed; see Verifiabl.. |
System. |
Wasmtime’s native library could not be loaded. |