Reuse a KeySigner signing rule
Keep a signing rule in version control, load it as a draft and verify it on a fresh test request.
Download the rule
This example requires one eligible key with the biometric property for an Ethereum message signature. Use a disposable KeySigner workspace with two test keys, one registered with that property and one without it.
[ { "scenario": "evm.personal_message", "property": "biometric", "minimum": 1 } ]Download signing-rules-v1.json
Store the JSON in your repository. Record the KeySigner build and the scenario you tested alongside it. Keep credentials and account records out of the file.
Save a draft
Use a test deployment that exposes the signing policy management API. You need
curl7.76 or later,jqand a test management token with permission to read and edit signing requirements. SetKEYSIGNER_TEST_ORIGINandKEYSIGNER_TEST_TOKENin your environment and run this from the folder containing the download.( set -eu : "${KEYSIGNER_TEST_ORIGIN:?Set your test KeySigner URL}" : "${KEYSIGNER_TEST_TOKEN:?Set your test management token}" api="${KEYSIGNER_TEST_ORIGIN%/}/v1/admin/signing-policy/draft" draft=$(printf 'Authorization: Bearer %s\n' "$KEYSIGNER_TEST_TOKEN" | curl --fail-with-body --silent --show-error --header @- "$api") body=$(printf '%s\n' "$draft" | jq -ce --slurpfile file signing-rules-v1.json ' . as $draft | $file[0] as $wanted | if $draft.rules == [] and $draft.active_rules == [] or $draft.rules == $wanted and ($draft.active_rules == [] or $draft.active_rules == $wanted) then {expected_revision: $draft.revision, rules: $wanted} else error("Use a test workspace with an empty or matching rule set.") end ') printf 'Authorization: Bearer %s\n' "$KEYSIGNER_TEST_TOKEN" | curl --fail-with-body --silent --show-error --header @- \ --header 'Content-Type: application/json' --request PUT \ --data-binary "$body" "$api" )The API replaces the full draft list, so the example stops when it sees a different saved or active rule. It reads the revision from your test workspace. If another save gets there first, reload and review the new draft before retrying.
Check
rulesfor the downloaded values andactive_rulesfor the policy currently in effect. A second save of the same rule keeps the same revision.Test after activation
Open
/console/on the same test deployment. Under Signing requirements, compare the saved draft with Active requirements. Activate the saved draft or request the required approvals, as your workspace requires. Reopen the page and confirm that the active values match the file.When repeating the setup elsewhere, use that workspace’s draft revision and check the same two outcomes. To repeat with an updated rule, commit the change to the file and rehearse it in a fresh workspace.
What we tested
On , the downloaded rule saved as a draft in two fresh local workspaces on KeySigner API build
77079a82e. Saving it again kept the same revision. After activation, a software test key with the registered property completed the signing session. A key without it could not prepare a signer. The command left a different saved draft in place.