user8063: Context:
I'm trying to programmatically verify the owner/creator of a policyId. I assume that I need to verify whether a signing wallet is the same wallet that generated a particular policy id. (I am also using MeshJS endpoint that utilizes CIP-8 = "Message Signing", so a user will sign via nami/eternl/etc via browser interface)
My Research thus far:
I initially assumed that if I use the tx hash to find the UTxO and use the payment address of the inputs, it would give me the creator of said policyId. But this assumption was wrong since I have witnessed that some minting utxos have the minter's address as the input.

One can prove ownership of the UtxO address with this method, but not
the policy ID.

I also began looking into reconstructing the tx that generated the policy ID, but that is looking like a dead end for me since I've been told that generating policy ID is for creating new assets and that regenerating the policy ID would only end up changing all the asset fingerprints.
I've been told that a wallet could be generated with Policy keys, but this is something that noone is doing, and doesn't account for people minting collections via a third party and don't own their policy keys. Also some creators just ditch wallets altogether after a mint is over.
I have seen a project implement interfaces which asks the owner to sign with a wallet, or send x amount to an address. So I assume there is a way to implement this.
Is it just not ideal to verify ownership of a policy ID with message signing? Is there a workaround that app/dapp developers are using?

user4767: I think you can do this, the policy ID is the hash of a script which usually includes the hash of the public key of a key pair, of which the private key is used to sign the minting transaction. You could use this key to sign a CIP8 message.
This key pair is usually only used to mint a particular policy ID and is not used "as a wallet". One could do that in theory, but it would require the creator to get the private key from the minting service and import it to a browser wallet.
Not sure if it would work well in practice or would be too much of a technical hurdle for creators.
Simplified example in pycardano to show the idea (not really tested and not 100% general):
# key pair generated by the minting service
key_pair = PaymentKeyPair.generate()

# vkey "interpreted as wallet address"
address  = Address(key_pair.verification_key.hash())

# simplified, can also contain more conditions like time lock
policy_id = ScriptAll([ScriptPubkey(key_pair.verification_key.hash())]).hash()

signature           = pycardano.cip.cip8.sign(message, key_pair.signing_key)
verification_result = pycardano.cip.cip8.verify(signature)

assert verification_result['signing_address'] == address
assert verification_result['message'] == message
assert verification_result['verified']


8063: <h1>Context:</h1>
<p>I'm trying to <strong>programmatically verify the owner/creator of a policyId</strong>. I assume that I need to verify whether a signing wallet is the same wallet that generated a particular policy id. (I am also using <em>MeshJS endpoint that utilizes CIP-8 = &quot;Message Signing&quot;</em>, so a user will sign via nami/eternl/etc via browser interface)</p>
<h1>My Research thus far:</h1>
<p>I initially assumed that if I use the tx hash to <em><strong>find the UTxO and use the payment address of the inputs</strong></em>, it would give me the creator of said policyId. But this assumption was wrong since I have witnessed that some minting utxos have the minter's address as the input.</p>
<blockquote>
<p>One can prove ownership of the UtxO address with this method, but not
the policy ID.</p>
</blockquote>
<p>I also began looking into <em><strong>reconstructing the tx that generated the policy ID</strong></em>, but that is looking like a dead end for me since I've been told that generating policy ID is for creating new assets and that regenerating the policy ID would only end up changing all the asset fingerprints.</p>
<p>I've been told that a wallet could be generated with <strong>Policy keys</strong>, but this is something that noone is doing, and doesn't account for people minting collections via a third party and don't own their policy keys. Also some creators just ditch wallets altogether after a mint is over.</p>
<p>I have seen a project implement interfaces which asks the owner to sign with a wallet, or send x amount to an address. So I assume there is a way to implement this.</p>
<p>Is it just not ideal to verify ownership of a policy ID with message signing? Is there a workaround that app/dapp developers are using?</p>
 4767: <p>I think you can do this, the policy ID is the hash of a script which usually includes the hash of the public key of a key pair, of which the private key is used to sign the minting transaction. You could use this key to sign a CIP8 message.
This key pair is usually only used to mint a particular policy ID and is not used &quot;as a wallet&quot;. One could do that in theory, but it would require the creator to get the private key from the minting service and import it to a browser wallet.
Not sure if it would work well in practice or would be too much of a technical hurdle for creators.</p>
<p>Simplified example in pycardano to show the idea (not really tested and not 100% general):</p>
<pre><code># key pair generated by the minting service
key_pair = PaymentKeyPair.generate()

# vkey &quot;interpreted as wallet address&quot;
address  = Address(key_pair.verification_key.hash())

# simplified, can also contain more conditions like time lock
policy_id = ScriptAll([ScriptPubkey(key_pair.verification_key.hash())]).hash()

signature           = pycardano.cip.cip8.sign(message, key_pair.signing_key)
verification_result = pycardano.cip.cip8.verify(signature)

assert verification_result['signing_address'] == address
assert verification_result['message'] == message
assert verification_result['verified']
</code></pre>
