UNPKG

@worldcoin/idkit-react-native

Version:

React Native client for the identity SDK. Privacy-preserving identity and proof of personhood with World ID.

89 lines (85 loc) 2.58 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var src_exports = {}; __export(src_exports, { Session: () => Session, VerificationLevel: () => import_idkit_core2.VerificationLevel, VerificationState: () => import_idkit_core2.VerificationState, default: () => src_default }); module.exports = __toCommonJS(src_exports); // src/session.ts var import_idkit_core = require("@worldcoin/idkit-core"); var Session = class { constructor() { this.store = (0, import_idkit_core.createWorldBridgeStore)(); } async create(app_id, action, options) { await this.store.getState().createClient({ app_id, action, signal: options?.signal, bridge_url: options?.bridge_url, action_description: options?.action_description, verification_level: options?.verification_level, partner: options?.partner }); return this; } /** * Polls for verification updates */ async pollForUpdates() { return this.store.getState().pollForUpdates(); } /** * Polls for updates and returns the current session status */ async status() { await this.pollForUpdates(); const state = this.store.getState(); return { state: state.verificationState, result: state.result, errorCode: state.errorCode }; } /** * Gets the current session URI that can be used to start verification */ get sessionURI() { return this.store.getState().connectorURI; } /** * Destroys the session and cleans up resources */ destroy() { this.store.getState().reset(); } }; // src/index.ts var import_idkit_core2 = require("@worldcoin/idkit-core"); var src_default = Session; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { Session, VerificationLevel, VerificationState });