Skip to content

API Reference

EligibilitySDKConfig

The EligibilitySdk type defines the configuration for the EligibilityWidget component.

type SdkStatusCardOverride = {
  icon?: ReactNode;
  heading?: string;
  message?: string;
};

interface Theme {
  color: {
    primary: string;
    background: string;
    text: string;
    border: string;
    error: string;
    success: string;
    warning: string;
    info: string;
    muted: string;
    shadow: string;
    link: string;
  };
  typography: {
    fontFamily: string;
    fontSize: string;
    fontWeight: number;
    lineHeight: string;
    h2: {
      fontSize: string;
      fontWeight: number;
      lineHeight: string;
    };
    link: {
      color: string;
      textDecoration: string;
      hover: {
        textDecoration: string;
      };
    };
  };
  customStyles?: {
    [key: string]: {
      [property: string]: string | number;
    };
  };
}

interface EligibilitySdk {
  config: {
    queryHandler: () => Promise<{
      sessionId: string;
      request: protocol.AuthorizationRequestMessage;
    }>;
    authStatusHandler: (sessionId: string) => Promise<{
      status: "idle" | "verifying" | "failed" | "success";
      proof?: protocol.AuthorizationResponseMessage;
      error?: string;
    }>;
  };
  onSuccess: (data?: {
    userDID: string;
    sessionId: string;
    proof: protocol.AuthorizationResponseMessage;
    status: string;
  }) => void;

  customTheme?: Theme;
  sdkOverride?: {
    home?: {
      heading?: string | React.JSX.Element;
      subHeading?: string | React.JSX.Element;
      queryLabel?: string | React.JSX.Element;
      errorMessage?: string | React.JSX.Element;
      queryComponent?: React.JSX.Element;
      qrLabel?: string;
    };
    verifier?: {
      pending?: SdkStatusCardOverride;
      success?: SdkStatusCardOverride;
      error?: SdkStatusCardOverride;
      customErrorScreen?: React.JSX.Element;
      customSuccesssScreen?: React.JSX.Element;
    };
    issuer?: {
      heading?: string | React.JSX.Element;
      signInQrText?: string;
    };
    loader?: React.JSX.Element;
    errorIcon?: React.JSX.Element;
    successIcon?: React.JSX.Element;
    signRequest?: SdkStatusCardOverride;
    rejectSignRequest?: SdkStatusCardOverride & {
      btnText?: string;
    };
    commonErrorScreen?: SdkStatusCardOverride;
    kycWidgetError?: SdkStatusCardOverride & {
      btnText?: string;
    };
    verificationPending?: SdkStatusCardOverride;
    verificationFailed?: SdkStatusCardOverride & {
      btnText?: string;
    };
    verficationIncomplete?: SdkStatusCardOverride & {
      btnText?: string;
    };
    verificationSuccess?: {
      icon?: ReactNode;
      heading?: string;
      enableBtnText?: string;
      retryBtnText?: string;
    };
    transactionRequest?: SdkStatusCardOverride;
    rejectTransactionRequest?: SdkStatusCardOverride & {
      btnText?: string;
    };
    accountActivated?: SdkStatusCardOverride & {
      btnText?: string;
    };
    credentialsList?: {
      heading?: string | React.JSX.Element;
      subHeading?: string | React.JSX.Element;
    };
  };
}
  • queryHandler: A custom function that sends the queries and handles the backend request. It should return a sessionId and an AuthorizationRequestMessage.
  • authStatusHandler: A custom function that checks the session status and returns the verification result, including the proof.

protocol.ZeroKnowledgeProofRequest

ZeroKnowledgeProofRequest represents structure of zkp request object

export type ZeroKnowledgeProofRequest = {
  id: number;
  circuitId: string;
  optional?: boolean;
  query: JsonDocumentObject;
  params?: {
    nullifierSessionId?: string | number;
  };
};
  • id: A unique identifier for the query.
  • circuitId: The ID of the circuit being used (e.g., credentialAtomicQuerySigV2).
  • query: The query details that define the type, context, and subject of the verifiable credential.

Authorized Issuers' DIDs for Redbelly Chains

When constructing a ZeroKnowledgeProofRequest—specifically within the query field—you may need to include a list of authorized Decentralized Identifiers (DIDs) from which credentials can be issued.

These DIDs are critical for the verifier to correctly validate proofs against trusted issuers for each Redbelly network environment.


Redbelly Mainnet

  • Averer
    did:receptor:redbelly:mainnet:31AAH8sSaGd6fpnG1TcB6yQ4UZnNeyHzTk5aM2P7rjv

Redbelly Testnet

  • Averer
    did:receptor:redbelly:testnet:31K8aKWDJc9K7n3ZRao3QXS8deXSbxowUXN6QwWKbxs

Redbelly Staging

  • Averer
    did:receptor:redbelly:testnet:31K8aKWDJc9K7n3ZRao3QXS8deXSbxowUXN6QwWKbxs

Session and Status Management

Once the queryHandler is triggered, the SDK will initiate a session with the backend, which is responsible for generating the AuthorizationRequestMessage and issuing the request. The developer can monitor the session status by passing an authStatusHandler function that periodically checks the status of the session.

  • Session Status: The session status can be one of the following:
  • idle: The SDK is idle, waiting to start the query.
  • verifying: The verification process is ongoing.
  • failed: Verification failed.
  • success: Verification succeeded, and the proof is available.