signManifest (Experimental)
:::warning Host Discretion
The availability and behavior of signManifest
depends entirely on the host implementation. Hosts may choose to:
- Enable manifest signing for all domains
- Restrict signing to specific allowlisted domains
- Disable the feature entirely
- Implement additional validation requirements
Check with your specific host's documentation for their manifest signing policies. :::
Signs a domain manifest for verification and authenticity purposes.
Usage
import { sdk } from '@farcaster/miniapp-sdk'
const result = await sdk.experimental.signManifest({
domain: 'example.com'
})
Parameters
options
- domain (required): The domain to sign the manifest for
Return Value
Returns an object with the following properties:
- header: The header component of the signed manifest
- payload: The payload component containing the domain data
- signature: The cryptographic signature
{
header: string
payload: string
signature: string
}
Errors
RejectedByUser
Thrown if a user rejects the request to sign the manifest.
try {
await sdk.experimental.signManifest({ domain: 'example.com' })
} catch (error) {
if (error instanceof SignManifest.RejectedByUser) {
// Handle user rejection
}
}
InvalidDomain
Thrown when the provided domain is invalid or malformed.
try {
await sdk.experimental.signManifest({ domain: 'invalid-domain' })
} catch (error) {
if (error instanceof SignManifest.InvalidDomain) {
// Handle invalid domain
}
}
GenericError
Thrown when manifest signing fails for various reasons including host restrictions, network issues, or other implementation-specific failures.
try {
await sdk.experimental.signManifest({ domain: 'example.com' })
} catch (error) {
if (error instanceof SignManifest.GenericError) {
// Handle generic signing failures
console.log('Signing failed:', error.message)
}
}
Generic Error Handling
For robust error handling, you should catch all specific error types:
try {
const result = await sdk.experimental.signManifest({ domain: 'example.com' })
// Handle successful signing
} catch (error) {
if (error instanceof SignManifest.RejectedByUser) {
// User declined to sign the manifest
console.log('User rejected manifest signing')
} else if (error instanceof SignManifest.InvalidDomain) {
// Domain format is invalid
console.log('Invalid domain format')
} else if (error instanceof SignManifest.GenericError) {
// Generic signing failures
console.log('Signing failed:', error.message)
// This could include:
// - Domain not allowlisted by host
// - Feature disabled by host
// - Network or connectivity issues
// - Host-specific validation failures
} else {
// Other unexpected errors
console.log('Manifest signing failed:', error.message)
// This could include network or authentication errors
}
}