@arcblock/did 1.30.26 → 1.31.1
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/esm/did-domain-resolver.d.mts +450 -0
- package/esm/did-domain-resolver.mjs +1163 -0
- package/esm/index.d.mts +7 -5
- package/esm/index.mjs +7 -1
- package/esm/subaccount.d.mts +38 -0
- package/esm/subaccount.mjs +95 -0
- package/lib/did-domain-resolver.cjs +1190 -0
- package/lib/did-domain-resolver.d.cts +450 -0
- package/lib/index.cjs +41 -1
- package/lib/index.d.cts +8 -6
- package/lib/subaccount.cjs +98 -0
- package/lib/subaccount.d.cts +38 -0
- package/package.json +3 -3
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DIDTypeArg } from "./type.cjs";
|
|
2
|
+
import { BytesType } from "@ocap/util";
|
|
3
|
+
|
|
4
|
+
//#region src/subaccount.d.ts
|
|
5
|
+
declare const SUBACCOUNT_DOMAIN_TAG = "arcblock:subaccount:v1";
|
|
6
|
+
/**
|
|
7
|
+
* Encode variable-length fields plus a 32-bit unsigned index into a canonical
|
|
8
|
+
* length-prefixed byte tuple:
|
|
9
|
+
* u32be(|f_0|) || f_0 || u32be(|f_1|) || f_1 || ... || u32be(index)
|
|
10
|
+
*
|
|
11
|
+
* Prevents delimiter collision attacks (e.g. scope="a:b", id="c" vs scope="a", id="b:c").
|
|
12
|
+
*/
|
|
13
|
+
declare function encodeLengthPrefixedTuple(fields: ReadonlyArray<Uint8Array | string>, index?: number): Uint8Array;
|
|
14
|
+
/**
|
|
15
|
+
* Derive a deterministic 32-byte sub-account seed (`0x` + 64 hex chars) from a parent
|
|
16
|
+
* public key / root DID, scope (such as chain DID or persona namespace), and index:
|
|
17
|
+
*
|
|
18
|
+
* HMAC-SHA256(
|
|
19
|
+
* key = "arcblock:subaccount:v1",
|
|
20
|
+
* msg = u32be(|scope|) || scope || u32be(|parent|) || parent || u32be(index)
|
|
21
|
+
* )
|
|
22
|
+
*
|
|
23
|
+
* Security note (#1167):
|
|
24
|
+
* This is Layer 1 (deterministic sub-account address partitioning & cross-chain wrong-deposit
|
|
25
|
+
* protection). When used directly with a shared hardware Passkey public key on-chain, the
|
|
26
|
+
* public key remains visible in transaction headers; for on-chain explorer unlinkability,
|
|
27
|
+
* use Layer 2 (`fromChainDid` stealth key derivation or delegated per-chain session keys).
|
|
28
|
+
*/
|
|
29
|
+
declare function deriveSubAccountSeed(parentIdentity: BytesType, scope: string, index?: number): string;
|
|
30
|
+
declare function createSubAccountHelpers(deps: {
|
|
31
|
+
fromPublicKeyHash: (buffer: string, type: DIDTypeArg) => string;
|
|
32
|
+
isValid: (did: string) => boolean;
|
|
33
|
+
}): {
|
|
34
|
+
deriveSubAccountAddress: (parentIdentity: BytesType, scope: string, index?: number, type?: DIDTypeArg) => string;
|
|
35
|
+
isFromSubAccount: (subAccountDid: string, parentIdentity: BytesType, scope: string, index?: number) => boolean;
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { SUBACCOUNT_DOMAIN_TAG, createSubAccountHelpers, deriveSubAccountSeed, encodeLengthPrefixedTuple };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/did",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Javascript lib to work with ArcBlock DID",
|
|
6
6
|
"keywords": [
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"url": "https://github.com/ArcBlock/blockchain/issues"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@ocap/mcrypto": "1.
|
|
73
|
-
"@ocap/util": "1.
|
|
72
|
+
"@ocap/mcrypto": "1.31.1",
|
|
73
|
+
"@ocap/util": "1.31.1",
|
|
74
74
|
"debug": "^4.4.3"
|
|
75
75
|
}
|
|
76
76
|
}
|