@receiz/sdk 93.1.0 → 94.0.0
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 +95 -0
- package/dist/identity.d.ts +172 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +853 -0
- package/dist/index.d.ts +554 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +452 -1
- package/docs/app-registration-token-lifecycle.md +1 -1
- package/docs/identity-login-and-recovery.md +122 -0
- package/docs/proof-memory-and-projections.md +127 -0
- package/package.json +1 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Proof Memory And Projections
|
|
2
|
+
|
|
3
|
+
The Receiz SDK gives developer apps the same default shape Receiz uses internally:
|
|
4
|
+
|
|
5
|
+
```txt
|
|
6
|
+
verify proof object -> project immediately -> admit into durable proof memory -> append verified additions
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
The SDK is convenience. It is not authority. The authority remains the sealed artifact, proof bundle, verified append, ownership append, and settlement ledger record.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @receiz/sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Project A Proof Object
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { projectReceizAssetManifest } from "@receiz/sdk";
|
|
21
|
+
|
|
22
|
+
const projection = projectReceizAssetManifest(manifest);
|
|
23
|
+
|
|
24
|
+
render({
|
|
25
|
+
title: projection.title,
|
|
26
|
+
subtitle: projection.subtitle,
|
|
27
|
+
mediaUrl: projection.mediaUrl,
|
|
28
|
+
verifyUrl: projection.verifyUrl,
|
|
29
|
+
rows: projection.rows,
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Projection is deterministic display preparation. It does not verify the artifact by itself. Verify first when the manifest comes from an untrusted transport.
|
|
34
|
+
|
|
35
|
+
## Project A Sports Card
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { projectReceizSportsCardManifest } from "@receiz/sdk";
|
|
39
|
+
|
|
40
|
+
const projection = projectReceizSportsCardManifest(cardManifest);
|
|
41
|
+
|
|
42
|
+
renderSportsCard({
|
|
43
|
+
player: projection.title,
|
|
44
|
+
value: projection.valueLabel,
|
|
45
|
+
score: projection.scoreLabel,
|
|
46
|
+
proofRows: projection.rows,
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The projection keeps card identity, claim hash, ownership, value basis, append summary, and event proof summary together. Do not split those into unrelated app models.
|
|
51
|
+
|
|
52
|
+
## Admit Once, Append Forever
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { createReceizProofRegister } from "@receiz/sdk";
|
|
56
|
+
|
|
57
|
+
const memory = createReceizProofRegister({ ownerId: currentUserId });
|
|
58
|
+
|
|
59
|
+
memory.admitAssetManifest(assetManifest);
|
|
60
|
+
memory.admitSportsCardManifest(cardManifest);
|
|
61
|
+
memory.admitWebhookEvent(webhookEvent);
|
|
62
|
+
|
|
63
|
+
const snapshot = memory.snapshot();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Persist `snapshot` in your app storage. On next open, reconstruct memory from `snapshot.entries` and render it immediately:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
const memory = createReceizProofRegister(savedSnapshot);
|
|
70
|
+
const knownTruth = memory.entries();
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Then ask Receiz for verified additions after your known head. Do not ask whether known proof is still true.
|
|
74
|
+
|
|
75
|
+
## Receiz Account Restore Boundary
|
|
76
|
+
|
|
77
|
+
Receiz Key, Identity Record, and Identity Seal restore use the same law inside Receiz itself. Current restore artifacts carry `receiz.account.state.v3`, which includes profile/account state, action ledger, calendar events, wallet settlement rows and notes, Sports vault cards, pack purchases, card appends, event proofs, entries, competitions, and tournament state.
|
|
78
|
+
|
|
79
|
+
That private identity artifact is stronger than a later API response. Restore projects the carried account proof memory first; server/database sync may only mirror missing rows or append verified additions the artifact does not possess. It must not rediscover old truth before use.
|
|
80
|
+
|
|
81
|
+
Developer apps should apply the same pattern with SDK proof memory: store admitted proof objects locally, paint from that known prefix immediately, then request additions after the known head. The SDK does not mint private Receiz login images or keys; it gives external apps the same admit-once, append-forever operating model.
|
|
82
|
+
|
|
83
|
+
## Duplicate Transport Is Safe
|
|
84
|
+
|
|
85
|
+
If the same proof object arrives again through another transport, the register keeps the first admitted payload and only fills missing fields. This prevents a weaker partial response from dropping known truth.
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
memory.admitAssetManifest(fullManifest);
|
|
89
|
+
memory.admitAssetManifest(partialManifest);
|
|
90
|
+
|
|
91
|
+
const retained = memory.snapshot().entries[0];
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This is intentional. Receiz proof memory is not `newest response wins`.
|
|
95
|
+
|
|
96
|
+
## Runtime Schema Exports
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { RECEIZ_SCHEMAS } from "@receiz/sdk";
|
|
100
|
+
|
|
101
|
+
const assetManifestSchema = RECEIZ_SCHEMAS.assetManifest;
|
|
102
|
+
const sportsCardSchema = RECEIZ_SCHEMAS.sportsCardManifest;
|
|
103
|
+
const webhookEventSchema = RECEIZ_SCHEMAS.webhookEvent;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The schemas are packaged for docs, validation UIs, generated forms, test fixtures, and developer tooling. Runtime validators remain available as:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import {
|
|
110
|
+
assertReceizAssetManifest,
|
|
111
|
+
assertReceizSportsCardManifest,
|
|
112
|
+
assertReceizWebhookEvent,
|
|
113
|
+
} from "@receiz/sdk";
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Production Rule
|
|
117
|
+
|
|
118
|
+
Use this order in every integration:
|
|
119
|
+
|
|
120
|
+
1. Verify stronger proof truth when bytes come from an untrusted transport.
|
|
121
|
+
2. Validate the manifest or event shape.
|
|
122
|
+
3. Project display-ready rows from the verified object.
|
|
123
|
+
4. Admit the object into proof memory.
|
|
124
|
+
5. Persist the proof memory snapshot.
|
|
125
|
+
6. Append later verified additions without rediscovering known truth.
|
|
126
|
+
|
|
127
|
+
This gives users truthful first paint and gives developers a simple integration that stays aligned with Receiz primitives.
|
package/package.json
CHANGED