trustseal-sdk
v0.1.0
Published
Embed TrustSeal verification badges in any website or app.
Maintainers
Readme
trustseal-sdk
Embed TrustSeal verification badges in any website or app.
Install
npm install trustseal-sdkReact
import { TrustSealBadge } from "trustseal-sdk/react";
export function Profile() {
return <TrustSealBadge username="johnsmith" />;
}Props: username (required), baseUrl?, width?, height?, className?, style?.
Vanilla JS / TypeScript
import { renderBadge } from "trustseal-sdk";
renderBadge("#badge", { username: "johnsmith" });
// or render every <div data-trustseal="..."> on the page:
import { autoRender } from "trustseal-sdk";
autoRender();API:
renderBadge(target, options)— render a badge into an element or selector.createBadgeElement(options)— create the<iframe>without inserting it.badgeUrl(username, baseUrl?)— get the badge URL.autoRender(baseUrl?)— render all[data-trustseal]elements.
options: { username, baseUrl?, width?, height? }.
Self-hosted / local
Point the SDK at a different TrustSeal origin with baseUrl:
<TrustSealBadge username="johnsmith" baseUrl="http://localhost:3000" />No-build option
If you don't use a bundler, drop the hosted script instead:
<div data-trustseal="johnsmith"></div>
<script src="https://trustseal.xyz/sdk.js" async></script>