sign
Performs the complete device signing verification operation.
This is the main method that orchestrates the entire signing verification process:
Validates custom claims to ensure no reserved claim names are used
Looks up the appropriate user key (by userId or through selection)
Configures the device authenticator based on the key's authentication type
Authenticates the user to access the private key
Signs the challenge using the authenticated key to create a JWT
Handles cleanup and error reporting on failures
User key selection logic:
If userId is specified: Finds the exact key for that user
If no userId: Uses single available key or prompts user to select from multiple
If no keys exist: Throws DeviceNotRegisteredException
The operation is performed within a timeout to prevent indefinite blocking. The signed JWT includes the challenge and any custom claims for server verification.
Return
A Result containing the signed JWT on success, or an error on failure
Parameters
Optional configuration block to customize the signing verification behavior
Throws
if no user keys are found
if custom claims contain reserved names
if the operation exceeds the timeout