Skip to main content
Version: v8000

Use custom redaction

Some countries and jurisdictions require that specific fields in identity documents be redacted before any data leaves the device. BlinkID ships with several built-in redaction rules that automatically cover some of these requirements for certain document classes.

note

In v8000, this feature was renamed from anonymization to redaction, and the API uses Redaction naming throughout. See Changes in anonymization for the migration details.

Default redaction​

Default redaction applies automatically. When a scan completes, the SDK looks up its built-in rules for the scanned document class and applies them to the result before returning it. For example, German ID cards have their document number redacted by default.

No action is needed to perform default redaction.

Custom redaction​

You can perform your own custom redactions.

You can either override the redactions if they do not apply to your legal requirements, or add your redactions on top of the default ones.

Override redactions​

To override default redactions, return a RedactionSettings object with the fields you want to resolve from your resolver. The SDK removes the default redactions, and applies yours.

Return null (web, Android) or nil (iOS) for all other documents to keep their defaults unchanged.

const blinkId = await createBlinkId({
licenseKey: "...",
redactionSettingsResolver: (classInfo) => {
if (classInfo.country === "germany" && classInfo.type === "id") {
return { fields: ["sex", "dateOfBirth"] };
}
return null; // use SDK defaults for all other documents
},
});

Add custom redactions to default ones​

To extend the default redactions with additional fields, retrieve the defaults for the scanned document class inside your resolver and add your fields to the result.

const blinkId = await createBlinkId({
licenseKey: "...",
redactionSettingsResolver: async (classInfo) => {
const defaults = await blinkId.blinkIdCore.getDefaultRedactionSettings(classInfo);
return {
...defaults,
fields: [...defaults.fields, "sex", "dateOfBirth"],
};
},
});

Remove redactions​

To disable redaction entirely, return a RedactionSettings object with mode set to "none" from your resolver for every document class.

const blinkId = await createBlinkId({
licenseKey: "...",
redactionSettingsResolver: () => ({ mode: "none", fields: [] }),
});

MRZ and barcode redactions​

In addition to redactions which use mode and fields, you can also use two additional flags: redactMrz and redactBarcode (boolean).

These redact the data extracted from the MRZ or barcode.

Note that this redaction doesn't propagate to the top result. For example, if a piece of information is present both in the visual zone and the machine-readable zone, and you redact the machine-readable zone, this information will still be present in the result (unless also covered by a field in the fields array).

const blinkId = await createBlinkId({
licenseKey: "...",
redactionSettingsResolver: () => ({ fields: [], redactMrz: true, redactBarcode: true }),
});