Skip to content

Latest commit

 

History

History
45 lines (36 loc) · 1.23 KB

signing.md

File metadata and controls

45 lines (36 loc) · 1.23 KB

Signing

Sign with a wallet account. Inputs follow the resources conventions.

Follow authentication first.

# Sign a 32-byte digest as is.
tk sign payload --input-json '{
  "signWith": "0xYourAddress",
  "payload": "0x…",
  "encoding": "PAYLOAD_ENCODING_HEXADECIMAL",
  "hashFunction": "HASH_FUNCTION_NO_OP"
}'

# Hash text before signing.
tk sign payload --input-json '{
  "signWith": "0xYourAddress",
  "payload": "hello",
  "encoding": "PAYLOAD_ENCODING_TEXT_UTF8",
  "hashFunction": "HASH_FUNCTION_KECCAK256"
}'

# Sign a serialized transaction. tk does not broadcast it.
tk sign transaction --input-json '{
  "signWith": "0xYourAddress",
  "unsignedTransaction": "02…",
  "type": "TRANSACTION_TYPE_ETHEREUM"
}'

Scripting:

tk sign payload --input-file ./sign.json --message-format json \
  | jq -r '.data.activity.result.signRawPayloadResult'

When a policy requires approval the command exits zero with status pending. Have an approver run tk activity approve, then collect the result with tk activity wait; see activities.

For Git commits, SSH, and OpenPGP, see git signing, SSH, and GPG signing.