@celo/buy-identity 0.4.0 → 0.4.2
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 +1 -1
- package/dist/index.js +34 -3
- package/dist/index.js.map +2 -2
- package/dist/qr.d.ts +12 -0
- package/dist/receiver.d.ts +0 -8
- package/dist/types.d.ts +19 -1
- package/dist/verify.d.ts +21 -0
- package/package.json +2 -2
package/dist/qr.d.ts
CHANGED
|
@@ -7,3 +7,15 @@ export type QrRenderOptions = {
|
|
|
7
7
|
* displays.
|
|
8
8
|
*/
|
|
9
9
|
export declare function renderQrToTerminal(link: string, opts?: QrRenderOptions): Promise<string>;
|
|
10
|
+
/**
|
|
11
|
+
* A note to print beside a QR that will not fit the terminal.
|
|
12
|
+
*
|
|
13
|
+
* A Self verification QR is ~47 rows even at `small: true` — the link it
|
|
14
|
+
* encodes is ~660 characters — so a default 24-row terminal scrolls the top
|
|
15
|
+
* half away and leaves something that cannot be scanned. Nothing about the
|
|
16
|
+
* output says so: it simply does not work, and the reader has no idea why.
|
|
17
|
+
*
|
|
18
|
+
* Returns undefined when it fits, or when the height is unknown (not a TTY, so
|
|
19
|
+
* nobody is looking at it anyway).
|
|
20
|
+
*/
|
|
21
|
+
export declare function qrFitWarning(qr: string, rows?: number | undefined): string | undefined;
|
package/dist/receiver.d.ts
CHANGED
|
@@ -102,12 +102,4 @@ export type ProofReceiverOptions = {
|
|
|
102
102
|
*/
|
|
103
103
|
readonly reasonForClient?: (reason: string) => string;
|
|
104
104
|
};
|
|
105
|
-
/**
|
|
106
|
-
* A `RequestListener` that verifies Self proofs and hands them to `persist`.
|
|
107
|
-
*
|
|
108
|
-
* Mountable as a whole server (the CLI does) or delegated to from one route of
|
|
109
|
-
* a larger server (a gateway does). Rejections answer 200 with
|
|
110
|
-
* `{status:'error'}` rather than a 4xx, because that is the shape the Self app
|
|
111
|
-
* expects back.
|
|
112
|
-
*/
|
|
113
105
|
export declare function createProofReceiver(options: ProofReceiverOptions): RequestListener;
|
package/dist/types.d.ts
CHANGED
|
@@ -31,7 +31,15 @@ export type VerificationRequest = {
|
|
|
31
31
|
/** Public callback URL that Self mobile app POSTs the proof to. */
|
|
32
32
|
endpoint: string;
|
|
33
33
|
/** Whether to accept the mock-passport flow (staging only). */
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Which Self hub to verify against: false = mainnet (real passports),
|
|
36
|
+
* true = staging (mock passports), `'either'` = try both.
|
|
37
|
+
*
|
|
38
|
+
* `'either'` exists so one deployment can serve hackathon participants using
|
|
39
|
+
* mock passports alongside real users, which a single verifier cannot do —
|
|
40
|
+
* see `verifyProof`.
|
|
41
|
+
*/
|
|
42
|
+
mockPassport: boolean | 'either';
|
|
35
43
|
/** EVM address (hex) the proof is bound to. */
|
|
36
44
|
userId: string;
|
|
37
45
|
/** Requested disclosures + thresholds. */
|
|
@@ -79,6 +87,16 @@ export type VerificationResult = {
|
|
|
79
87
|
* to disagree about.
|
|
80
88
|
*/
|
|
81
89
|
userDefinedDataHex?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Which Self hub validated this proof: true = staging (mock passports),
|
|
92
|
+
* false = mainnet (real ones).
|
|
93
|
+
*
|
|
94
|
+
* Only interesting when the request said `'either'`, but always set, because
|
|
95
|
+
* the attestation must record the matching `endpointType` — re-verification
|
|
96
|
+
* picks its hub from that, and a mismatch fails with `InvalidRoot` on a proof
|
|
97
|
+
* that is perfectly valid.
|
|
98
|
+
*/
|
|
99
|
+
usedMockPassport?: boolean;
|
|
82
100
|
};
|
|
83
101
|
export type VerificationFailure = {
|
|
84
102
|
ok: false;
|
package/dist/verify.d.ts
CHANGED
|
@@ -26,6 +26,27 @@ export type ProofPayload = {
|
|
|
26
26
|
* `userDefinedDataHex`.
|
|
27
27
|
*/
|
|
28
28
|
export declare function decodeUserDefinedData(hex: string | undefined): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Verify against BOTH Self hubs when the caller will accept either.
|
|
31
|
+
*
|
|
32
|
+
* A `SelfBackendVerifier` is bound to one hub: `mockPassport` picks the RPC and
|
|
33
|
+
* the IdentityVerificationHub address, staging or mainnet. A mock passport
|
|
34
|
+
* registers its identity root on staging and a real one on mainnet, so a single
|
|
35
|
+
* verifier can only ever validate one of them — the other fails with
|
|
36
|
+
* `InvalidRoot: Onchain root does not exist`, an error about WHERE the root was
|
|
37
|
+
* looked for, not about the proof being bad.
|
|
38
|
+
*
|
|
39
|
+
* Trying both is what lets one deployment serve hackathon participants with
|
|
40
|
+
* mock passports and real users at the same time. It costs an extra hub read
|
|
41
|
+
* only on the miss, and it is safe because the two cannot be confused: the
|
|
42
|
+
* scope commitment is `hashEndpointWithScope(endpoint, scope)` — endpointType
|
|
43
|
+
* is NOT in it — so a proof that validates against a hub validates for this
|
|
44
|
+
* exact endpoint and scope regardless of which hub held its root.
|
|
45
|
+
*
|
|
46
|
+
* The hub that succeeded comes back as `usedMockPassport`, because the
|
|
47
|
+
* attestation has to record the matching `endpointType` or re-verification
|
|
48
|
+
* later would look in the wrong place.
|
|
49
|
+
*/
|
|
29
50
|
export declare function verifyProof(request: VerificationRequest, payload: ProofPayload): Promise<VerificationResult | VerificationFailure>;
|
|
30
51
|
/**
|
|
31
52
|
* Build a mock attestation result with no Self SDK calls. Used by `buy
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celo/buy-identity",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "buy identity — Self.xyz soft-KYC integration (off-chain proof verification + attestation cache)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"qrcode-terminal": "^0.12.0",
|
|
21
|
-
"@celo/buy-keystore": "0.4.
|
|
21
|
+
"@celo/buy-keystore": "0.4.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@selfxyz/core": "1.1.0-beta.7",
|