@reclaimprotocol/client 0.1.29 → 0.1.32
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 +255 -234
- package/lib/api.d.ts +2 -0
- package/lib/api.js +2 -0
- package/lib/client.js +2 -0
- package/lib/enckeys.d.ts +1 -1
- package/lib/enckeys.js +2 -2
- package/lib/encoding.d.ts +4 -0
- package/lib/encoding.js +10 -0
- package/lib/feature-flags.d.ts +9 -0
- package/lib/feature-flags.js +19 -0
- package/lib/index.d.ts +4 -4
- package/lib/index.js +4 -4
- package/lib/jwks.d.ts +8 -8
- package/lib/jwks.js +38 -17
- package/lib/launch/destination.d.ts +14 -0
- package/lib/launch/destination.js +89 -0
- package/lib/launch/device.d.ts +30 -0
- package/lib/launch/device.js +168 -0
- package/lib/launch/environment.d.ts +224 -0
- package/lib/launch/environment.js +98 -0
- package/lib/launch/errors.d.ts +20 -0
- package/lib/launch/errors.js +25 -0
- package/lib/launch/extension.d.ts +42 -0
- package/lib/launch/extension.js +72 -0
- package/lib/launch/flow.d.ts +82 -0
- package/lib/launch/flow.js +222 -0
- package/lib/launch/index.d.ts +16 -0
- package/lib/launch/index.js +12 -0
- package/lib/launch/mobile.d.ts +77 -0
- package/lib/launch/mobile.js +124 -0
- package/lib/launch/modal.d.ts +50 -0
- package/lib/launch/modal.js +258 -0
- package/lib/launch/options.d.ts +74 -0
- package/lib/launch/options.js +20 -0
- package/lib/launch/portal.d.ts +28 -0
- package/lib/launch/portal.js +68 -0
- package/lib/launch/qr.d.ts +5 -0
- package/lib/launch/qr.js +28 -0
- package/lib/launch/target.d.ts +46 -0
- package/lib/launch/target.js +128 -0
- package/lib/launch/vendor/qrcodegen.d.ts +134 -0
- package/lib/launch/vendor/qrcodegen.js +822 -0
- package/lib/legacy-proof.d.ts +2 -0
- package/lib/legacy-proof.js +37 -7
- package/lib/proof-hash.d.ts +5 -5
- package/lib/proof-hash.js +1 -1
- package/lib/proof-recipe.d.ts +3 -3
- package/lib/proof-recipe.js +1 -1
- package/lib/proof-types.d.ts +35 -8
- package/lib/reclaim.d.ts +81 -70
- package/lib/reclaim.js +79 -130
- package/lib/request-proof.d.ts +60 -0
- package/lib/request-proof.js +241 -0
- package/lib/result.d.ts +46 -38
- package/lib/result.js +160 -100
- package/lib/routes.gen.d.ts +76 -28
- package/lib/routes.gen.js +24 -11
- package/lib/tee-binding.d.ts +1 -1
- package/lib/types/openapi.d.ts +1 -0
- package/lib/types/openapi.gen.d.ts +1598 -485
- package/lib/types/openapi.gen.js +5 -0
- package/lib/verification-clients.d.ts +28 -14
- package/lib/verification-clients.js +31 -11
- package/lib/verify-attestor-tee.d.ts +19 -2
- package/lib/verify-attestor-tee.js +40 -4
- package/lib/verify-tee.d.ts +10 -1
- package/lib/verify-tee.js +34 -10
- package/package.json +5 -1
- package/src/api.ts +9 -0
- package/src/client.ts +2 -0
- package/src/enckeys.ts +2 -2
- package/src/encoding.ts +12 -0
- package/src/feature-flags.ts +39 -0
- package/src/index.ts +13 -14
- package/src/jwks.ts +52 -30
- package/src/launch/destination.ts +111 -0
- package/src/launch/device.ts +242 -0
- package/src/launch/environment.ts +337 -0
- package/src/launch/errors.ts +49 -0
- package/src/launch/extension.ts +124 -0
- package/src/launch/flow.ts +369 -0
- package/src/launch/index.ts +42 -0
- package/src/launch/mobile.ts +184 -0
- package/src/launch/modal.ts +378 -0
- package/src/launch/options.ts +99 -0
- package/src/launch/portal.ts +104 -0
- package/src/launch/qr.ts +37 -0
- package/src/launch/target.ts +150 -0
- package/src/launch/vendor/qrcodegen.ts +1034 -0
- package/src/proof-hash.ts +6 -6
- package/src/proof-recipe.ts +3 -3
- package/src/proof-types.ts +36 -8
- package/src/reclaim.ts +185 -218
- package/src/{legacy-proof.ts → request-proof.ts} +81 -36
- package/src/result.ts +238 -172
- package/src/routes.gen.ts +24 -11
- package/src/tee-binding.ts +1 -1
- package/src/types/openapi.gen.ts +1603 -485
- package/src/types/openapi.ts +3 -1
- package/src/verification-clients.ts +33 -19
- package/src/verify-attestor-tee.ts +66 -8
- package/src/verify-tee.ts +44 -13
- package/lib/api-client.d.ts +0 -31
- package/lib/api-client.js +0 -112
- package/lib/api-consts.d.ts +0 -4
- package/lib/api-consts.js +0 -4
- package/lib/api-errors.d.ts +0 -13
- package/lib/api-errors.js +0 -30
- package/lib/eip712.d.ts +0 -20
- package/lib/eip712.js +0 -108
package/src/proof-hash.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { keccak_256 } from '@noble/hashes/sha3.js'
|
|
2
2
|
import { canonicalJson as canonical } from './canonical.ts'
|
|
3
3
|
import { bytesToHex } from './encoding.ts'
|
|
4
|
-
import type { HashRequirement,
|
|
4
|
+
import type { HashRequirement, ReclaimRequestProof } from './proof-types.ts'
|
|
5
5
|
|
|
6
6
|
export interface HttpProofParams {
|
|
7
7
|
url: string
|
|
@@ -30,7 +30,7 @@ export interface ProofRequestSpec extends HttpProofParams {
|
|
|
30
30
|
templateParamsMode?: 'separate' | 'merge'
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/** Exact
|
|
33
|
+
/** Exact canonical HTTP-provider hashes, including optional matches. */
|
|
34
34
|
export function hashProofClaimParams(params: HttpProofParams): string[] {
|
|
35
35
|
return canonicalProofParams(params).map((serialized) => (
|
|
36
36
|
'0x' + bytesToHex(keccak_256(new TextEncoder().encode(serialized)))
|
|
@@ -38,7 +38,7 @@ export function hashProofClaimParams(params: HttpProofParams): string[] {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export function getHashFromProof(
|
|
41
|
-
proof:
|
|
41
|
+
proof: ReclaimRequestProof,
|
|
42
42
|
hasNoPii = false,
|
|
43
43
|
): string[] {
|
|
44
44
|
if(hasNoPii) {
|
|
@@ -74,7 +74,7 @@ export function hashRequestSpec(request: ProofRequestSpec): HashRequirement {
|
|
|
74
74
|
export function hashRequirementsFromSpecs(
|
|
75
75
|
requestData: ProofRequestSpec[],
|
|
76
76
|
allowedInjectedRequestData: ProofRequestSpec[],
|
|
77
|
-
proofs:
|
|
77
|
+
proofs: ReclaimRequestProof[],
|
|
78
78
|
): HashRequirement[] {
|
|
79
79
|
const templates = expandTemplates(
|
|
80
80
|
allowedInjectedRequestData,
|
|
@@ -84,7 +84,7 @@ export function hashRequirementsFromSpecs(
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export function assertValidProofHashes(
|
|
87
|
-
proofs:
|
|
87
|
+
proofs: ReclaimRequestProof[],
|
|
88
88
|
requirements: Array<string | HashRequirement>,
|
|
89
89
|
hasNoPii = false,
|
|
90
90
|
) {
|
|
@@ -251,7 +251,7 @@ function substitute(
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
function templateParametersFromProofs(proofs:
|
|
254
|
+
function templateParametersFromProofs(proofs: ReclaimRequestProof[]) {
|
|
255
255
|
const combined: Record<string, unknown> = {}
|
|
256
256
|
for(const proof of proofs) {
|
|
257
257
|
for(const raw of [proof.claimData.parameters, proof.claimData.context]) {
|
package/src/proof-recipe.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
hashRequirementsFromSpecs,
|
|
4
4
|
type ProofRequestSpec,
|
|
5
5
|
} from './proof-hash.ts'
|
|
6
|
-
import type {
|
|
6
|
+
import type { ReclaimRequestProof } from './proof-types.ts'
|
|
7
7
|
|
|
8
8
|
type RequestSelection = components['schemas']['RequestSelection']
|
|
9
9
|
type RequestSelectionTemplate =
|
|
@@ -19,12 +19,12 @@ export interface BuilderProofRecipe {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Derive the exact hash requirements consumed by
|
|
22
|
+
* Derive the exact hash requirements consumed by `verifyRequestProof` from a
|
|
23
23
|
* resolved Builder recipe. Builder's fixed requests are required once each.
|
|
24
24
|
*/
|
|
25
25
|
export function proofHashesFromBuilderRecipe(
|
|
26
26
|
recipe: BuilderProofRecipe,
|
|
27
|
-
proofs:
|
|
27
|
+
proofs: ReclaimRequestProof[],
|
|
28
28
|
) {
|
|
29
29
|
return hashRequirementsFromSpecs(
|
|
30
30
|
recipe.requests.map((request) => toRequestSpec(
|
package/src/proof-types.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
/** Exact
|
|
2
|
-
|
|
1
|
+
/** Exact proof structure for one verified request, carried inside Builder
|
|
2
|
+
* result envelopes. Every Verification Client — the in-app SDK, the browser
|
|
3
|
+
* extension, portals, and Builder's own client — emits this shape. */
|
|
4
|
+
export interface ReclaimRequestProof {
|
|
3
5
|
identifier: string
|
|
4
|
-
claimData:
|
|
6
|
+
claimData: RequestClaimData
|
|
5
7
|
signatures: string[]
|
|
6
|
-
witnesses:
|
|
8
|
+
witnesses: RequestWitness[]
|
|
7
9
|
extractedParameterValues: unknown
|
|
8
10
|
publicData?: unknown
|
|
9
11
|
taskId?: number
|
|
10
|
-
|
|
12
|
+
/** Client-specific legacy TEE data. Verification validates a supported
|
|
13
|
+
* representation only when TEE verification is requested. */
|
|
14
|
+
teeAttestation?: unknown
|
|
11
15
|
}
|
|
12
16
|
|
|
13
|
-
export interface
|
|
17
|
+
export interface RequestClaimData {
|
|
14
18
|
provider: string
|
|
15
19
|
parameters: string
|
|
16
20
|
owner: string
|
|
@@ -20,16 +24,40 @@ export interface LegacyClaimData {
|
|
|
20
24
|
epoch: number
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
export interface
|
|
27
|
+
export interface RequestWitness {
|
|
24
28
|
id: string
|
|
25
29
|
url: string
|
|
26
30
|
claimAttestation?: AttestorClaimAttestation
|
|
27
31
|
}
|
|
28
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Which kind of attestation a witness carries.
|
|
35
|
+
*
|
|
36
|
+
* `embedded-attestor` — the in-app SDK and the browser extension. The attestor
|
|
37
|
+
* signs the claim and, on a TEE run, may also return its own
|
|
38
|
+
* `attestation_report`.
|
|
39
|
+
*
|
|
40
|
+
* `confidential-space` — portals. The browser runtime signs the claim inside a
|
|
41
|
+
* GCP Confidential Space and returns `tee_attestation`, bound to the claim
|
|
42
|
+
* through `context.attestationNonce`.
|
|
43
|
+
*/
|
|
44
|
+
export type ClaimAttestationType = 'embedded-attestor' | 'confidential-space'
|
|
45
|
+
|
|
29
46
|
export interface AttestorClaimAttestation {
|
|
47
|
+
type: ClaimAttestationType
|
|
30
48
|
attestor_address: string
|
|
31
49
|
claim_signature: string
|
|
32
|
-
|
|
50
|
+
/** `embedded-attestor` only, and optional even then: the attestor's own GCP
|
|
51
|
+
* Confidential Space attestation (an RS256 JWT). Attestors in production
|
|
52
|
+
* sign claims without returning one, so a witness routinely carries only
|
|
53
|
+
* the address and the claim signature. */
|
|
54
|
+
attestation_report?: string
|
|
55
|
+
/** `confidential-space` only: the same payload legacy proofs carry in the
|
|
56
|
+
* proof's top-level `teeAttestation`, and typed the same way. It comes
|
|
57
|
+
* from an external producer and is preserved verbatim, so callers validate
|
|
58
|
+
* it at runtime — `verifyTeeAttestation` does — rather than trusting a
|
|
59
|
+
* shape the wire does not guarantee. */
|
|
60
|
+
tee_attestation?: unknown
|
|
33
61
|
}
|
|
34
62
|
|
|
35
63
|
export interface TeeAttestation {
|