@red-isbe/isbe-service-did-registry 1.0.0 → 2.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 +82 -20
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/src/ServiceDidRegistryQueries.d.ts +54 -18
- package/dist/src/ServiceDidRegistryQueries.d.ts.map +1 -1
- package/dist/src/ServiceDidRegistryQueries.js +155 -51
- package/dist/src/ServiceDidRegistryQueries.js.map +1 -1
- package/dist/src/ServiceDidRegistryTransactions.d.ts +7 -0
- package/dist/src/ServiceDidRegistryTransactions.d.ts.map +1 -1
- package/dist/src/ServiceDidRegistryTransactions.js +9 -0
- package/dist/src/ServiceDidRegistryTransactions.js.map +1 -1
- package/dist/src/abi/IServiceDidRegistry.abi.d.ts +258 -2
- package/dist/src/abi/IServiceDidRegistry.abi.d.ts.map +1 -1
- package/dist/src/abi/IServiceDidRegistry.abi.js +338 -2
- package/dist/src/abi/IServiceDidRegistry.abi.js.map +1 -1
- package/dist/src/serviceDid.types.d.ts +25 -0
- package/dist/src/serviceDid.types.d.ts.map +1 -1
- package/dist/src/types.d.ts +10 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/blockchain.utils.d.ts +18 -0
- package/dist/src/utils/blockchain.utils.d.ts.map +1 -1
- package/dist/src/utils/blockchain.utils.js +69 -5
- package/dist/src/utils/blockchain.utils.js.map +1 -1
- package/dist/src/utils/serviceDocument.utils.d.ts +32 -6
- package/dist/src/utils/serviceDocument.utils.d.ts.map +1 -1
- package/dist/src/utils/serviceDocument.utils.js +124 -9
- package/dist/src/utils/serviceDocument.utils.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,8 @@ const tx = await new ServiceDidRegistryTransactions(context)
|
|
|
34
34
|
.buildRegisterServiceDidTx(controllerDid, publicKey, 1, "billing pipeline", 0, from);
|
|
35
35
|
|
|
36
36
|
// …the caller signs it, broadcasts it, and then:
|
|
37
|
-
const
|
|
37
|
+
const { didDocument, didDocumentMetadata } =
|
|
38
|
+
await new ServiceDidRegistryQueries(context).resolve(serviceDid);
|
|
38
39
|
```
|
|
39
40
|
|
|
40
41
|
Every write builder returns the transaction fields and stops there. `from` is used only to
|
|
@@ -46,8 +47,8 @@ on-chain, from the signature.
|
|
|
46
47
|
| | |
|
|
47
48
|
|---|---|
|
|
48
49
|
| `ServiceDidRegistryContext` | Provider, Diamond address, network discriminator and curve |
|
|
49
|
-
| `ServiceDidRegistryTransactions` | `buildRegisterServiceDidTx`, `buildUpdateServiceDocumentTx`, `buildRotateSigningKeyTx`, `buildUpdateExpiryTx`, `buildDeactivateServiceDidTx`, `buildInitializeServiceDidRegistryTx` |
|
|
50
|
-
| `ServiceDidRegistryQueries` | `getServiceDid`, `getServiceDocument`, `getServiceDidsByController`, `isServiceDidActive`, `signingKeyAddressOf`, `computeServiceDid`, `toDidDocumentW3C` |
|
|
50
|
+
| `ServiceDidRegistryTransactions` | `buildRegisterServiceDidTx`, `buildUpdateServiceDocumentTx`, `buildRotateSigningKeyTx`, `buildUpdateExpiryTx`, `buildDeactivateServiceDidTx`, `buildInitializeServiceDidRegistryTx`, `buildIndexServiceDidsByAddressTx`. They throw `ContractRevertError` when the call would revert |
|
|
51
|
+
| `ServiceDidRegistryQueries` | `getServiceDid`, `getServiceDocument`, `getServiceDidsByController`, `isServiceDidActive`, `signingKeyAddressOf`, `serviceDidOf`, `isKnownServiceDid`, `serviceDidsOf`, `computeServiceDid`, `toDidDocumentW3C`, `resolve` |
|
|
51
52
|
| `ServiceDidTransactionExecutor` | Broadcasts a signed transaction and waits for its receipt |
|
|
52
53
|
| Derivation helpers | `buildServiceDid`, `parseServiceDid`, `computeServiceDidHex`, `serviceDidToHex`, `signingKeyAddress`, `toUncompressedPublicKey` |
|
|
53
54
|
|
|
@@ -59,15 +60,32 @@ carry any fields its organisation wants, as one JSON object:
|
|
|
59
60
|
```ts
|
|
60
61
|
await transactions.buildRegisterServiceDidTx(
|
|
61
62
|
controllerDid, publicKey, 1, "billing pipeline", 0, from,
|
|
62
|
-
{
|
|
63
|
+
{
|
|
64
|
+
name: "Billing",
|
|
65
|
+
service: [
|
|
66
|
+
{ id: "#api", type: "InvoicingAPI", serviceEndpoint: "https://billing.example.com/v2" },
|
|
67
|
+
],
|
|
68
|
+
},
|
|
63
69
|
);
|
|
64
|
-
await transactions.buildUpdateServiceDocumentTx(serviceDid, { serviceEndpoint: "https://new.example.com" }, from);
|
|
65
70
|
```
|
|
66
71
|
|
|
67
72
|
It is stored on-chain and `toDidDocumentW3C` adds its fields to the DID Document. It may
|
|
68
73
|
not set the members the registry derives (`RESERVED_DOCUMENT_KEYS`: `id`, `controller`,
|
|
69
|
-
the keys and relationships
|
|
70
|
-
in the chain history. An update replaces the whole document;
|
|
74
|
+
the keys and relationships, `deactivated`, `reason`), it must fit in 4096 bytes, and it
|
|
75
|
+
is public and permanent in the chain history. An update replaces the whole document;
|
|
76
|
+
`null` clears it.
|
|
77
|
+
|
|
78
|
+
Two members follow DID Core and are checked when the document is built:
|
|
79
|
+
|
|
80
|
+
- `service` is a list of entries with `id`, `type` and `serviceEndpoint` (§5.4). An `id`
|
|
81
|
+
may be relative (`#api`); the resolver expands it to `did:isbe:svc:…#api`. Ids must be
|
|
82
|
+
unique; if two expand to the same id, the DID document keeps the first.
|
|
83
|
+
- `@context` may add JSON-LD contexts for the extra fields, as absolute http(s) URLs.
|
|
84
|
+
They go after the two the registry always puts first.
|
|
85
|
+
|
|
86
|
+
`getServiceDocument` returns the stored members as they are, minus the reserved ones,
|
|
87
|
+
so a read, edit and write-back never loses data silently. Entries that break these
|
|
88
|
+
rules (written without this library) are left out of the DID document only.
|
|
71
89
|
|
|
72
90
|
## The identifier
|
|
73
91
|
|
|
@@ -84,23 +102,48 @@ halves of that translation.
|
|
|
84
102
|
|
|
85
103
|
## Resolution
|
|
86
104
|
|
|
87
|
-
`toDidDocumentW3C` produces a W3C DID Document
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
105
|
+
`toDidDocumentW3C` produces a W3C DID Document with the same shape as an organisational
|
|
106
|
+
one from `@red-isbe/did-isbe-registry`:
|
|
107
|
+
|
|
108
|
+
- `@context`: `https://www.w3.org/ns/did/v1` and `https://w3id.org/security/suites/jws-2020/v1`;
|
|
109
|
+
- `controller`: the organisational DID;
|
|
110
|
+
- one `JsonWebKey2020` with the key in `publicKeyJwk`, on either curve;
|
|
111
|
+
- the method id is the DID plus the RFC 7638 thumbprint of the key, the same id `did-gen`
|
|
112
|
+
prints for an organisational key;
|
|
113
|
+
- `authentication` and `assertionMethod` point at that key.
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"@context": ["https://www.w3.org/ns/did/v1", "https://w3id.org/security/suites/jws-2020/v1"],
|
|
118
|
+
"id": "did:isbe:svc:uc:z1Ms…:3",
|
|
119
|
+
"controller": ["did:isbe:uc:z1Ms…"],
|
|
120
|
+
"verificationMethod": [{
|
|
121
|
+
"id": "did:isbe:svc:uc:z1Ms…:3#9lfZ28jd…",
|
|
122
|
+
"type": "JsonWebKey2020",
|
|
123
|
+
"controller": "did:isbe:svc:uc:z1Ms…:3",
|
|
124
|
+
"publicKeyJwk": { "kty": "EC", "crv": "secp256k1", "x": "…", "y": "…" }
|
|
125
|
+
}],
|
|
126
|
+
"authentication": ["did:isbe:svc:uc:z1Ms…:3#9lfZ28jd…"],
|
|
127
|
+
"assertionMethod": ["did:isbe:svc:uc:z1Ms…:3#9lfZ28jd…"],
|
|
128
|
+
"name": "Billing",
|
|
129
|
+
"service": [{ "id": "did:isbe:svc:uc:z1Ms…:3#api", "type": "InvoicingAPI", "serviceEndpoint": "https://billing.example.com/v2" }]
|
|
130
|
+
}
|
|
131
|
+
```
|
|
92
132
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
organisational registry is not this library's job:
|
|
133
|
+
Whether the identity is still valid is not part of the document. DID Core puts it in the
|
|
134
|
+
document metadata (§7.1.3), which `resolve` returns next to the document:
|
|
96
135
|
|
|
97
136
|
```ts
|
|
98
|
-
|
|
137
|
+
const { didDocument, didDocumentMetadata } =
|
|
138
|
+
await queries.resolve(serviceDid, { isControllerActive, now });
|
|
139
|
+
// didDocumentMetadata: { created, updated?, deactivated, reason? }
|
|
99
140
|
```
|
|
100
141
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
142
|
+
`deactivated` is `true` when the service was deactivated, has expired, or its controlling
|
|
143
|
+
organisation is no longer operative; `reason` says which — `deactivated`, `expired` or
|
|
144
|
+
`controller-inactive`. The cascade of the organisation is evaluated only if the caller
|
|
145
|
+
supplies `isControllerActive`, because reading the organisational registry is not this
|
|
146
|
+
library's job.
|
|
104
147
|
|
|
105
148
|
## Relationship with `@red-isbe/did-isbe-registry`
|
|
106
149
|
|
|
@@ -114,13 +157,32 @@ service registered through one package would become unresolvable through the oth
|
|
|
114
157
|
nothing failing loudly. `src/utils/__test__/did.utils.test.ts` pins the behaviour with
|
|
115
158
|
vectors read from the DEV network, not computed by the functions themselves.
|
|
116
159
|
|
|
160
|
+
## Search by address
|
|
161
|
+
|
|
162
|
+
Which service identity does an address sign for? The registry keeps an index by address,
|
|
163
|
+
the counterpart of `didOf` in the organisational registry, so the answer is one read:
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
// The active service that address signs for, or null
|
|
167
|
+
const serviceDid = await queries.serviceDidOf("0x4f6A…");
|
|
168
|
+
|
|
169
|
+
// Every non-deactivated service whose current key is that address
|
|
170
|
+
const records = await queries.serviceDidsOf("0x4f6A…");
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`serviceDidOf` also applies the cascade of the organisation: if it no longer holds a
|
|
174
|
+
capability invocation in force, the answer is `null`. Only the current key matches:
|
|
175
|
+
after a rotation the old address no longer finds the service. Needs a registry with the
|
|
176
|
+
address index; services registered before it are found once the admin has run
|
|
177
|
+
`indexServiceDidsByAddress` (`buildIndexServiceDidsByAddressTx`).
|
|
178
|
+
|
|
117
179
|
## Tests
|
|
118
180
|
|
|
119
181
|
```bash
|
|
120
182
|
npm test
|
|
121
183
|
```
|
|
122
184
|
|
|
123
|
-
|
|
185
|
+
77 tests across two suites. The ESM one exists because `multiformats` is ESM-only and the
|
|
124
186
|
base58 encoding has to be exercised for real, not mocked.
|
|
125
187
|
|
|
126
188
|
## Requirement
|
package/dist/index.d.ts
CHANGED
|
@@ -14,13 +14,15 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export { ServiceDidRegistryContext } from "./src/ServiceDidRegistryContext.js";
|
|
17
|
-
export { ServiceDidRegistryQueries } from "./src/ServiceDidRegistryQueries.js";
|
|
17
|
+
export { ServiceDidRegistryQueries, SERVICE_DID_DOCUMENT_CONTEXT, } from "./src/ServiceDidRegistryQueries.js";
|
|
18
|
+
export type { ResolveServiceDidOptions } from "./src/ServiceDidRegistryQueries.js";
|
|
18
19
|
export { ServiceDidRegistryTransactions } from "./src/ServiceDidRegistryTransactions.js";
|
|
19
20
|
export { ServiceDidTransactionExecutor } from "./src/ServiceDidTransactionExecutor.js";
|
|
20
|
-
export type { ServiceDidRecord, ServiceDidParts, ServiceDidInactiveReason, GetServiceDidsByControllerResult, } from "./src/serviceDid.types.js";
|
|
21
|
-
export type { DidW3CDocument } from "./src/types.js";
|
|
21
|
+
export type { ServiceDidRecord, ServiceDidParts, ServiceDidInactiveReason, GetServiceDidsByControllerResult, ServiceDidDocumentMetadata, ServiceDidResolutionResult, } from "./src/serviceDid.types.js";
|
|
22
|
+
export type { DidService, DidW3CDocument } from "./src/types.js";
|
|
22
23
|
export { MAX_SERVICE_DOCUMENT_BYTES, RESERVED_DOCUMENT_KEYS, ServiceDocumentError, parseServiceDocument, serializeServiceDocument, } from "./src/utils/serviceDocument.utils.js";
|
|
23
24
|
export type { ServiceDocument } from "./src/utils/serviceDocument.utils.js";
|
|
24
25
|
export { buildServiceDid, parseServiceDid, serviceDidToHex, computeServiceDidHex, signingKeyAddress, toUncompressedPublicKey, } from "./src/utils/serviceDid.utils.js";
|
|
25
26
|
export { didToHex, hexToDid } from "./src/utils/did.utils.js";
|
|
27
|
+
export { ContractRevertError } from "./src/utils/blockchain.utils.js";
|
|
26
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EACL,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAEvF,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,gCAAgC,EAChC,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAI9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export { ServiceDidRegistryContext } from "./src/ServiceDidRegistryContext.js";
|
|
17
|
-
export { ServiceDidRegistryQueries } from "./src/ServiceDidRegistryQueries.js";
|
|
17
|
+
export { ServiceDidRegistryQueries, SERVICE_DID_DOCUMENT_CONTEXT, } from "./src/ServiceDidRegistryQueries.js";
|
|
18
18
|
export { ServiceDidRegistryTransactions } from "./src/ServiceDidRegistryTransactions.js";
|
|
19
19
|
export { ServiceDidTransactionExecutor } from "./src/ServiceDidTransactionExecutor.js";
|
|
20
20
|
export { MAX_SERVICE_DOCUMENT_BYTES, RESERVED_DOCUMENT_KEYS, ServiceDocumentError, parseServiceDocument, serializeServiceDocument, } from "./src/utils/serviceDocument.utils.js";
|
|
@@ -23,4 +23,7 @@ export { buildServiceDid, parseServiceDid, serviceDidToHex, computeServiceDidHex
|
|
|
23
23
|
// paquete comparte con @red-isbe/did-isbe-registry, y tenerla accesible permite
|
|
24
24
|
// comprobar desde fuera que ambas implementaciones coinciden.
|
|
25
25
|
export { didToHex, hexToDid } from "./src/utils/did.utils.js";
|
|
26
|
+
// Lanzado al construir una transacción que revertiría; mismo error que la librería de
|
|
27
|
+
// organizaciones, para tratar los de ambos registros igual.
|
|
28
|
+
export { ContractRevertError } from "./src/utils/blockchain.utils.js";
|
|
26
29
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EACL,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAWvF,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,iCAAiC,CAAC;AAEzC,sFAAsF;AACtF,gFAAgF;AAChF,8DAA8D;AAC9D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAE9D,sFAAsF;AACtF,4DAA4D;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -16,12 +16,17 @@
|
|
|
16
16
|
import { parseServiceDid, serviceDidToHex } from "./utils/serviceDid.utils.js";
|
|
17
17
|
import { ServiceDidRegistryContext } from "./ServiceDidRegistryContext.js";
|
|
18
18
|
import { type ServiceDocument } from "./utils/serviceDocument.utils.js";
|
|
19
|
-
import type { GetServiceDidsByControllerResult,
|
|
19
|
+
import type { GetServiceDidsByControllerResult, ServiceDidRecord, ServiceDidResolutionResult } from "./serviceDid.types.js";
|
|
20
20
|
import type { DidW3CDocument } from "./types.js";
|
|
21
21
|
/** secp256k1, the curve the Case network operates on. */
|
|
22
22
|
export declare const ELLIPTIC_TYPE_SECP256K1 = 1;
|
|
23
23
|
/** P-256, the curve the Bare network operates on. */
|
|
24
24
|
export declare const ELLIPTIC_TYPE_P256 = 2;
|
|
25
|
+
/**
|
|
26
|
+
* Contexts every service DID Document starts with: DID Core, then the suite that
|
|
27
|
+
* defines `JsonWebKey2020`. The same pair the organisational registry publishes.
|
|
28
|
+
*/
|
|
29
|
+
export declare const SERVICE_DID_DOCUMENT_CONTEXT: readonly string[];
|
|
25
30
|
/**
|
|
26
31
|
* Options for resolving a service identity into a W3C DID Document.
|
|
27
32
|
*/
|
|
@@ -64,12 +69,34 @@ export declare class ServiceDidRegistryQueries {
|
|
|
64
69
|
* comes back alongside the page — which is why there is no separate count call.
|
|
65
70
|
*/
|
|
66
71
|
getServiceDidsByController(controllerDid: string, page?: number, pageSize?: number): Promise<GetServiceDidsByControllerResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Resolves an address to the service identity it currently signs for, the
|
|
74
|
+
* counterpart of `didOf` in the organisational registry.
|
|
75
|
+
*
|
|
76
|
+
* One read of the registry's address index, whatever the number of organisations.
|
|
77
|
+
* Returns `null` when nothing usable is found: no service holds a key deriving the
|
|
78
|
+
* address, every such service is deactivated or expired, or their organisation no
|
|
79
|
+
* longer holds a capability invocation in force (the registry applies that cascade
|
|
80
|
+
* itself here). When several services of one organisation share the key, the most
|
|
81
|
+
* recently registered active one is returned.
|
|
82
|
+
*
|
|
83
|
+
* Needs a registry with the address index; against an older one the call fails.
|
|
84
|
+
*/
|
|
85
|
+
serviceDidOf(address: string): Promise<string | null>;
|
|
86
|
+
/** The counterpart of `isKnownDid`: true when `serviceDidOf` finds a service. */
|
|
87
|
+
isKnownServiceDid(address: string): Promise<boolean>;
|
|
88
|
+
/**
|
|
89
|
+
* Every service identity whose current key derives `address`, read from the address
|
|
90
|
+
* index. Deactivated identities are not indexed; expired ones are, and the cascade
|
|
91
|
+
* of the organisation is not applied. Needs a registry with the address index.
|
|
92
|
+
*/
|
|
93
|
+
serviceDidsOf(address: string): Promise<ServiceDidRecord[]>;
|
|
67
94
|
/**
|
|
68
95
|
* Reports whether a service identity is usable right now.
|
|
69
96
|
*
|
|
70
97
|
* False for an unknown identifier as well as for one deactivated or past its expiry,
|
|
71
98
|
* so it never throws. It does not evaluate the parent: that cascade belongs to
|
|
72
|
-
* `
|
|
99
|
+
* `resolve`.
|
|
73
100
|
*/
|
|
74
101
|
isServiceDidActive(serviceDid: string): Promise<boolean>;
|
|
75
102
|
/**
|
|
@@ -90,25 +117,34 @@ export declare class ServiceDidRegistryQueries {
|
|
|
90
117
|
/**
|
|
91
118
|
* Resolves a service identity into a W3C DID Document.
|
|
92
119
|
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* The verification method depends on the curve, not on the network: a key on the
|
|
99
|
-
* network's own curve yields `EcdsaSecp256k1RecoveryMethod2020` with a
|
|
100
|
-
* `blockchainAccountId`, and any other curve yields `JsonWebKey2020` carrying the
|
|
101
|
-
* coordinates. Emitting a `blockchainAccountId` for a key no account can use would
|
|
102
|
-
* point a verifier at an address that can never sign.
|
|
120
|
+
* The document has the same shape as an organisational one from
|
|
121
|
+
* `@red-isbe/did-isbe-registry`: the same `@context`, a `JsonWebKey2020` with the key
|
|
122
|
+
* in `publicKeyJwk` whatever the curve, and a method id made of the DID and the RFC
|
|
123
|
+
* 7638 thumbprint of the key — the same id `did-gen` gives an organisational key.
|
|
103
124
|
*
|
|
104
125
|
* The service's free-form fields, if any, are added to the document. They can never
|
|
105
|
-
* override what the registry asserts: the identifier, the controller
|
|
106
|
-
*
|
|
126
|
+
* override what the registry asserts: the identifier, the controller and the keys
|
|
127
|
+
* always come from the record. A `service` entry with a relative id (`#api`) is
|
|
128
|
+
* expanded against the service DID, and any `@context` the document declares is
|
|
129
|
+
* appended after the two the registry puts first.
|
|
130
|
+
*
|
|
131
|
+
* Whether the identity is still valid is not part of the document: DID Core puts it
|
|
132
|
+
* in the document metadata, which `resolve` returns.
|
|
133
|
+
*/
|
|
134
|
+
toDidDocumentW3C(serviceDid: string): Promise<DidW3CDocument>;
|
|
135
|
+
/**
|
|
136
|
+
* Resolves a service identity into a DID resolution result: the document plus its
|
|
137
|
+
* metadata (DID Core §7.1).
|
|
138
|
+
*
|
|
139
|
+
* Three things can make an identity no longer valid, and they are checked in this
|
|
140
|
+
* order: it was deactivated, it passed its expiry, or its controlling organisation
|
|
141
|
+
* stopped being operative. The last one is only evaluated when the caller supplies
|
|
142
|
+
* `isControllerActive`. Any of them sets `deactivated: true` in the metadata, with
|
|
143
|
+
* the `reason`; the document is returned all the same, as DID Core allows.
|
|
107
144
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}>;
|
|
145
|
+
resolve(serviceDid: string, options?: ResolveServiceDidOptions): Promise<ServiceDidResolutionResult>;
|
|
146
|
+
/** Reads a service identity by its on-chain digest. */
|
|
147
|
+
private getServiceDidByHex;
|
|
112
148
|
/** Derives the identifier a controller and nonce produce, without a network call. */
|
|
113
149
|
computeServiceDid(controllerDid: string, nonce: bigint | number): string;
|
|
114
150
|
private inactiveReason;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceDidRegistryQueries.d.ts","sourceRoot":"","sources":["../../src/ServiceDidRegistryQueries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;
|
|
1
|
+
{"version":3,"file":"ServiceDidRegistryQueries.d.ts","sourceRoot":"","sources":["../../src/ServiceDidRegistryQueries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAIF,OAAO,EAEL,eAAe,EACf,eAAe,EAEhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EACV,gCAAgC,EAGhC,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,u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;;;OAKG;IACG,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAY7E;;;;;;;;;;;;;;;;OAgBG;IACG,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMnE;;;;;;;;;OASG;IACG,OAAO,CACX,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,0BAA0B,CAAC;IAoBtC,uDAAuD;YACzC,kBAAkB;IAShC,qFAAqF;IACrF,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;YAI1D,cAAc;IAkB5B,OAAO,CAAC,aAAa;IAuDrB;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ;CAsBjB;AAED,wFAAwF;AACxF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -13,14 +13,23 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { getAddress, sha256, toUtf8Bytes } from "ethers";
|
|
16
17
|
import { didToHex, hexToDid } from "./utils/did.utils.js";
|
|
17
18
|
import { buildServiceDid, parseServiceDid, serviceDidToHex, signingKeyAddress, } from "./utils/serviceDid.utils.js";
|
|
18
19
|
import { ServiceDidRegistryContext } from "./ServiceDidRegistryContext.js";
|
|
19
|
-
import { parseServiceDocument, } from "./utils/serviceDocument.utils.js";
|
|
20
|
+
import { hasOwnKey, parseServiceDocument, publishableServiceDocument, } from "./utils/serviceDocument.utils.js";
|
|
20
21
|
/** secp256k1, the curve the Case network operates on. */
|
|
21
22
|
export const ELLIPTIC_TYPE_SECP256K1 = 1;
|
|
22
23
|
/** P-256, the curve the Bare network operates on. */
|
|
23
24
|
export const ELLIPTIC_TYPE_P256 = 2;
|
|
25
|
+
/**
|
|
26
|
+
* Contexts every service DID Document starts with: DID Core, then the suite that
|
|
27
|
+
* defines `JsonWebKey2020`. The same pair the organisational registry publishes.
|
|
28
|
+
*/
|
|
29
|
+
export const SERVICE_DID_DOCUMENT_CONTEXT = [
|
|
30
|
+
"https://www.w3.org/ns/did/v1",
|
|
31
|
+
"https://w3id.org/security/suites/jws-2020/v1",
|
|
32
|
+
];
|
|
24
33
|
/**
|
|
25
34
|
* Read surface of the Service DID Registry, and the resolver for the
|
|
26
35
|
* `did:isbe:svc:` sub-namespace.
|
|
@@ -70,12 +79,47 @@ export class ServiceDidRegistryQueries {
|
|
|
70
79
|
next: decoded[4].toString(),
|
|
71
80
|
};
|
|
72
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Resolves an address to the service identity it currently signs for, the
|
|
84
|
+
* counterpart of `didOf` in the organisational registry.
|
|
85
|
+
*
|
|
86
|
+
* One read of the registry's address index, whatever the number of organisations.
|
|
87
|
+
* Returns `null` when nothing usable is found: no service holds a key deriving the
|
|
88
|
+
* address, every such service is deactivated or expired, or their organisation no
|
|
89
|
+
* longer holds a capability invocation in force (the registry applies that cascade
|
|
90
|
+
* itself here). When several services of one organisation share the key, the most
|
|
91
|
+
* recently registered active one is returned.
|
|
92
|
+
*
|
|
93
|
+
* Needs a registry with the address index; against an older one the call fails.
|
|
94
|
+
*/
|
|
95
|
+
async serviceDidOf(address) {
|
|
96
|
+
const fn = this.configManager.contract["serviceDidOf"];
|
|
97
|
+
const hex = await fn(getAddress(address));
|
|
98
|
+
if (/^0x0{64}$/.test(hex))
|
|
99
|
+
return null;
|
|
100
|
+
return (await this.getServiceDidByHex(hex)).serviceDid;
|
|
101
|
+
}
|
|
102
|
+
/** The counterpart of `isKnownDid`: true when `serviceDidOf` finds a service. */
|
|
103
|
+
async isKnownServiceDid(address) {
|
|
104
|
+
const fn = this.configManager.contract["isKnownServiceDid"];
|
|
105
|
+
return await fn(getAddress(address));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Every service identity whose current key derives `address`, read from the address
|
|
109
|
+
* index. Deactivated identities are not indexed; expired ones are, and the cascade
|
|
110
|
+
* of the organisation is not applied. Needs a registry with the address index.
|
|
111
|
+
*/
|
|
112
|
+
async serviceDidsOf(address) {
|
|
113
|
+
const fn = this.configManager.contract["serviceDidsOf"];
|
|
114
|
+
const ids = Array.from(await fn(getAddress(address))).map(String);
|
|
115
|
+
return await Promise.all(ids.map((id) => this.getServiceDidByHex(id)));
|
|
116
|
+
}
|
|
73
117
|
/**
|
|
74
118
|
* Reports whether a service identity is usable right now.
|
|
75
119
|
*
|
|
76
120
|
* False for an unknown identifier as well as for one deactivated or past its expiry,
|
|
77
121
|
* so it never throws. It does not evaluate the parent: that cascade belongs to
|
|
78
|
-
* `
|
|
122
|
+
* `resolve`.
|
|
79
123
|
*/
|
|
80
124
|
async isServiceDidActive(serviceDid) {
|
|
81
125
|
const fn = this.configManager.contract["isServiceDidActive"];
|
|
@@ -112,28 +156,60 @@ export class ServiceDidRegistryQueries {
|
|
|
112
156
|
/**
|
|
113
157
|
* Resolves a service identity into a W3C DID Document.
|
|
114
158
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* The verification method depends on the curve, not on the network: a key on the
|
|
121
|
-
* network's own curve yields `EcdsaSecp256k1RecoveryMethod2020` with a
|
|
122
|
-
* `blockchainAccountId`, and any other curve yields `JsonWebKey2020` carrying the
|
|
123
|
-
* coordinates. Emitting a `blockchainAccountId` for a key no account can use would
|
|
124
|
-
* point a verifier at an address that can never sign.
|
|
159
|
+
* The document has the same shape as an organisational one from
|
|
160
|
+
* `@red-isbe/did-isbe-registry`: the same `@context`, a `JsonWebKey2020` with the key
|
|
161
|
+
* in `publicKeyJwk` whatever the curve, and a method id made of the DID and the RFC
|
|
162
|
+
* 7638 thumbprint of the key — the same id `did-gen` gives an organisational key.
|
|
125
163
|
*
|
|
126
164
|
* The service's free-form fields, if any, are added to the document. They can never
|
|
127
|
-
* override what the registry asserts: the identifier, the controller
|
|
128
|
-
*
|
|
165
|
+
* override what the registry asserts: the identifier, the controller and the keys
|
|
166
|
+
* always come from the record. A `service` entry with a relative id (`#api`) is
|
|
167
|
+
* expanded against the service DID, and any `@context` the document declares is
|
|
168
|
+
* appended after the two the registry puts first.
|
|
169
|
+
*
|
|
170
|
+
* Whether the identity is still valid is not part of the document: DID Core puts it
|
|
171
|
+
* in the document metadata, which `resolve` returns.
|
|
129
172
|
*/
|
|
130
|
-
async toDidDocumentW3C(serviceDid
|
|
173
|
+
async toDidDocumentW3C(serviceDid) {
|
|
174
|
+
const record = await this.getServiceDid(serviceDid);
|
|
175
|
+
const extra = await this.getServiceDocument(serviceDid);
|
|
176
|
+
return this.buildDocument(record, extra);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Resolves a service identity into a DID resolution result: the document plus its
|
|
180
|
+
* metadata (DID Core §7.1).
|
|
181
|
+
*
|
|
182
|
+
* Three things can make an identity no longer valid, and they are checked in this
|
|
183
|
+
* order: it was deactivated, it passed its expiry, or its controlling organisation
|
|
184
|
+
* stopped being operative. The last one is only evaluated when the caller supplies
|
|
185
|
+
* `isControllerActive`. Any of them sets `deactivated: true` in the metadata, with
|
|
186
|
+
* the `reason`; the document is returned all the same, as DID Core allows.
|
|
187
|
+
*/
|
|
188
|
+
async resolve(serviceDid, options = {}) {
|
|
131
189
|
const record = await this.getServiceDid(serviceDid);
|
|
132
190
|
const extra = await this.getServiceDocument(serviceDid);
|
|
133
|
-
// Spread first, so every member the registry derives is written over it.
|
|
134
|
-
const document = { ...(extra ?? {}), ...(await this.buildDocument(record)) };
|
|
135
191
|
const reason = await this.inactiveReason(record, options);
|
|
136
|
-
|
|
192
|
+
const changed = BigInt(record.updatedAt) > BigInt(record.registeredAt);
|
|
193
|
+
const metadata = {
|
|
194
|
+
created: toXmlDateTime(record.registeredAt),
|
|
195
|
+
...(changed && { updated: toXmlDateTime(record.updatedAt) }),
|
|
196
|
+
deactivated: reason !== undefined,
|
|
197
|
+
...(reason && { reason }),
|
|
198
|
+
};
|
|
199
|
+
return {
|
|
200
|
+
didDocument: this.buildDocument(record, extra),
|
|
201
|
+
didDocumentMetadata: metadata,
|
|
202
|
+
didResolutionMetadata: { contentType: "application/did+ld+json" },
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/** Reads a service identity by its on-chain digest. */
|
|
206
|
+
async getServiceDidByHex(serviceDidHex) {
|
|
207
|
+
const iface = this.configManager.contract.interface;
|
|
208
|
+
const data = iface.encodeFunctionData("getServiceDid", [serviceDidHex]);
|
|
209
|
+
const addr = await this.configManager.contract.getAddress();
|
|
210
|
+
const raw = await this.configManager.provider.call({ to: addr, data });
|
|
211
|
+
const [record] = iface.decodeFunctionResult("getServiceDid", raw);
|
|
212
|
+
return this.toRecord(record);
|
|
137
213
|
}
|
|
138
214
|
/** Derives the identifier a controller and nonce produce, without a network call. */
|
|
139
215
|
computeServiceDid(controllerDid, nonce) {
|
|
@@ -153,44 +229,50 @@ export class ServiceDidRegistryQueries {
|
|
|
153
229
|
}
|
|
154
230
|
return undefined;
|
|
155
231
|
}
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
controller: record.serviceDid,
|
|
168
|
-
blockchainAccountId: `eip155:${(await this.configManager.provider.getNetwork()).chainId.toString()}:${record.signingKeyAddress}`,
|
|
169
|
-
}
|
|
170
|
-
: {
|
|
171
|
-
id: keyId,
|
|
172
|
-
type: "JsonWebKey2020",
|
|
173
|
-
controller: record.serviceDid,
|
|
174
|
-
publicKeyJwk: {
|
|
175
|
-
kty: "EC",
|
|
176
|
-
crv: record.ellipticType === ELLIPTIC_TYPE_P256
|
|
177
|
-
? "P-256"
|
|
178
|
-
: "secp256k1",
|
|
179
|
-
x: hexToBase64Url(record.pubKeyX),
|
|
180
|
-
y: hexToBase64Url(record.pubKeyY),
|
|
181
|
-
},
|
|
182
|
-
};
|
|
183
|
-
const suiteContext = onNetworkCurve
|
|
184
|
-
? "https://w3id.org/security/suites/secp256k1recovery-2020/v2"
|
|
185
|
-
: "https://w3id.org/security/suites/jws-2020/v1";
|
|
186
|
-
return {
|
|
187
|
-
"@context": ["https://www.w3.org/ns/did/v1", suiteContext],
|
|
232
|
+
buildDocument(record, extra) {
|
|
233
|
+
const publicKeyJwk = {
|
|
234
|
+
kty: "EC",
|
|
235
|
+
crv: record.ellipticType === ELLIPTIC_TYPE_P256 ? "P-256" : "secp256k1",
|
|
236
|
+
x: hexToBase64Url(record.pubKeyX),
|
|
237
|
+
y: hexToBase64Url(record.pubKeyY),
|
|
238
|
+
};
|
|
239
|
+
const keyId = `${record.serviceDid}#${jwkThumbprint(publicKeyJwk)}`;
|
|
240
|
+
const { "@context": extraContext, service, ...fields } = publishableServiceDocument(extra);
|
|
241
|
+
const document = {
|
|
242
|
+
"@context": mergeContexts(extraContext),
|
|
188
243
|
id: record.serviceDid,
|
|
189
244
|
controller: [record.controllerDid],
|
|
190
|
-
verificationMethod: [
|
|
245
|
+
verificationMethod: [
|
|
246
|
+
{
|
|
247
|
+
id: keyId,
|
|
248
|
+
type: "JsonWebKey2020",
|
|
249
|
+
controller: record.serviceDid,
|
|
250
|
+
publicKeyJwk,
|
|
251
|
+
},
|
|
252
|
+
],
|
|
191
253
|
authentication: [keyId],
|
|
192
254
|
assertionMethod: [keyId],
|
|
193
255
|
};
|
|
256
|
+
// Free-form fields go after the members the registry derives and can never
|
|
257
|
+
// replace one: parseServiceDocument already drops the reserved names.
|
|
258
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
259
|
+
if (key === "__proto__" || hasOwnKey(document, key))
|
|
260
|
+
continue;
|
|
261
|
+
document[key] = value;
|
|
262
|
+
}
|
|
263
|
+
if (Array.isArray(service) && service.length > 0) {
|
|
264
|
+
// DID Core §5.4 wants unique ids. `#api` and `<serviceDid>#api` are different
|
|
265
|
+
// strings but the same id once expanded, so repeats are dropped after expanding,
|
|
266
|
+
// keeping the first.
|
|
267
|
+
const entries = new Map();
|
|
268
|
+
for (const entry of service) {
|
|
269
|
+
const id = entry.id.startsWith("#") ? `${record.serviceDid}${entry.id}` : entry.id;
|
|
270
|
+
if (!entries.has(id))
|
|
271
|
+
entries.set(id, { ...entry, id });
|
|
272
|
+
}
|
|
273
|
+
document.service = [...entries.values()];
|
|
274
|
+
}
|
|
275
|
+
return document;
|
|
194
276
|
}
|
|
195
277
|
/**
|
|
196
278
|
* Maps the on-chain struct into the shape this library returns.
|
|
@@ -223,4 +305,26 @@ export { parseServiceDid, serviceDidToHex };
|
|
|
223
305
|
function hexToBase64Url(hex) {
|
|
224
306
|
return Buffer.from(hex.slice(2), "hex").toString("base64url");
|
|
225
307
|
}
|
|
308
|
+
/**
|
|
309
|
+
* JWK thumbprint (RFC 7638): SHA-256 of the required EC members in lexicographic order,
|
|
310
|
+
* base64url without padding. Matches what `did-gen` prints as the vMethodId.
|
|
311
|
+
*/
|
|
312
|
+
function jwkThumbprint(jwk) {
|
|
313
|
+
const canonical = JSON.stringify({ crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y });
|
|
314
|
+
return hexToBase64Url(sha256(toUtf8Bytes(canonical)));
|
|
315
|
+
}
|
|
316
|
+
/** The registry's two contexts first, then whatever the service document adds. */
|
|
317
|
+
function mergeContexts(extra) {
|
|
318
|
+
const added = typeof extra === "string" ? [extra] : Array.isArray(extra) ? extra : [];
|
|
319
|
+
const merged = [...SERVICE_DID_DOCUMENT_CONTEXT];
|
|
320
|
+
for (const ctx of added) {
|
|
321
|
+
if (typeof ctx === "string" && !merged.includes(ctx))
|
|
322
|
+
merged.push(ctx);
|
|
323
|
+
}
|
|
324
|
+
return merged;
|
|
325
|
+
}
|
|
326
|
+
/** Unix seconds to an XML datetime in UTC without fractions, as DID Core §7.1.3 asks. */
|
|
327
|
+
function toXmlDateTime(seconds) {
|
|
328
|
+
return new Date(Number(seconds) * 1000).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
329
|
+
}
|
|
226
330
|
//# sourceMappingURL=ServiceDidRegistryQueries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceDidRegistryQueries.js","sourceRoot":"","sources":["../../src/ServiceDidRegistryQueries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ServiceDidRegistryQueries.js","sourceRoot":"","sources":["../../src/ServiceDidRegistryQueries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,0BAA0B,GAE3B,MAAM,kCAAkC,CAAC;AAU1C,yDAAyD;AACzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,qDAAqD;AACrD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAsB;IAC7D,8BAA8B;IAC9B,8CAA8C;CAC/C,CAAC;AAuBF;;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