@worldcoin/idkit-react-native
Version:
React Native client for the identity SDK. Privacy-preserving identity and proof of personhood with World ID.
63 lines (61 loc) • 1.44 kB
JavaScript
// src/session.ts
import { createWorldBridgeStore } from "@worldcoin/idkit-core";
var Session = class {
constructor() {
this.store = 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
import {
VerificationState,
VerificationLevel
} from "@worldcoin/idkit-core";
var src_default = Session;
export {
Session,
VerificationLevel,
VerificationState,
src_default as default
};