# Class BSV::Overlay::AdminTokenTemplate::Unlocker <a id="class-BSV-Overlay-AdminTokenTemplate-Unlocker"></a>

**Inherits:** `Object`

Unlocker returned by {#unlock}.

Satisfies the P2PK condition in a PushDrop locking script by signing the
BIP-143 sighash of the spending transaction using the wallet's derived key for
the appropriate protocol.

## Constants
### `ESTIMATED_LENGTH` <a id="constant-ESTIMATED_LENGTH"></a> <a id="ESTIMATED_LENGTH-constant"></a>
Estimated length of a P2PK unlocking script: 1 push opcode + up to 72
DER-encoded signature bytes + 1 sighash byte = 73 bytes total.

## Public Instance Methods
### `estimated_length(_tx, _input_index)` <a id="method-i-estimated_length"></a> <a id="estimated_length-instance_method"></a>
Estimated byte length of the unlocking script.
- **@param** `_tx` [Transaction::Tx] unused
- **@param** `_input_index` [Integer] unused
- **@return** [Integer]

### `initialize(wallet, protocol_id, originator)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
- **@param** `wallet` [#create_signature] BRC-100 wallet interface
- **@param** `protocol_id` [Array] two-element array [security_level, protocol_name]
- **@param** `originator` [String, nil] optional originator domain
- **@return** [Unlocker] a new instance of Unlocker

### `sign(tx, input_index)` <a id="method-i-sign"></a> <a id="sign-instance_method"></a>
Generate the unlocking script for the given input.

Computes the BIP-143 sighash (SIGHASH_ALL|FORK_ID) and signs it using the
wallet's derived key for the protocol.
- **@param** `tx` [Transaction::Tx] the spending transaction
- **@param** `input_index` [Integer] which input to sign
- **@return** [BSV::Script::Script] the unlocking script
