Skip to main content

Sign Payload

The SignPayload functionality in Beacon allows developers to sign various types of payloads. This page provides some examples for signing payloads in different formats: HEX Prefixed with 05, HEX Prefixed with 03, and RAW.

HEX Prefixed With 05

Example
import { DAppClient, SigningType } from "@airgap/beacon-sdk";

const dAppClient = new DAppClient({ name: "Beacon Docs" });

const response = await dAppClient.requestSignPayload({
  signingType: SigningType.MICHELINE,
  // This hex string needs to be prefixed with 05
  // The following is packed data, it can also be signed by Kukai
  payload: `05010000004254657a6f73205369676e6564204d6573736167653a206d79646170702e636f6d20323032312d30312d31345431353a31363a30345a2048656c6c6f20776f726c6421`,
});

console.log(`Signature: ${response.signature}`);
Loading...

HEX Prefixed With 03

Example
import { DAppClient, SigningType } from "@airgap/beacon-sdk";

const dAppClient = new DAppClient({ name: "Beacon Docs" });

const response = await dAppClient.requestSignPayload({
  signingType: SigningType.OPERATION,
  payload: "0300", // This hex string needs to be prefixed with 03
});

console.log(`Signature: ${response.signature}`);
Loading...

RAW

warning

Not all wallets support the RAW signing type. Additionally, the signatures can be different depending on the wallet that was used. For the preferred way of signing arbitrary data, please check the docs here: https://tezostaquito.io/docs/signing/#generating-a-signature-with-beacon-sdk

Example
import { DAppClient, SigningType } from "@airgap/beacon-sdk";

const dAppClient = new DAppClient({ name: "Beacon Docs" });

const response = await dAppClient.requestSignPayload({
  signingType: SigningType.RAW,
  payload: "any string that will be signed",
});

console.log(`Signature: ${response.signature}`);
Loading...