Install
Add the pinned Glyph Connect SDK and define a valid dApp origin.
Install the version used by this guide:
bun add @glyph-oss/connect@4.0.1 @qubic.org/crypto@1.0.0
# or
npm install @glyph-oss/connect@4.0.1 @qubic.org/crypto@1.0.0@glyph-oss/connect@4.0.1 is framework-agnostic. It provides typed request builders, v2 envelope creation, browser launch helpers, and the official Relay v2 client. For the dApp-side Qubic callback check, install @qubic.org/crypto@1.0.0, which exports the k12 hash and verify SchnorrQ verifier used in these docs.
The dApp verifies bytes returned by the Wallet; it does not sign them. Wallet signing happens after the user approves the request in Glyph Wallet. Do not put a seed or private key in browser code for this integration.
Define the dApp origin
Use the credential-free public HTTPS origin that identifies your app. It must be an origin only, without a path, query, or fragment:
const APP_ORIGIN = "https://app.example.org";Use your real deployed or development HTTPS origin in an application. The SDK rejects localhost, private addresses, and non-HTTPS delivery URLs, so local testing should use a public HTTPS origin for dApp metadata. The local server can still be used to serve the app; see Local testing and deployment.
Build a v2 request URL
Request builders add the nonce and expiry. createEnvelope() adds the v2 protocol, explicit network binding, and request_hash:
import {
GLYPH_MAINNET,
buildGlyphUrl,
createConnectRequest,
createEnvelope,
} from "@glyph-oss/connect";
const request = createConnectRequest({
type: "connect",
dapp: { name: "Example app", origin: APP_ORIGIN },
permissions: ["transfer", "sign_message"],
});
const envelope = createEnvelope(request, {
network: GLYPH_MAINNET, // { id: "qubic:mainnet" }
});
const url = buildGlyphUrl(envelope);
// url starts with glyph://v2/request?d=Pass the URL to launchGlyphRequest() only from a direct user action. The Relay-backed launch pattern is covered next.
Next step
Make the first connection with a prepared Relay v2 session.
