@dustid/dust-go v0.0.17
@dustid/dust-go
DUST Go is a prototyping platform that allows developers to create mobile webapps that leverage DUST Identity's platform-dependent functionality without requiring an upfront investment into mobile toolchains.
Install
npm install @dustid/dust-goUsage
import { connector } from @dustid/dust-go';
const scans: string[] = [];
// Note: connector will be undefined if running outside DUST Go
connector?.addEventListener("scan", ({data}) => {scans.push(data)});
connector?.showScanner();API
High Level API
scanAsync(): Promise<ScanPayload>Presents the scanner, and awaits a scan. Rejects if scanner is hidden.
DUST Go Connector
This is more low level, but more flexible.
connector.showScanner(): voidShows the scanner modal over the main webview.
connector.hideScanner(): voidHides the scanner modal, returning to the main webview. Note, this can be called even while the webview is in the "background", the webview isn't paused while the scanner is presented.
Events
| Event | Payload |
|---|---|
scan | {data: string, metadata?: Record<string, string>} |
show | {} |
hide | {} |
connector.dispatchEvent(event: string, payload: unknown): voidconnector.addEventListener(event: string, cb: (payload: unknown) => void): voidconnector.removeEventListener(event: string, cb: (payload: unknown) => void): voidAuth
On some platforms, it's necessary to rewrite the redirects from the app to the OAuth2 server to work around platform limitations. It's recommended to always wrap those redirects with this call, and let the connector no-op when no workaround is required.
connector.rewriteRedirect(url: URL): URL7 months ago
6 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago