@worldcoin/idkit-core 4.0.6 → 4.0.8
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/README.md +3 -3
- package/dist/idkit_wasm_bg.wasm +0 -0
- package/dist/index.cjs +51 -33
- package/dist/index.d.cts +20 -20
- package/dist/index.d.ts +20 -20
- package/dist/index.js +51 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,19 +56,19 @@ const request = await IDKit.request({
|
|
|
56
56
|
const qrUrl = request.connectorURI;
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
**Available presets:** `orbLegacy`, `documentLegacy`, `secureDocumentLegacy`, `
|
|
59
|
+
**Available presets:** `orbLegacy`, `documentLegacy`, `secureDocumentLegacy`, `selfieCheckLegacy`
|
|
60
60
|
|
|
61
61
|
Selfie check preset example:
|
|
62
62
|
|
|
63
63
|
```typescript
|
|
64
|
-
import { IDKit,
|
|
64
|
+
import { IDKit, selfieCheckLegacy } from "@worldcoin/idkit-core";
|
|
65
65
|
|
|
66
66
|
const request = await IDKit.request({
|
|
67
67
|
app_id: "app_xxxxx",
|
|
68
68
|
action: "my-action",
|
|
69
69
|
rp_context: rpContext,
|
|
70
70
|
allow_legacy_proofs: false,
|
|
71
|
-
}).preset(
|
|
71
|
+
}).preset(selfieCheckLegacy({ signal: "user-123" }));
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
## Handling the Result
|
package/dist/idkit_wasm_bg.wasm
CHANGED
|
Binary file
|
package/dist/index.cjs
CHANGED
|
@@ -2060,55 +2060,73 @@ var NativeVerifyError = class extends Error {
|
|
|
2060
2060
|
}
|
|
2061
2061
|
};
|
|
2062
2062
|
function nativeResultToIDKitResult(payload, config, signalHashes) {
|
|
2063
|
+
const p = payload;
|
|
2063
2064
|
const rpNonce = config.rp_context?.nonce ?? "";
|
|
2064
|
-
if ("responses" in
|
|
2065
|
-
const
|
|
2065
|
+
if ("responses" in p && Array.isArray(p.responses)) {
|
|
2066
|
+
const items = p.responses;
|
|
2067
|
+
if (p.session_id) {
|
|
2068
|
+
return {
|
|
2069
|
+
protocol_version: "4.0",
|
|
2070
|
+
nonce: p.nonce ?? rpNonce,
|
|
2071
|
+
action_description: p.action_description,
|
|
2072
|
+
session_id: p.session_id,
|
|
2073
|
+
responses: items.map((item) => ({
|
|
2074
|
+
identifier: item.identifier,
|
|
2075
|
+
signal_hash: signalHashes[item.identifier],
|
|
2076
|
+
proof: item.proof,
|
|
2077
|
+
session_nullifier: item.session_nullifier,
|
|
2078
|
+
issuer_schema_id: item.issuer_schema_id,
|
|
2079
|
+
expires_at_min: item.expires_at_min
|
|
2080
|
+
})),
|
|
2081
|
+
environment: config.environment ?? "production"
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2066
2084
|
return {
|
|
2067
|
-
protocol_version:
|
|
2068
|
-
nonce:
|
|
2069
|
-
action:
|
|
2070
|
-
action_description:
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2085
|
+
protocol_version: "4.0",
|
|
2086
|
+
nonce: p.nonce ?? rpNonce,
|
|
2087
|
+
action: p.action ?? config.action ?? "",
|
|
2088
|
+
action_description: p.action_description,
|
|
2089
|
+
responses: items.map((item) => ({
|
|
2090
|
+
identifier: item.identifier,
|
|
2091
|
+
signal_hash: signalHashes[item.identifier],
|
|
2092
|
+
proof: item.proof,
|
|
2093
|
+
nullifier: item.nullifier,
|
|
2094
|
+
issuer_schema_id: item.issuer_schema_id,
|
|
2095
|
+
expires_at_min: item.expires_at_min
|
|
2075
2096
|
})),
|
|
2076
|
-
environment:
|
|
2097
|
+
environment: config.environment ?? "production"
|
|
2077
2098
|
};
|
|
2078
2099
|
}
|
|
2079
|
-
if ("verifications" in
|
|
2080
|
-
const
|
|
2100
|
+
if ("verifications" in p && Array.isArray(p.verifications)) {
|
|
2101
|
+
const verifications = p.verifications;
|
|
2081
2102
|
return {
|
|
2082
|
-
protocol_version: "
|
|
2103
|
+
protocol_version: "3.0",
|
|
2083
2104
|
nonce: rpNonce,
|
|
2084
2105
|
action: config.action ?? "",
|
|
2085
|
-
responses:
|
|
2106
|
+
responses: verifications.map((v) => ({
|
|
2086
2107
|
identifier: v.verification_level,
|
|
2087
2108
|
signal_hash: v.signal_hash ?? signalHashes[v.verification_level],
|
|
2088
|
-
proof:
|
|
2089
|
-
nullifier: v.nullifier_hash,
|
|
2109
|
+
proof: v.proof,
|
|
2090
2110
|
merkle_root: v.merkle_root,
|
|
2091
|
-
|
|
2092
|
-
expires_at_min: 0
|
|
2111
|
+
nullifier: v.nullifier_hash
|
|
2093
2112
|
})),
|
|
2094
|
-
environment: "production"
|
|
2113
|
+
environment: config.environment ?? "production"
|
|
2095
2114
|
};
|
|
2096
2115
|
}
|
|
2097
|
-
const single = payload;
|
|
2098
2116
|
return {
|
|
2099
2117
|
protocol_version: "3.0",
|
|
2100
2118
|
nonce: rpNonce,
|
|
2101
2119
|
action: config.action ?? "",
|
|
2102
2120
|
responses: [
|
|
2103
2121
|
{
|
|
2104
|
-
identifier:
|
|
2105
|
-
signal_hash:
|
|
2106
|
-
proof:
|
|
2107
|
-
merkle_root:
|
|
2108
|
-
nullifier:
|
|
2122
|
+
identifier: p.verification_level,
|
|
2123
|
+
signal_hash: p.signal_hash ?? signalHashes[p.verification_level],
|
|
2124
|
+
proof: p.proof,
|
|
2125
|
+
merkle_root: p.merkle_root,
|
|
2126
|
+
nullifier: p.nullifier_hash
|
|
2109
2127
|
}
|
|
2110
2128
|
],
|
|
2111
|
-
environment: "production"
|
|
2129
|
+
environment: config.environment ?? "production"
|
|
2112
2130
|
};
|
|
2113
2131
|
}
|
|
2114
2132
|
|
|
@@ -2162,8 +2180,8 @@ function secureDocumentLegacy(opts = {}) {
|
|
|
2162
2180
|
function documentLegacy(opts = {}) {
|
|
2163
2181
|
return { type: "DocumentLegacy", signal: opts.signal };
|
|
2164
2182
|
}
|
|
2165
|
-
function
|
|
2166
|
-
return { type: "
|
|
2183
|
+
function selfieCheckLegacy(opts = {}) {
|
|
2184
|
+
return { type: "SelfieCheckLegacy", signal: opts.signal };
|
|
2167
2185
|
}
|
|
2168
2186
|
function createWasmBuilderFromConfig(config) {
|
|
2169
2187
|
if (!config.rp_context) {
|
|
@@ -2246,7 +2264,7 @@ var IDKitBuilder2 = class {
|
|
|
2246
2264
|
* Presets provide a simplified way to create requests with predefined
|
|
2247
2265
|
* credential configurations.
|
|
2248
2266
|
*
|
|
2249
|
-
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or
|
|
2267
|
+
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or selfieCheckLegacy()
|
|
2250
2268
|
* @returns A new IDKitRequest instance
|
|
2251
2269
|
*
|
|
2252
2270
|
* @example
|
|
@@ -2323,8 +2341,8 @@ var IDKit = {
|
|
|
2323
2341
|
secureDocumentLegacy,
|
|
2324
2342
|
/** Create a DocumentLegacy preset for World ID 3.0 legacy support */
|
|
2325
2343
|
documentLegacy,
|
|
2326
|
-
/** Create a
|
|
2327
|
-
|
|
2344
|
+
/** Create a SelfieCheckLegacy preset for face verification */
|
|
2345
|
+
selfieCheckLegacy
|
|
2328
2346
|
};
|
|
2329
2347
|
|
|
2330
2348
|
// src/lib/platform.ts
|
|
@@ -2371,4 +2389,4 @@ exports.isReactNative = isReactNative;
|
|
|
2371
2389
|
exports.isWeb = isWeb;
|
|
2372
2390
|
exports.orbLegacy = orbLegacy;
|
|
2373
2391
|
exports.secureDocumentLegacy = secureDocumentLegacy;
|
|
2374
|
-
exports.
|
|
2392
|
+
exports.selfieCheckLegacy = selfieCheckLegacy;
|
package/dist/index.d.cts
CHANGED
|
@@ -84,27 +84,31 @@ type IDKitSessionConfig = {
|
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
interface OrbLegacyPreset {
|
|
87
|
+
/** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
|
|
87
88
|
type: "OrbLegacy";
|
|
88
89
|
signal?: string;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
interface SecureDocumentLegacyPreset {
|
|
93
|
+
/** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
|
|
92
94
|
type: "SecureDocumentLegacy";
|
|
93
95
|
signal?: string;
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
interface DocumentLegacyPreset {
|
|
99
|
+
/** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
|
|
97
100
|
type: "DocumentLegacy";
|
|
98
101
|
signal?: string;
|
|
99
102
|
}
|
|
100
103
|
|
|
101
|
-
interface
|
|
104
|
+
interface SelfieCheckLegacyPreset {
|
|
105
|
+
/** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
|
|
102
106
|
/** Preview: Selfie Check is currently in preview. Contact us if you need it enabled. */
|
|
103
|
-
type: "
|
|
107
|
+
type: "SelfieCheckLegacy";
|
|
104
108
|
signal?: string;
|
|
105
109
|
}
|
|
106
110
|
|
|
107
|
-
type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset |
|
|
111
|
+
type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset;
|
|
108
112
|
|
|
109
113
|
|
|
110
114
|
|
|
@@ -339,8 +343,7 @@ interface IDKitRequest {
|
|
|
339
343
|
/**
|
|
340
344
|
* Creates an OrbLegacy preset for World ID 3.0 legacy support
|
|
341
345
|
*
|
|
342
|
-
* This preset
|
|
343
|
-
* Use this when you need backward compatibility with older World App versions.
|
|
346
|
+
* This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
|
|
344
347
|
*
|
|
345
348
|
* @param opts - Optional configuration with signal
|
|
346
349
|
* @returns An OrbLegacy preset
|
|
@@ -357,8 +360,7 @@ declare function orbLegacy(opts?: {
|
|
|
357
360
|
/**
|
|
358
361
|
* Creates a SecureDocumentLegacy preset for World ID 3.0 legacy support
|
|
359
362
|
*
|
|
360
|
-
* This preset
|
|
361
|
-
* Use this when you need backward compatibility with older World App versions.
|
|
363
|
+
* This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
|
|
362
364
|
*
|
|
363
365
|
* @param opts - Optional configuration with signal
|
|
364
366
|
* @returns A SecureDocumentLegacy preset
|
|
@@ -375,8 +377,7 @@ declare function secureDocumentLegacy(opts?: {
|
|
|
375
377
|
/**
|
|
376
378
|
* Creates a DocumentLegacy preset for World ID 3.0 legacy support
|
|
377
379
|
*
|
|
378
|
-
* This preset
|
|
379
|
-
* Use this when you need backward compatibility with older World App versions.
|
|
380
|
+
* This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
|
|
380
381
|
*
|
|
381
382
|
* @param opts - Optional configuration with signal
|
|
382
383
|
* @returns A DocumentLegacy preset
|
|
@@ -391,26 +392,25 @@ declare function documentLegacy(opts?: {
|
|
|
391
392
|
signal?: string;
|
|
392
393
|
}): DocumentLegacyPreset;
|
|
393
394
|
/**
|
|
394
|
-
* Creates a
|
|
395
|
+
* Creates a SelfieCheckLegacy preset for face verification
|
|
395
396
|
*
|
|
396
397
|
* Preview: Selfie Check is currently in preview.
|
|
397
398
|
* Contact us if you need it enabled.
|
|
398
399
|
*
|
|
399
|
-
* This preset
|
|
400
|
-
* In legacy compatibility fields, it maps to verification level "face".
|
|
400
|
+
* This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
|
|
401
401
|
*
|
|
402
402
|
* @param opts - Optional configuration with signal
|
|
403
|
-
* @returns A
|
|
403
|
+
* @returns A SelfieCheckLegacy preset
|
|
404
404
|
*
|
|
405
405
|
* @example
|
|
406
406
|
* ```typescript
|
|
407
407
|
* const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: false })
|
|
408
|
-
* .preset(
|
|
408
|
+
* .preset(selfieCheckLegacy({ signal: 'user-123' }))
|
|
409
409
|
* ```
|
|
410
410
|
*/
|
|
411
|
-
declare function
|
|
411
|
+
declare function selfieCheckLegacy(opts?: {
|
|
412
412
|
signal?: string;
|
|
413
|
-
}):
|
|
413
|
+
}): SelfieCheckLegacyPreset;
|
|
414
414
|
/**
|
|
415
415
|
* Builder for IDKit requests
|
|
416
416
|
*
|
|
@@ -440,7 +440,7 @@ declare class IDKitBuilder {
|
|
|
440
440
|
* Presets provide a simplified way to create requests with predefined
|
|
441
441
|
* credential configurations.
|
|
442
442
|
*
|
|
443
|
-
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or
|
|
443
|
+
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or selfieCheckLegacy()
|
|
444
444
|
* @returns A new IDKitRequest instance
|
|
445
445
|
*
|
|
446
446
|
* @example
|
|
@@ -520,8 +520,8 @@ declare const IDKit: {
|
|
|
520
520
|
secureDocumentLegacy: typeof secureDocumentLegacy;
|
|
521
521
|
/** Create a DocumentLegacy preset for World ID 3.0 legacy support */
|
|
522
522
|
documentLegacy: typeof documentLegacy;
|
|
523
|
-
/** Create a
|
|
524
|
-
|
|
523
|
+
/** Create a SelfieCheckLegacy preset for face verification */
|
|
524
|
+
selfieCheckLegacy: typeof selfieCheckLegacy;
|
|
525
525
|
};
|
|
526
526
|
|
|
527
527
|
/**
|
|
@@ -546,4 +546,4 @@ declare const isWeb: () => boolean;
|
|
|
546
546
|
*/
|
|
547
547
|
declare const isNode: () => boolean;
|
|
548
548
|
|
|
549
|
-
export { type AbiEncodedValue, type ConstraintNode, type CredentialRequestType, type CredentialType, type DocumentLegacyPreset, IDKit, type IDKitCompletionResult, type IDKitErrorCode, IDKitErrorCodes, type IDKitRequest, type IDKitRequestConfig, type IDKitResult, type IDKitResultSession, type IDKitSessionConfig, type OrbLegacyPreset, type Preset, type ResponseItemSession, type ResponseItemV3, type ResponseItemV4, type RpContext, type SecureDocumentLegacyPreset, type
|
|
549
|
+
export { type AbiEncodedValue, type ConstraintNode, type CredentialRequestType, type CredentialType, type DocumentLegacyPreset, IDKit, type IDKitCompletionResult, type IDKitErrorCode, IDKitErrorCodes, type IDKitRequest, type IDKitRequestConfig, type IDKitResult, type IDKitResultSession, type IDKitSessionConfig, type OrbLegacyPreset, type Preset, type ResponseItemSession, type ResponseItemV3, type ResponseItemV4, type RpContext, type SecureDocumentLegacyPreset, type SelfieCheckLegacyPreset, type Status$1 as Status, type WaitOptions, documentLegacy, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy };
|
package/dist/index.d.ts
CHANGED
|
@@ -84,27 +84,31 @@ type IDKitSessionConfig = {
|
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
interface OrbLegacyPreset {
|
|
87
|
+
/** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
|
|
87
88
|
type: "OrbLegacy";
|
|
88
89
|
signal?: string;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
interface SecureDocumentLegacyPreset {
|
|
93
|
+
/** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
|
|
92
94
|
type: "SecureDocumentLegacy";
|
|
93
95
|
signal?: string;
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
interface DocumentLegacyPreset {
|
|
99
|
+
/** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
|
|
97
100
|
type: "DocumentLegacy";
|
|
98
101
|
signal?: string;
|
|
99
102
|
}
|
|
100
103
|
|
|
101
|
-
interface
|
|
104
|
+
interface SelfieCheckLegacyPreset {
|
|
105
|
+
/** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
|
|
102
106
|
/** Preview: Selfie Check is currently in preview. Contact us if you need it enabled. */
|
|
103
|
-
type: "
|
|
107
|
+
type: "SelfieCheckLegacy";
|
|
104
108
|
signal?: string;
|
|
105
109
|
}
|
|
106
110
|
|
|
107
|
-
type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset |
|
|
111
|
+
type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset;
|
|
108
112
|
|
|
109
113
|
|
|
110
114
|
|
|
@@ -339,8 +343,7 @@ interface IDKitRequest {
|
|
|
339
343
|
/**
|
|
340
344
|
* Creates an OrbLegacy preset for World ID 3.0 legacy support
|
|
341
345
|
*
|
|
342
|
-
* This preset
|
|
343
|
-
* Use this when you need backward compatibility with older World App versions.
|
|
346
|
+
* This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
|
|
344
347
|
*
|
|
345
348
|
* @param opts - Optional configuration with signal
|
|
346
349
|
* @returns An OrbLegacy preset
|
|
@@ -357,8 +360,7 @@ declare function orbLegacy(opts?: {
|
|
|
357
360
|
/**
|
|
358
361
|
* Creates a SecureDocumentLegacy preset for World ID 3.0 legacy support
|
|
359
362
|
*
|
|
360
|
-
* This preset
|
|
361
|
-
* Use this when you need backward compatibility with older World App versions.
|
|
363
|
+
* This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
|
|
362
364
|
*
|
|
363
365
|
* @param opts - Optional configuration with signal
|
|
364
366
|
* @returns A SecureDocumentLegacy preset
|
|
@@ -375,8 +377,7 @@ declare function secureDocumentLegacy(opts?: {
|
|
|
375
377
|
/**
|
|
376
378
|
* Creates a DocumentLegacy preset for World ID 3.0 legacy support
|
|
377
379
|
*
|
|
378
|
-
* This preset
|
|
379
|
-
* Use this when you need backward compatibility with older World App versions.
|
|
380
|
+
* This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
|
|
380
381
|
*
|
|
381
382
|
* @param opts - Optional configuration with signal
|
|
382
383
|
* @returns A DocumentLegacy preset
|
|
@@ -391,26 +392,25 @@ declare function documentLegacy(opts?: {
|
|
|
391
392
|
signal?: string;
|
|
392
393
|
}): DocumentLegacyPreset;
|
|
393
394
|
/**
|
|
394
|
-
* Creates a
|
|
395
|
+
* Creates a SelfieCheckLegacy preset for face verification
|
|
395
396
|
*
|
|
396
397
|
* Preview: Selfie Check is currently in preview.
|
|
397
398
|
* Contact us if you need it enabled.
|
|
398
399
|
*
|
|
399
|
-
* This preset
|
|
400
|
-
* In legacy compatibility fields, it maps to verification level "face".
|
|
400
|
+
* This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
|
|
401
401
|
*
|
|
402
402
|
* @param opts - Optional configuration with signal
|
|
403
|
-
* @returns A
|
|
403
|
+
* @returns A SelfieCheckLegacy preset
|
|
404
404
|
*
|
|
405
405
|
* @example
|
|
406
406
|
* ```typescript
|
|
407
407
|
* const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: false })
|
|
408
|
-
* .preset(
|
|
408
|
+
* .preset(selfieCheckLegacy({ signal: 'user-123' }))
|
|
409
409
|
* ```
|
|
410
410
|
*/
|
|
411
|
-
declare function
|
|
411
|
+
declare function selfieCheckLegacy(opts?: {
|
|
412
412
|
signal?: string;
|
|
413
|
-
}):
|
|
413
|
+
}): SelfieCheckLegacyPreset;
|
|
414
414
|
/**
|
|
415
415
|
* Builder for IDKit requests
|
|
416
416
|
*
|
|
@@ -440,7 +440,7 @@ declare class IDKitBuilder {
|
|
|
440
440
|
* Presets provide a simplified way to create requests with predefined
|
|
441
441
|
* credential configurations.
|
|
442
442
|
*
|
|
443
|
-
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or
|
|
443
|
+
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or selfieCheckLegacy()
|
|
444
444
|
* @returns A new IDKitRequest instance
|
|
445
445
|
*
|
|
446
446
|
* @example
|
|
@@ -520,8 +520,8 @@ declare const IDKit: {
|
|
|
520
520
|
secureDocumentLegacy: typeof secureDocumentLegacy;
|
|
521
521
|
/** Create a DocumentLegacy preset for World ID 3.0 legacy support */
|
|
522
522
|
documentLegacy: typeof documentLegacy;
|
|
523
|
-
/** Create a
|
|
524
|
-
|
|
523
|
+
/** Create a SelfieCheckLegacy preset for face verification */
|
|
524
|
+
selfieCheckLegacy: typeof selfieCheckLegacy;
|
|
525
525
|
};
|
|
526
526
|
|
|
527
527
|
/**
|
|
@@ -546,4 +546,4 @@ declare const isWeb: () => boolean;
|
|
|
546
546
|
*/
|
|
547
547
|
declare const isNode: () => boolean;
|
|
548
548
|
|
|
549
|
-
export { type AbiEncodedValue, type ConstraintNode, type CredentialRequestType, type CredentialType, type DocumentLegacyPreset, IDKit, type IDKitCompletionResult, type IDKitErrorCode, IDKitErrorCodes, type IDKitRequest, type IDKitRequestConfig, type IDKitResult, type IDKitResultSession, type IDKitSessionConfig, type OrbLegacyPreset, type Preset, type ResponseItemSession, type ResponseItemV3, type ResponseItemV4, type RpContext, type SecureDocumentLegacyPreset, type
|
|
549
|
+
export { type AbiEncodedValue, type ConstraintNode, type CredentialRequestType, type CredentialType, type DocumentLegacyPreset, IDKit, type IDKitCompletionResult, type IDKitErrorCode, IDKitErrorCodes, type IDKitRequest, type IDKitRequestConfig, type IDKitResult, type IDKitResultSession, type IDKitSessionConfig, type OrbLegacyPreset, type Preset, type ResponseItemSession, type ResponseItemV3, type ResponseItemV4, type RpContext, type SecureDocumentLegacyPreset, type SelfieCheckLegacyPreset, type Status$1 as Status, type WaitOptions, documentLegacy, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy };
|
package/dist/index.js
CHANGED
|
@@ -2057,55 +2057,73 @@ var NativeVerifyError = class extends Error {
|
|
|
2057
2057
|
}
|
|
2058
2058
|
};
|
|
2059
2059
|
function nativeResultToIDKitResult(payload, config, signalHashes) {
|
|
2060
|
+
const p = payload;
|
|
2060
2061
|
const rpNonce = config.rp_context?.nonce ?? "";
|
|
2061
|
-
if ("responses" in
|
|
2062
|
-
const
|
|
2062
|
+
if ("responses" in p && Array.isArray(p.responses)) {
|
|
2063
|
+
const items = p.responses;
|
|
2064
|
+
if (p.session_id) {
|
|
2065
|
+
return {
|
|
2066
|
+
protocol_version: "4.0",
|
|
2067
|
+
nonce: p.nonce ?? rpNonce,
|
|
2068
|
+
action_description: p.action_description,
|
|
2069
|
+
session_id: p.session_id,
|
|
2070
|
+
responses: items.map((item) => ({
|
|
2071
|
+
identifier: item.identifier,
|
|
2072
|
+
signal_hash: signalHashes[item.identifier],
|
|
2073
|
+
proof: item.proof,
|
|
2074
|
+
session_nullifier: item.session_nullifier,
|
|
2075
|
+
issuer_schema_id: item.issuer_schema_id,
|
|
2076
|
+
expires_at_min: item.expires_at_min
|
|
2077
|
+
})),
|
|
2078
|
+
environment: config.environment ?? "production"
|
|
2079
|
+
};
|
|
2080
|
+
}
|
|
2063
2081
|
return {
|
|
2064
|
-
protocol_version:
|
|
2065
|
-
nonce:
|
|
2066
|
-
action:
|
|
2067
|
-
action_description:
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2082
|
+
protocol_version: "4.0",
|
|
2083
|
+
nonce: p.nonce ?? rpNonce,
|
|
2084
|
+
action: p.action ?? config.action ?? "",
|
|
2085
|
+
action_description: p.action_description,
|
|
2086
|
+
responses: items.map((item) => ({
|
|
2087
|
+
identifier: item.identifier,
|
|
2088
|
+
signal_hash: signalHashes[item.identifier],
|
|
2089
|
+
proof: item.proof,
|
|
2090
|
+
nullifier: item.nullifier,
|
|
2091
|
+
issuer_schema_id: item.issuer_schema_id,
|
|
2092
|
+
expires_at_min: item.expires_at_min
|
|
2072
2093
|
})),
|
|
2073
|
-
environment:
|
|
2094
|
+
environment: config.environment ?? "production"
|
|
2074
2095
|
};
|
|
2075
2096
|
}
|
|
2076
|
-
if ("verifications" in
|
|
2077
|
-
const
|
|
2097
|
+
if ("verifications" in p && Array.isArray(p.verifications)) {
|
|
2098
|
+
const verifications = p.verifications;
|
|
2078
2099
|
return {
|
|
2079
|
-
protocol_version: "
|
|
2100
|
+
protocol_version: "3.0",
|
|
2080
2101
|
nonce: rpNonce,
|
|
2081
2102
|
action: config.action ?? "",
|
|
2082
|
-
responses:
|
|
2103
|
+
responses: verifications.map((v) => ({
|
|
2083
2104
|
identifier: v.verification_level,
|
|
2084
2105
|
signal_hash: v.signal_hash ?? signalHashes[v.verification_level],
|
|
2085
|
-
proof:
|
|
2086
|
-
nullifier: v.nullifier_hash,
|
|
2106
|
+
proof: v.proof,
|
|
2087
2107
|
merkle_root: v.merkle_root,
|
|
2088
|
-
|
|
2089
|
-
expires_at_min: 0
|
|
2108
|
+
nullifier: v.nullifier_hash
|
|
2090
2109
|
})),
|
|
2091
|
-
environment: "production"
|
|
2110
|
+
environment: config.environment ?? "production"
|
|
2092
2111
|
};
|
|
2093
2112
|
}
|
|
2094
|
-
const single = payload;
|
|
2095
2113
|
return {
|
|
2096
2114
|
protocol_version: "3.0",
|
|
2097
2115
|
nonce: rpNonce,
|
|
2098
2116
|
action: config.action ?? "",
|
|
2099
2117
|
responses: [
|
|
2100
2118
|
{
|
|
2101
|
-
identifier:
|
|
2102
|
-
signal_hash:
|
|
2103
|
-
proof:
|
|
2104
|
-
merkle_root:
|
|
2105
|
-
nullifier:
|
|
2119
|
+
identifier: p.verification_level,
|
|
2120
|
+
signal_hash: p.signal_hash ?? signalHashes[p.verification_level],
|
|
2121
|
+
proof: p.proof,
|
|
2122
|
+
merkle_root: p.merkle_root,
|
|
2123
|
+
nullifier: p.nullifier_hash
|
|
2106
2124
|
}
|
|
2107
2125
|
],
|
|
2108
|
-
environment: "production"
|
|
2126
|
+
environment: config.environment ?? "production"
|
|
2109
2127
|
};
|
|
2110
2128
|
}
|
|
2111
2129
|
|
|
@@ -2159,8 +2177,8 @@ function secureDocumentLegacy(opts = {}) {
|
|
|
2159
2177
|
function documentLegacy(opts = {}) {
|
|
2160
2178
|
return { type: "DocumentLegacy", signal: opts.signal };
|
|
2161
2179
|
}
|
|
2162
|
-
function
|
|
2163
|
-
return { type: "
|
|
2180
|
+
function selfieCheckLegacy(opts = {}) {
|
|
2181
|
+
return { type: "SelfieCheckLegacy", signal: opts.signal };
|
|
2164
2182
|
}
|
|
2165
2183
|
function createWasmBuilderFromConfig(config) {
|
|
2166
2184
|
if (!config.rp_context) {
|
|
@@ -2243,7 +2261,7 @@ var IDKitBuilder2 = class {
|
|
|
2243
2261
|
* Presets provide a simplified way to create requests with predefined
|
|
2244
2262
|
* credential configurations.
|
|
2245
2263
|
*
|
|
2246
|
-
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or
|
|
2264
|
+
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), or selfieCheckLegacy()
|
|
2247
2265
|
* @returns A new IDKitRequest instance
|
|
2248
2266
|
*
|
|
2249
2267
|
* @example
|
|
@@ -2320,8 +2338,8 @@ var IDKit = {
|
|
|
2320
2338
|
secureDocumentLegacy,
|
|
2321
2339
|
/** Create a DocumentLegacy preset for World ID 3.0 legacy support */
|
|
2322
2340
|
documentLegacy,
|
|
2323
|
-
/** Create a
|
|
2324
|
-
|
|
2341
|
+
/** Create a SelfieCheckLegacy preset for face verification */
|
|
2342
|
+
selfieCheckLegacy
|
|
2325
2343
|
};
|
|
2326
2344
|
|
|
2327
2345
|
// src/lib/platform.ts
|
|
@@ -2355,4 +2373,4 @@ function isValidHex(s) {
|
|
|
2355
2373
|
return /^[0-9a-fA-F]+$/.test(s);
|
|
2356
2374
|
}
|
|
2357
2375
|
|
|
2358
|
-
export { IDKit, IDKitErrorCodes, documentLegacy, hashSignal2 as hashSignal, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy,
|
|
2376
|
+
export { IDKit, IDKitErrorCodes, documentLegacy, hashSignal2 as hashSignal, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy };
|