Skip to main content

Sign authorization entries

In order to take advantage of contract authorization, you can use Freighter's API to sign an authorization entry. A good example of how signing an authorization entry works can be found in the authorizeEntry helper of stellar-sdk.

Like in the helper, you can construct a HashIdPreimageSorobanAuthorization and use the xdr representation of that structure to call await freighterApi.signAuthEntry(preimageXdr). This call will return a Buffer of the signed hash of the HashIdPreimageSorobanAuthorization passed in, which can then be used to submit to the network during a contract authorization workflow.

For a full example of how to use contract authorization, the scaffold-soroban demo for an atomic swap makes use of both contract auth and Freighter's signAuthEntry API.