Skip to content

Use signatures

With XMTP, you can use various types of signatures to sign and verify payloads.

When a user creates, adds, removes, or revokes an XMTP inbox’s identity or installation, a signature is required.

const
const signature: Promise<Uint8Array<ArrayBufferLike>>
signature
=
client: Client<BuiltInContentTypes>
client
.
Client<BuiltInContentTypes>.signWithInstallationKey(signatureText: string): Promise<Uint8Array<ArrayBufferLike>>

Signs a message with the installation key

@paramsignatureText - The text to sign

@returnsThe signature

signWithInstallationKey
(
signatureText: string
signatureText
);

Use verifySignedWithInstallationKey on Browser and Node. Use verifySignature on Kotlin and Swift.

Verify with another installation in the same inbox

Section titled “Verify with another installation in the same inbox”

Kotlin and Swift accept an installation ID through verifySignatureWithInstallationId. Browser uses client.verifySignedWithPublicKey, and Node uses the static Client.verifySignedWithPublicKey; convert the installation ID from hex to public-key bytes for these JavaScript calls. Verification proves that the matching installation key signed the payload. Check inbox membership separately when the caller must belong to a specific inbox.