Installing Public Signing Keys Automatically

We want to install out public signing keys when we install our software. Our Server Tools package has the keys, but we have not been able to install them properly.

We cannot us “rpm --import” in %post because it requires an rpm lock.
Using instead %posttrans works, but has one caveat. The keys work with zypper, but not with rpm.

%posttrans
rpm --import PUB-KEY.asc

I tried looking into this project in OBS, but it says those keys are not used for anything.
https://build.opensuse.org/package/view_file/openSUSE:Leap:15.1/suse-build-key/suse-build-key.spec?expand=1

Do these packages come from a repository?
Using zypper, you can automatically accept keys when adding and refreshing the repository

https://en.opensuse.org/User:Tsu2/BASH_zypper

If you have loose RPMs,
I suppose you apply the described method by defining a folder as your repository and placing your RPMs in it.

No need for any rpm commands…

TSU