@reclaimprotocol/js-sdk 5.0.0-dev.4 → 5.0.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -3
- package/dist/index.js +15 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -337,7 +337,7 @@ type ProofRequestOptions = {
|
|
|
337
337
|
*/
|
|
338
338
|
portalUrl?: string;
|
|
339
339
|
customAppClipUrl?: string;
|
|
340
|
-
launchOptions?:
|
|
340
|
+
launchOptions?: ReclaimFlowInitOptions;
|
|
341
341
|
/**
|
|
342
342
|
* Whether the verification client should automatically submit necessary proofs once they are generated.
|
|
343
343
|
* If set to false, the user must manually click a button to submit.
|
|
@@ -376,7 +376,7 @@ type ProofRequestOptions = {
|
|
|
376
376
|
*/
|
|
377
377
|
acceptTeeAttestation?: boolean;
|
|
378
378
|
};
|
|
379
|
-
type
|
|
379
|
+
type ReclaimFlowInitOptions = {
|
|
380
380
|
/**
|
|
381
381
|
* Enables deferred deep links for the Reclaim verification flow.
|
|
382
382
|
*
|
|
@@ -402,6 +402,8 @@ type ReclaimFlowLaunchOptions = {
|
|
|
402
402
|
* @default 'portal'
|
|
403
403
|
*/
|
|
404
404
|
verificationMode?: 'app' | 'portal';
|
|
405
|
+
};
|
|
406
|
+
type ReclaimFlowLaunchOptions = ReclaimFlowInitOptions & {
|
|
405
407
|
/**
|
|
406
408
|
* Target DOM element to embed the verification flow in an iframe.
|
|
407
409
|
* When provided, the portal opens inside the element instead of a new tab.
|
|
@@ -1478,4 +1480,4 @@ declare function isDesktopDevice(): boolean;
|
|
|
1478
1480
|
*/
|
|
1479
1481
|
declare function clearDeviceCache(): void;
|
|
1480
1482
|
|
|
1481
|
-
export { type Beacon, type BeaconState, type BodySniff, ClaimCreationType, type ClaimID, type ClaimInfo, type CompleteClaimData, type Context, type CreateVerificationRequest, DeviceType, type EmbeddedFlowHandle, type ExtensionMessage, type FlowHandle, type HashRequirement, type HashableHttpProviderClaimParams, type HttpFormEntry, type HttpProviderClaimParams, type HttpRedirectionMethod, type HttpRedirectionOptions, type InitSessionResponse, type InjectedRequestSpec, type InterceptorRequestSpec, type ModalOptions, type OnError, type OnSuccess, type Proof, type ProofPropertiesJSON, type ProofRequestOptions, type ProviderClaimData, type ProviderConfigResponse, type ProviderHashRequirementSpec, type ProviderHashRequirementsConfig, type ProviderHashRequirementsResponse, type ProviderVersionConfig, type ProviderVersionInfo, RECLAIM_EXTENSION_ACTIONS, type ReclaimFlowLaunchOptions, ReclaimProofRequest, type ReclaimProviderConfig, type ReclaimProviderConfigWithRequestSpec, type RequestSpec, type ResponseMatchSpec, type ResponseRedactionSpec, type SerializableModalOptions, SessionStatus, type SignedClaim, type StartSessionParams, type StatusUrlResponse, type TeeAttestation, TeeVerificationError, type TemplateData, type TrustedData, type UpdateSessionResponse, type ValidationConfig, type ValidationConfigWithDisabledValidation, type ValidationConfigWithHash, type ValidationConfigWithProviderInformation, type VerificationConfig, type VerifyProofResult, type WitnessData, assertValidProofsByHash, assertValidateProof, assertVerifiedProof, clearDeviceCache, createLinkWithTemplateData, createSignDataForClaim, fetchProviderConfigs, fetchProviderHashRequirementsBy, fetchStatusUrl, generateSpecsFromRequestSpecTemplate, getAttestors, getDeviceType, getHttpProviderClaimParamsFromProof, getIdentifierFromClaimInfo, getMobileDeviceType, getProviderHashRequirementSpecFromProviderConfig, getProviderHashRequirementsFromSpec, getProviderParamsAsCanonicalizedString, getShortenedUrl, hashProofClaimParams, hashRequestSpec, initSession, isDesktopDevice, isHttpProviderClaimParams, isMobileDevice, recoverSignersOfSignedClaim, takePairsWhereValueIsArray, takeTemplateParametersFromProofs, transformForOnchain, updateSession, verifyProof, verifyTeeAttestation };
|
|
1483
|
+
export { type Beacon, type BeaconState, type BodySniff, ClaimCreationType, type ClaimID, type ClaimInfo, type CompleteClaimData, type Context, type CreateVerificationRequest, DeviceType, type EmbeddedFlowHandle, type ExtensionMessage, type FlowHandle, type HashRequirement, type HashableHttpProviderClaimParams, type HttpFormEntry, type HttpProviderClaimParams, type HttpRedirectionMethod, type HttpRedirectionOptions, type InitSessionResponse, type InjectedRequestSpec, type InterceptorRequestSpec, type ModalOptions, type OnError, type OnSuccess, type Proof, type ProofPropertiesJSON, type ProofRequestOptions, type ProviderClaimData, type ProviderConfigResponse, type ProviderHashRequirementSpec, type ProviderHashRequirementsConfig, type ProviderHashRequirementsResponse, type ProviderVersionConfig, type ProviderVersionInfo, RECLAIM_EXTENSION_ACTIONS, type ReclaimFlowInitOptions, type ReclaimFlowLaunchOptions, ReclaimProofRequest, type ReclaimProviderConfig, type ReclaimProviderConfigWithRequestSpec, type RequestSpec, type ResponseMatchSpec, type ResponseRedactionSpec, type SerializableModalOptions, SessionStatus, type SignedClaim, type StartSessionParams, type StatusUrlResponse, type TeeAttestation, TeeVerificationError, type TemplateData, type TrustedData, type UpdateSessionResponse, type ValidationConfig, type ValidationConfigWithDisabledValidation, type ValidationConfigWithHash, type ValidationConfigWithProviderInformation, type VerificationConfig, type VerifyProofResult, type WitnessData, assertValidProofsByHash, assertValidateProof, assertVerifiedProof, clearDeviceCache, createLinkWithTemplateData, createSignDataForClaim, fetchProviderConfigs, fetchProviderHashRequirementsBy, fetchStatusUrl, generateSpecsFromRequestSpecTemplate, getAttestors, getDeviceType, getHttpProviderClaimParamsFromProof, getIdentifierFromClaimInfo, getMobileDeviceType, getProviderHashRequirementSpecFromProviderConfig, getProviderHashRequirementsFromSpec, getProviderParamsAsCanonicalizedString, getShortenedUrl, hashProofClaimParams, hashRequestSpec, initSession, isDesktopDevice, isHttpProviderClaimParams, isMobileDevice, recoverSignersOfSignedClaim, takePairsWhereValueIsArray, takeTemplateParametersFromProofs, transformForOnchain, updateSession, verifyProof, verifyTeeAttestation };
|
package/dist/index.js
CHANGED
|
@@ -84,7 +84,7 @@ var require_package = __commonJS({
|
|
|
84
84
|
"package.json"(exports2, module2) {
|
|
85
85
|
module2.exports = {
|
|
86
86
|
name: "@reclaimprotocol/js-sdk",
|
|
87
|
-
version: "5.0.0-dev.
|
|
87
|
+
version: "5.0.0-dev.5",
|
|
88
88
|
description: "Designed to request proofs from the Reclaim protocol and manage the flow of claims and witness interactions.",
|
|
89
89
|
main: "dist/index.js",
|
|
90
90
|
types: "dist/index.d.ts",
|
|
@@ -384,6 +384,10 @@ var constants = {
|
|
|
384
384
|
DEFAULT_PROVIDER_CONFIGS_URL(providerId, exactProviderVersionString, allowedTags) {
|
|
385
385
|
return `${BACKEND_BASE_URL}/api/providers/${providerId}/configs?versionNumber=${exactProviderVersionString || ""}&allowedTags=${(allowedTags == null ? void 0 : allowedTags.join(",")) || ""}`;
|
|
386
386
|
},
|
|
387
|
+
// Default portal URL
|
|
388
|
+
DEFAULT_PORTAL_URL: "https://portal.reclaimprotocol.org",
|
|
389
|
+
// Default sharepage URL
|
|
390
|
+
DEFAULT_APP_SHARE_PAGE_URL: "https://share.reclaimprotocol.org/verifier",
|
|
387
391
|
// URL for sharing Reclaim templates
|
|
388
392
|
RECLAIM_SHARE_URL: "https://share.reclaimprotocol.org/verifier/?template=",
|
|
389
393
|
// Chrome extension URL for Reclaim Protocol
|
|
@@ -2451,7 +2455,7 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
|
|
|
2451
2455
|
this.intervals = /* @__PURE__ */ new Map();
|
|
2452
2456
|
this.jsonProofResponse = false;
|
|
2453
2457
|
this.extensionID = "reclaim-extension";
|
|
2454
|
-
this.appSharePageUrl =
|
|
2458
|
+
this.appSharePageUrl = constants.DEFAULT_APP_SHARE_PAGE_URL;
|
|
2455
2459
|
this.FAILURE_TIMEOUT = 30 * 1e3;
|
|
2456
2460
|
/**
|
|
2457
2461
|
* Validates signature and returns template data
|
|
@@ -2502,7 +2506,7 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
|
|
|
2502
2506
|
};
|
|
2503
2507
|
return templateData;
|
|
2504
2508
|
};
|
|
2505
|
-
var _a
|
|
2509
|
+
var _a;
|
|
2506
2510
|
this.providerId = providerId;
|
|
2507
2511
|
this.timeStamp = Date.now().toString();
|
|
2508
2512
|
this.applicationId = applicationId;
|
|
@@ -2521,9 +2525,9 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
|
|
|
2521
2525
|
if (options.useAppClip === void 0) {
|
|
2522
2526
|
options.useAppClip = false;
|
|
2523
2527
|
}
|
|
2524
|
-
const customUrl =
|
|
2525
|
-
this.customSharePageUrl = customUrl
|
|
2526
|
-
if (customUrl) {
|
|
2528
|
+
const customUrl = options.portalUrl || options.customSharePageUrl;
|
|
2529
|
+
this.customSharePageUrl = customUrl || constants.DEFAULT_PORTAL_URL;
|
|
2530
|
+
if (customUrl && customUrl !== constants.DEFAULT_PORTAL_URL) {
|
|
2527
2531
|
this.appSharePageUrl = customUrl;
|
|
2528
2532
|
}
|
|
2529
2533
|
options.customSharePageUrl = this.customSharePageUrl;
|
|
@@ -3372,7 +3376,7 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
|
|
|
3372
3376
|
getRequestUrl(launchOptions) {
|
|
3373
3377
|
return __async(this, null, function* () {
|
|
3374
3378
|
var _a, _b, _c;
|
|
3375
|
-
const options =
|
|
3379
|
+
const options = __spreadValues(__spreadValues({}, (_a = this.options) == null ? void 0 : _a.launchOptions), launchOptions);
|
|
3376
3380
|
const mode = (_b = options.verificationMode) != null ? _b : "portal";
|
|
3377
3381
|
logger10.info("Creating Request Url");
|
|
3378
3382
|
if (!this.signature) {
|
|
@@ -3447,7 +3451,7 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
|
|
|
3447
3451
|
triggerReclaimFlow(launchOptions) {
|
|
3448
3452
|
return __async(this, null, function* () {
|
|
3449
3453
|
var _a, _b, _c, _d, _e;
|
|
3450
|
-
const options =
|
|
3454
|
+
const options = __spreadValues(__spreadValues({}, (_a = this.options) == null ? void 0 : _a.launchOptions), launchOptions);
|
|
3451
3455
|
const mode = (_b = options.verificationMode) != null ? _b : "portal";
|
|
3452
3456
|
if (!this.signature) {
|
|
3453
3457
|
throw new SignatureNotFoundError("Signature is not set.");
|
|
@@ -3458,11 +3462,11 @@ var ReclaimProofRequest = class _ReclaimProofRequest {
|
|
|
3458
3462
|
logger10.info(`Triggering Reclaim flow (mode: ${mode})`);
|
|
3459
3463
|
const deviceType = getDeviceType();
|
|
3460
3464
|
updateSession(this.sessionId, "SESSION_STARTED" /* SESSION_STARTED */);
|
|
3461
|
-
if ("target" in
|
|
3465
|
+
if (launchOptions && "target" in launchOptions && !launchOptions.target) {
|
|
3462
3466
|
logger10.warn("triggerReclaimFlow: target was provided but is null/undefined \u2014 falling back to default flow. Ensure the element exists in the DOM.");
|
|
3463
3467
|
}
|
|
3464
|
-
if (
|
|
3465
|
-
yield this.embedPortalIframe(templateData,
|
|
3468
|
+
if ((launchOptions == null ? void 0 : launchOptions.target) && mode === "portal") {
|
|
3469
|
+
yield this.embedPortalIframe(templateData, launchOptions.target);
|
|
3466
3470
|
return {
|
|
3467
3471
|
close: () => this.closeEmbeddedFlow(),
|
|
3468
3472
|
iframe: this.portalIframe
|