@uvrn/adapter 1.0.0 → 1.0.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/README.md +92 -0
- package/package.json +8 -2
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# @uvrn/adapter
|
|
2
|
+
|
|
3
|
+
UVRN DRVC3 envelope adapter — wraps Delta Engine receipts in DRVC3 envelopes with EIP-191 signatures. Use this when you need to attach issuer identity and signing to core receipts without changing their deterministic hash.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @uvrn/adapter
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or with pnpm:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @uvrn/adapter
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires `@uvrn/core` (peer). Install the core if you do not have it:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @uvrn/core @uvrn/adapter
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
1. Obtain a **DeltaReceipt** from `@uvrn/core` (e.g. `runDeltaEngine(bundle)`).
|
|
26
|
+
2. Use **wrapInDRVC3** with an ethers signer and options to produce a DRVC3 envelope.
|
|
27
|
+
3. Use **validateDRVC3** / **extractDeltaReceipt** to validate envelopes and read back the core receipt.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { runDeltaEngine } from '@uvrn/core';
|
|
31
|
+
import { wrapInDRVC3, validateDRVC3, extractDeltaReceipt } from '@uvrn/adapter';
|
|
32
|
+
import { Wallet } from 'ethers';
|
|
33
|
+
|
|
34
|
+
const bundle = { /* ... DeltaBundle ... */ };
|
|
35
|
+
const receipt = runDeltaEngine(bundle);
|
|
36
|
+
|
|
37
|
+
const wallet = new Wallet(process.env.SIGNER_PRIVATE_KEY);
|
|
38
|
+
const drvc3 = await wrapInDRVC3(receipt, wallet, {
|
|
39
|
+
issuer: 'my-service',
|
|
40
|
+
event: 'delta-reconciliation',
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const valid = validateDRVC3(drvc3);
|
|
44
|
+
const extracted = extractDeltaReceipt(drvc3);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Use cases
|
|
48
|
+
|
|
49
|
+
- **Sign receipts with a known identity** — Attach EIP-191 signatures so consumers can verify who issued the envelope.
|
|
50
|
+
- **Interop with DRVC3 systems** — Produce standard DRVC3 envelopes that other tools can validate and parse.
|
|
51
|
+
- **Audit and provenance** — Keep the core receipt hash unchanged while adding issuer and timestamp in the envelope.
|
|
52
|
+
|
|
53
|
+
## DRVC3 customization
|
|
54
|
+
|
|
55
|
+
### What you can customize
|
|
56
|
+
|
|
57
|
+
You can set these options when wrapping a receipt (no code changes to this package):
|
|
58
|
+
|
|
59
|
+
- **issuer** — Your service or org name (e.g. `'my-app'`, `'acme-corp'`).
|
|
60
|
+
- **event** — Event type (e.g. `'delta-reconciliation'`, `'price-attestation'`).
|
|
61
|
+
- **certificate** — Version or brand string (default `'DRVC3 v1.01'`; you can use e.g. `'MyCorp Receipt v1'`).
|
|
62
|
+
- **description**, **resource**, **replay_instructions**, **tags** — Optional metadata.
|
|
63
|
+
- **extensions** — Arbitrary key-value object for your own metadata (provenance, evidence links, etc.).
|
|
64
|
+
|
|
65
|
+
Example:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
const drvc3 = await wrapInDRVC3(receipt, wallet, {
|
|
69
|
+
issuer: 'acme-corp',
|
|
70
|
+
event: 'price-attestation',
|
|
71
|
+
certificate: 'Acme Receipt v1',
|
|
72
|
+
extensions: { source: 'https://acme.com/feed', region: 'us-east' },
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### What is fixed
|
|
77
|
+
|
|
78
|
+
The envelope **structure** is defined by the bundled DRVC3 schema (`schemas/drvc3.schema.json`). Required fields (e.g. `receipt_id`, `issuer`, `event`, `timestamp`, `integrity`, `block_state`, `certificate`, `validation.checks.delta_receipt`) cannot be changed when using `validateDRVC3`. There is no option to pass a different schema.
|
|
79
|
+
|
|
80
|
+
### Using a different envelope format
|
|
81
|
+
|
|
82
|
+
If you need a completely different envelope spec:
|
|
83
|
+
|
|
84
|
+
- **Fork this package** — Change the types, schema, wrapper, and validator in your own package and publish under your own scope.
|
|
85
|
+
- **Skip DRVC3** — Use `@uvrn/core` (and optionally `@uvrn/sdk`) only; build your own envelope format and signing/validation on top of the core receipt.
|
|
86
|
+
|
|
87
|
+
## Links
|
|
88
|
+
|
|
89
|
+
**Open source:** Source code and issues: [GitHub (uvrn-packages)](https://github.com/UVRN-org/uvrn-packages). Project landing: [UVRN](https://github.com/UVRN-org/uvrn).
|
|
90
|
+
|
|
91
|
+
- [Repository](https://github.com/UVRN-org/uvrn-packages) — monorepo (this package: `uvrn-adapter`)
|
|
92
|
+
- [@uvrn/core](https://www.npmjs.com/package/@uvrn/core) — Delta Engine core (produces the receipts this adapter wraps)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uvrn/adapter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "UVRN DRVC3 envelope adapter — wraps core receipts with EIP-191 signatures",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,11 +11,17 @@
|
|
|
11
11
|
"receipts"
|
|
12
12
|
],
|
|
13
13
|
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/UVRN-org/uvrn-packages.git",
|
|
17
|
+
"directory": "uvrn-adapter"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/UVRN-org/uvrn-packages#readme",
|
|
14
20
|
"dependencies": {
|
|
15
21
|
"ethers": "^6.0.0",
|
|
16
22
|
"ajv": "^8.12.0",
|
|
17
23
|
"ajv-formats": "^2.1.1",
|
|
18
|
-
"@uvrn/core": "1.0.
|
|
24
|
+
"@uvrn/core": "1.0.2"
|
|
19
25
|
},
|
|
20
26
|
"devDependencies": {
|
|
21
27
|
"@types/jest": "^29.5.0",
|