ShareGuard

interface ShareGuard

A check the wallet runs after the holder approves sharing and before anything leaves the phone, for the credential types it names. The optional sdk-face module supplies the one customers use: a selfie liveness check plus a face match against the credential's own photo ("prove it's you").

Order on every path (in person, website, same-device): consent → guard → sign → send. A guard that does not pass means the response is never signed; the verifier sees a cancelled exchange and the wallet reports com.wallet.model.SdkError.Kind.FACE_CHECK_FAILED or com.wallet.model.SdkError.Kind.FACE_CHECK_UNAVAILABLE.

Set it once in SdkConfig.shareGuard. Credential types outside docTypes are shared exactly as before.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val docTypes: Set<String>

mdoc doctypes this guard applies to, e.g. org.iso.23220.photoid.1. Every other type is untouched.

Functions

Link copied to clipboard
abstract suspend fun beforeShare(share: PendingShare): ShareGuardResult

Runs after the holder taps Share. Return ShareGuardResult.Pass to let the credential go out.

Link copied to clipboard
open suspend fun prepare(share: PendingShare): ShareGuardResult

Optional early check that this credential can ever pass (for example: does its photo contain a usable face?). Called by com.wallet.clients.WalletClient.prepareForSharing; the default passes.