Skip to content

Commit

Permalink
add the missing documentation (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
nprt authored Jan 2, 2025
1 parent c95a60d commit 1358ce6
Showing 1 changed file with 61 additions and 2 deletions.
63 changes: 61 additions & 2 deletions plugins/filter/subkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,67 @@
import subprocess
import json

DOCUMENTATION = '''
name: subkey_inspect
author: Parity Technologies
version_added: "1.10.8"
short_description: Inspects crypto keys using the Subkey utility
description:
- Filter that runs the Subkey inspect command to analyze cryptographic keys
- Supports various networks and schemes
- Can output public key information
- Returns JSON formatted data about the key
options:
uri:
description: The URI or key to inspect
type: str
required: true
network:
description: The network to use for the inspection
type: str
required: false
default: ''
scheme:
description: The cryptographic scheme to use
type: str
required: false
default: ''
public:
description: Whether to only show public key information
type: bool
required: false
default: false
'''

EXAMPLES = '''
# Basic key inspection
- debug:
msg: "{{ 'key_uri' | subkey_inspect }}"
# Inspect with specific network
- debug:
msg: "{{ 'key_uri' | subkey_inspect(network='kusama') }}"
# Inspect with specific scheme and show only public info
- debug:
msg: "{{ 'key_uri' | subkey_inspect(scheme='sr25519', public=true) }}"
'''

RETURN = '''
ss58:
description: The SS58 address of the key
type: str
sample: "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
public_key:
description: The public key in hex format
type: str
sample: "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"
account_id:
description: The account ID
type: str
sample: "d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"
'''


def subkey_inspect(uri, network='', scheme='', public=False):
"""Run subkey inspect command and return output."""
Expand Down Expand Up @@ -55,5 +116,3 @@ def filters(self):
return {
'subkey_inspect': subkey_inspect
}


0 comments on commit 1358ce6

Please sign in to comment.