How can I "require" a signature?

I found something that works but I am not sure if it’s the best way to go about it. I used the same method as Snap viewport to next unsigned signature

// iterate each annotation looking for signatures
instance.annotManager.getAnnotationsList().forEach(annotation => {
    if (annotation instanceof instance.Annotations.SignatureWidgetAnnotation) {
        const is_required = annotation.getField()?.flags.get('Required') || false
        const is_signed = !!annotation.annot

        if (is_required && !is_signed) {
            // ...
        }
    }
})