@mcsherrylabs/evolver-mcp 0.13.0 → 0.14.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/dist/application-signer.d.ts +1 -1
- package/dist/application-signer.d.ts.map +1 -1
- package/dist/attachments.d.ts +1 -1
- package/dist/attachments.d.ts.map +1 -1
- package/dist/attachments.js +2 -2
- package/dist/attachments.js.map +1 -1
- package/dist/content-file-tools.js +1 -1
- package/dist/content-file-tools.js.map +1 -1
- package/dist/content-files.d.ts +1 -1
- package/dist/content-files.d.ts.map +1 -1
- package/dist/content-files.js +1 -1
- package/dist/content-files.js.map +1 -1
- package/dist/content-ranges.d.ts +1 -1
- package/dist/content-ranges.d.ts.map +1 -1
- package/dist/group-crypto-tools.js +1 -1
- package/dist/group-crypto-tools.js.map +1 -1
- package/dist/group-crypto.d.ts +2 -2
- package/dist/group-crypto.d.ts.map +1 -1
- package/dist/group-crypto.js +1 -1
- package/dist/group-crypto.js.map +1 -1
- package/dist/inbox.d.ts +1 -1
- package/dist/inbox.d.ts.map +1 -1
- package/dist/inbox.js +1 -1
- package/dist/inbox.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/login.d.ts +1 -1
- package/dist/login.d.ts.map +1 -1
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.d.ts.map +1 -1
- package/dist/p2p.d.ts +1 -1
- package/dist/p2p.d.ts.map +1 -1
- package/dist/p2p.js +1 -1
- package/dist/p2p.js.map +1 -1
- package/dist/processor.d.ts +1 -1
- package/dist/processor.d.ts.map +1 -1
- package/dist/processor.js +1 -1
- package/dist/processor.js.map +1 -1
- package/dist/signed-http.d.ts +1 -1
- package/dist/signed-http.d.ts.map +1 -1
- package/dist/tools.d.ts +3 -3
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +10 -10
- package/dist/tools.js.map +1 -1
- package/dist/transaction-interchange-tools.js +1 -1
- package/dist/transaction-interchange-tools.js.map +1 -1
- package/dist/transaction-interchange.d.ts +2 -2
- package/dist/transaction-interchange.d.ts.map +1 -1
- package/dist/transaction-interchange.js +2 -2
- package/dist/transaction-interchange.js.map +1 -1
- package/package.json +4 -16
- package/dist/amount.d.ts +0 -23
- package/dist/amount.d.ts.map +0 -1
- package/dist/amount.js +0 -53
- package/dist/amount.js.map +0 -1
- package/dist/channel.d.ts +0 -77
- package/dist/channel.d.ts.map +0 -1
- package/dist/channel.js +0 -287
- package/dist/channel.js.map +0 -1
- package/dist/claim.d.ts +0 -48
- package/dist/claim.d.ts.map +0 -1
- package/dist/claim.js +0 -81
- package/dist/claim.js.map +0 -1
- package/dist/content.d.ts +0 -94
- package/dist/content.d.ts.map +0 -1
- package/dist/content.js +0 -215
- package/dist/content.js.map +0 -1
- package/dist/group-ownership.d.ts +0 -78
- package/dist/group-ownership.d.ts.map +0 -1
- package/dist/group-ownership.js +0 -324
- package/dist/group-ownership.js.map +0 -1
- package/dist/group.d.ts +0 -60
- package/dist/group.d.ts.map +0 -1
- package/dist/group.js +0 -204
- package/dist/group.js.map +0 -1
- package/dist/identity.d.ts +0 -87
- package/dist/identity.d.ts.map +0 -1
- package/dist/identity.js +0 -236
- package/dist/identity.js.map +0 -1
- package/dist/node-transport.d.ts +0 -14
- package/dist/node-transport.d.ts.map +0 -1
- package/dist/node-transport.js +0 -54
- package/dist/node-transport.js.map +0 -1
- package/dist/read.d.ts +0 -252
- package/dist/read.d.ts.map +0 -1
- package/dist/read.js +0 -320
- package/dist/read.js.map +0 -1
- package/dist/result.d.ts +0 -110
- package/dist/result.d.ts.map +0 -1
- package/dist/result.js +0 -97
- package/dist/result.js.map +0 -1
- package/dist/signer.d.ts +0 -37
- package/dist/signer.d.ts.map +0 -1
- package/dist/signer.js +0 -76
- package/dist/signer.js.map +0 -1
- package/dist/write.d.ts +0 -214
- package/dist/write.d.ts.map +0 -1
- package/dist/write.js +0 -399
- package/dist/write.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"group-ownership.js","sourceRoot":"","sources":["../src/group-ownership.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,uGAAuG;AACvG,EAAE;AACF,gGAAgG;AAChG,kGAAkG;AAClG,iGAAiG;AACjG,yFAAyF;AACzF,EAAE;AACF,oGAAoG;AACpG,qGAAqG;AACrG,mGAAmG;AACnG,mGAAmG;AACnG,+DAA+D;AAC/D,gGAAgG;AAChG,kGAAkG;AAClG,sEAAsE;AACtE,uEAAuE;AACvE,EAAE;AACF,gGAAgG;AAChG,oGAAoG;AACpG,mGAAmG;AACnG,2BAA2B;AAC3B,EAAE;AACF,gGAAgG;AAChG,4FAA4F;AAC5F,qGAAqG;AACrG,6FAA6F;AAC7F,8FAA8F;AAC9F,EAAE;AACF,8FAA8F;AAC9F,mGAAmG;AACnG,EAAE;AACF,iGAAiG;AACjG,kGAAkG;AAClG,oGAAoG;AACpG,2FAA2F;AAC3F,gGAAgG;AAChG,+FAA+F;AAC/F,kGAAkG;AAClG,8FAA8F;AAE9F,OAAO,EACL,MAAM,EACN,cAAc,EACd,IAAI,IAAI,QAAQ,EAChB,0BAA0B,EAC1B,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,QAAQ,EACR,WAAW,GACZ,MAAM,8BAA8B,CAAC;AAItC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,4BAA4B,EAC5B,YAAY,EACZ,cAAc,EACd,qBAAqB,GACtB,MAAM,YAAY,CAAC;AASpB;;;;4FAI4F;AAC5F,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AACrC,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAExC,qFAAqF;AACrF,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAC1C,MAAM,CAAC,MAAM,WAAW,GAAG,mCAAmC,CAAC;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,oCAAoC,CAAC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CAAC,cAAc,EAAE,aAAa,EAAE,GAAG,EAAE,IAAI,EAAE,0BAA0B;QACtG,MAAM,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,aAAa,EAAE,GAAG,MAAM,EAAE;KACxD,CAAC;IACF,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC;QACrC,OAAO,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,4DAA4D,CAAC,CAAC;IACpG,oBAAoB,CAAC,EAAE,CAAC,CAAC;IACzB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACvC,CAAC"}
|
package/dist/group.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { Signer } from "@mcsherrylabs/evolver-client";
|
|
2
|
-
import type { ChainReads } from "./read.js";
|
|
3
|
-
import type { SignedGroup } from "./write.js";
|
|
4
|
-
import type { ToolResult } from "./result.js";
|
|
5
|
-
/** What the group verbs need from the world. NO `submitTx` — deliberately: the signing verbs submit
|
|
6
|
-
* nothing, so the capability is not present to reach for (zero-submit is structural). */
|
|
7
|
-
export interface GroupOpsDeps {
|
|
8
|
-
readonly identity: string;
|
|
9
|
-
readonly signer: Signer;
|
|
10
|
-
readonly ttlOffset?: number;
|
|
11
|
-
readonly reads: ChainReads;
|
|
12
|
-
}
|
|
13
|
-
/** A signed groups-ledger operation, as returned by a signing verb. */
|
|
14
|
-
export type GroupSignResult = ToolResult<SignedGroup>;
|
|
15
|
-
/**
|
|
16
|
-
* Create a new group (SIGN-09), signed for `deps.identity`. The name is validated STRUCTURALLY before
|
|
17
|
-
* anything is signed — the chain FINES an invalid name rather than refusing it.
|
|
18
|
-
*/
|
|
19
|
-
export declare function signCreateGroup(deps: GroupOpsDeps, params: {
|
|
20
|
-
name: string;
|
|
21
|
-
}): Promise<GroupSignResult>;
|
|
22
|
-
/**
|
|
23
|
-
* Delete a group (SIGN-10). The name is validated structurally before anything is signed. Ownership
|
|
24
|
-
* is NOT checked locally — a delete by a non-owner is chain-enforced and surfaces as an
|
|
25
|
-
* `invalid_group_body` fine via `classifySubmit`, not as a local refusal.
|
|
26
|
-
*/
|
|
27
|
-
export declare function signDeleteGroup(deps: GroupOpsDeps, params: {
|
|
28
|
-
name: string;
|
|
29
|
-
}): Promise<GroupSignResult>;
|
|
30
|
-
/**
|
|
31
|
-
* Add a member to a group (SIGN-11). Refusals fire FIRST, in order: invalid group name, empty member
|
|
32
|
-
* id, self-add, invalid node id — then the chain read, then compose.
|
|
33
|
-
*/
|
|
34
|
-
export declare function signAddMember(deps: GroupOpsDeps, params: {
|
|
35
|
-
groupName: string;
|
|
36
|
-
memberNodeId: string;
|
|
37
|
-
}): Promise<GroupSignResult>;
|
|
38
|
-
/**
|
|
39
|
-
* Remove a member from a group (SIGN-12). Same refusal order as add-member (invalid name, empty id,
|
|
40
|
-
* self-add, invalid id) BEFORE the chain read.
|
|
41
|
-
*/
|
|
42
|
-
export declare function signRemoveMember(deps: GroupOpsDeps, params: {
|
|
43
|
-
groupName: string;
|
|
44
|
-
memberNodeId: string;
|
|
45
|
-
}): Promise<GroupSignResult>;
|
|
46
|
-
/**
|
|
47
|
-
* Multi-recipient credit transfer (SIGN-02): move credit from the signing identity to 1..20
|
|
48
|
-
* recipients. This is the plain `transferBody` on `LEDGER.identity` — NOT a group-membership encoder
|
|
49
|
-
* and NOT an ownership transfer (that needs the incoming owner's co-signature and lives in
|
|
50
|
-
* `src/group-ownership.ts`). "One verb = one tx"; the multi-entry array is the ONE thing that
|
|
51
|
-
* distinguishes it from the singleton `evolver_sign_transfer`. Order is significant — it decides
|
|
52
|
-
* which transfer survives a short-balance apply.
|
|
53
|
-
*/
|
|
54
|
-
export declare function signGroupTransfer(deps: GroupOpsDeps, params: {
|
|
55
|
-
entries: Array<{
|
|
56
|
-
recipient: string;
|
|
57
|
-
amount: string;
|
|
58
|
-
}>;
|
|
59
|
-
}): Promise<GroupSignResult>;
|
|
60
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AAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAClD,OAAO,CAAC,eAAe,CAAC,CAkB1B;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAChE,OAAO,CAAC,eAAe,CAAC,CA2C1B"}
|
package/dist/group.js
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
// Groups-ledger signing verbs (SIGN-09..12) plus the multi-recipient group credit transfer
|
|
2
|
-
// (SIGN-02). Each is a compose→sign→record→return-txId operation with ZERO submit, mirroring the
|
|
3
|
-
// identity verbs in `src/identity.ts` and resolving in the SAME `submitSigned`/`inspectSigned` path.
|
|
4
|
-
//
|
|
5
|
-
// The ledger is pinned to `LEDGER.groups` for the four membership verbs (never a caller-chosen id),
|
|
6
|
-
// and to `LEDGER.identity` for the credit transfer (credit lives on identities; a group holds no
|
|
7
|
-
// balance). Nothing here can reach a node before `evolver_submit`. The costly local refusals —
|
|
8
|
-
// invalid group name, empty/invalid member id, self-add, a bad transfer entry — fire BEFORE anything
|
|
9
|
-
// is signed, because the chain's answer for a malformed body arrives as a FINE, too late to refuse
|
|
10
|
-
// (Pitfalls 4/5).
|
|
11
|
-
//
|
|
12
|
-
// ⚠️ KEY MATERIAL NEVER REACHES A RECORD OR A REFUSAL. Records carry the group name and member node
|
|
13
|
-
// id and decimal amount strings only; refusals name the FIELD/PATH, never the bytes.
|
|
14
|
-
import { LEDGER, createGroupBody, deleteGroupBody, addMemberBody, removeMemberBody, transferBody } from "@mcsherrylabs/evolver-client";
|
|
15
|
-
import { isValidGroupName, isValidNodeId } from "@mcsherrylabs/evolver-client";
|
|
16
|
-
import { parseAmount, formatAmount } from "./amount.js";
|
|
17
|
-
import { DEFAULT_TTL_OFFSET, composeAndSign } from "./write.js";
|
|
18
|
-
/** Read the chain tip to bound a transaction's life; an unreachable chain is `unreachable`, never a
|
|
19
|
-
* submit. */
|
|
20
|
-
async function tipOrUnreachable(deps) {
|
|
21
|
-
try {
|
|
22
|
-
return await deps.reads.currentRound();
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
return { kind: "unreachable", chain: "", cause: e instanceof Error ? e.message : String(e) };
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/** The maximum number of recipients an on-chain credit transfer carries (the node's own 1..20 rule). */
|
|
29
|
-
const MAX_TRANSFER_ENTRIES = 20;
|
|
30
|
-
/**
|
|
31
|
-
* Create a new group (SIGN-09), signed for `deps.identity`. The name is validated STRUCTURALLY before
|
|
32
|
-
* anything is signed — the chain FINES an invalid name rather than refusing it.
|
|
33
|
-
*/
|
|
34
|
-
export async function signCreateGroup(deps, params) {
|
|
35
|
-
const name = String(params.name ?? "").trim();
|
|
36
|
-
if (!isValidGroupName(name))
|
|
37
|
-
return {
|
|
38
|
-
kind: "partial",
|
|
39
|
-
what: "name",
|
|
40
|
-
cause: `"${name}" is not a valid group name — the chain fines an invalid name rather than refusing it, so it is refused here`,
|
|
41
|
-
};
|
|
42
|
-
const tip = await tipOrUnreachable(deps);
|
|
43
|
-
if (typeof tip !== "number")
|
|
44
|
-
return tip;
|
|
45
|
-
const expiresAtRound = tip + (deps.ttlOffset ?? DEFAULT_TTL_OFFSET);
|
|
46
|
-
return composeAndSign(deps, {
|
|
47
|
-
ledgerId: LEDGER.groups, // hard-pinned, never caller-chosen
|
|
48
|
-
body: createGroupBody(name),
|
|
49
|
-
ttlRound: expiresAtRound,
|
|
50
|
-
signedAtRound: tip,
|
|
51
|
-
verb: "create_group",
|
|
52
|
-
fields: { groupName: name },
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
/** The refusal shared by the three member/file verbs: validate the group name BEFORE anything is
|
|
56
|
-
* read or signed (the chain fines, it does not refuse, an invalid name). */
|
|
57
|
-
function validGroupName(name) {
|
|
58
|
-
if (!isValidGroupName(name))
|
|
59
|
-
return {
|
|
60
|
-
kind: "partial",
|
|
61
|
-
what: "name",
|
|
62
|
-
cause: `"${name}" is not a valid group name — the chain fines an invalid name rather than refusing it, so it is refused here`,
|
|
63
|
-
};
|
|
64
|
-
return name;
|
|
65
|
-
}
|
|
66
|
-
/** The refusal shared by add/remove-member: the member id must be non-empty, not the sender, and a
|
|
67
|
-
* syntactically valid node id — all refused BEFORE the chain read (the chain fines these). */
|
|
68
|
-
function validMemberId(memberNodeId, identity) {
|
|
69
|
-
if (memberNodeId.length === 0)
|
|
70
|
-
return { kind: "partial", what: "memberNodeId", cause: "no member id given" };
|
|
71
|
-
if (memberNodeId === identity)
|
|
72
|
-
return {
|
|
73
|
-
kind: "partial",
|
|
74
|
-
what: "memberNodeId",
|
|
75
|
-
cause: `adding or removing "${identity}" (this agent) is a semantic no-op worth refusing cheaply — a group's owner is not its own member`,
|
|
76
|
-
};
|
|
77
|
-
if (!isValidNodeId(memberNodeId))
|
|
78
|
-
return {
|
|
79
|
-
kind: "partial",
|
|
80
|
-
what: "memberNodeId",
|
|
81
|
-
cause: `"${memberNodeId}" is not a valid node id — the chain fines an invalid id rather than refusing it, so it is refused here`,
|
|
82
|
-
};
|
|
83
|
-
return memberNodeId;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Delete a group (SIGN-10). The name is validated structurally before anything is signed. Ownership
|
|
87
|
-
* is NOT checked locally — a delete by a non-owner is chain-enforced and surfaces as an
|
|
88
|
-
* `invalid_group_body` fine via `classifySubmit`, not as a local refusal.
|
|
89
|
-
*/
|
|
90
|
-
export async function signDeleteGroup(deps, params) {
|
|
91
|
-
const groupName = validGroupName(String(params.name ?? "").trim());
|
|
92
|
-
if (typeof groupName !== "string")
|
|
93
|
-
return groupName;
|
|
94
|
-
const tip = await tipOrUnreachable(deps);
|
|
95
|
-
if (typeof tip !== "number")
|
|
96
|
-
return tip;
|
|
97
|
-
const expiresAtRound = tip + (deps.ttlOffset ?? DEFAULT_TTL_OFFSET);
|
|
98
|
-
return composeAndSign(deps, {
|
|
99
|
-
ledgerId: LEDGER.groups,
|
|
100
|
-
body: deleteGroupBody(groupName),
|
|
101
|
-
ttlRound: expiresAtRound,
|
|
102
|
-
signedAtRound: tip,
|
|
103
|
-
verb: "delete_group",
|
|
104
|
-
fields: { groupName },
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Add a member to a group (SIGN-11). Refusals fire FIRST, in order: invalid group name, empty member
|
|
109
|
-
* id, self-add, invalid node id — then the chain read, then compose.
|
|
110
|
-
*/
|
|
111
|
-
export async function signAddMember(deps, params) {
|
|
112
|
-
const groupName = validGroupName(String(params.groupName ?? "").trim());
|
|
113
|
-
if (typeof groupName !== "string")
|
|
114
|
-
return groupName;
|
|
115
|
-
const member = validMemberId(String(params.memberNodeId ?? "").trim(), deps.identity);
|
|
116
|
-
if (typeof member !== "string")
|
|
117
|
-
return member;
|
|
118
|
-
const tip = await tipOrUnreachable(deps);
|
|
119
|
-
if (typeof tip !== "number")
|
|
120
|
-
return tip;
|
|
121
|
-
const expiresAtRound = tip + (deps.ttlOffset ?? DEFAULT_TTL_OFFSET);
|
|
122
|
-
return composeAndSign(deps, {
|
|
123
|
-
ledgerId: LEDGER.groups,
|
|
124
|
-
body: addMemberBody(groupName, member),
|
|
125
|
-
ttlRound: expiresAtRound,
|
|
126
|
-
signedAtRound: tip,
|
|
127
|
-
verb: "add_member",
|
|
128
|
-
fields: { groupName, memberNodeId: member },
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Remove a member from a group (SIGN-12). Same refusal order as add-member (invalid name, empty id,
|
|
133
|
-
* self-add, invalid id) BEFORE the chain read.
|
|
134
|
-
*/
|
|
135
|
-
export async function signRemoveMember(deps, params) {
|
|
136
|
-
const groupName = validGroupName(String(params.groupName ?? "").trim());
|
|
137
|
-
if (typeof groupName !== "string")
|
|
138
|
-
return groupName;
|
|
139
|
-
const member = validMemberId(String(params.memberNodeId ?? "").trim(), deps.identity);
|
|
140
|
-
if (typeof member !== "string")
|
|
141
|
-
return member;
|
|
142
|
-
const tip = await tipOrUnreachable(deps);
|
|
143
|
-
if (typeof tip !== "number")
|
|
144
|
-
return tip;
|
|
145
|
-
const expiresAtRound = tip + (deps.ttlOffset ?? DEFAULT_TTL_OFFSET);
|
|
146
|
-
return composeAndSign(deps, {
|
|
147
|
-
ledgerId: LEDGER.groups,
|
|
148
|
-
body: removeMemberBody(groupName, member),
|
|
149
|
-
ttlRound: expiresAtRound,
|
|
150
|
-
signedAtRound: tip,
|
|
151
|
-
verb: "remove_member",
|
|
152
|
-
fields: { groupName, memberNodeId: member },
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Multi-recipient credit transfer (SIGN-02): move credit from the signing identity to 1..20
|
|
157
|
-
* recipients. This is the plain `transferBody` on `LEDGER.identity` — NOT a group-membership encoder
|
|
158
|
-
* and NOT an ownership transfer (that needs the incoming owner's co-signature and lives in
|
|
159
|
-
* `src/group-ownership.ts`). "One verb = one tx"; the multi-entry array is the ONE thing that
|
|
160
|
-
* distinguishes it from the singleton `evolver_sign_transfer`. Order is significant — it decides
|
|
161
|
-
* which transfer survives a short-balance apply.
|
|
162
|
-
*/
|
|
163
|
-
export async function signGroupTransfer(deps, params) {
|
|
164
|
-
const entries = Array.isArray(params.entries) ? params.entries : [];
|
|
165
|
-
if (entries.length === 0)
|
|
166
|
-
return { kind: "partial", what: "entries", cause: "at least one transfer entry is required" };
|
|
167
|
-
if (entries.length > MAX_TRANSFER_ENTRIES)
|
|
168
|
-
return {
|
|
169
|
-
kind: "partial",
|
|
170
|
-
what: "entries",
|
|
171
|
-
cause: `at most ${MAX_TRANSFER_ENTRIES} entries are allowed (the node's own limit) — got ${entries.length}`,
|
|
172
|
-
};
|
|
173
|
-
// Validate every entry BEFORE anything is signed: a bad amount or a missing recipient is refused
|
|
174
|
-
// here (naming the entry index, never the bytes) rather than fined on-chain.
|
|
175
|
-
const parsed = [];
|
|
176
|
-
for (let i = 0; i < entries.length; i++) {
|
|
177
|
-
const e = entries[i];
|
|
178
|
-
const recipient = String(e.recipient ?? "").trim();
|
|
179
|
-
if (recipient.length === 0)
|
|
180
|
-
return { kind: "partial", what: `entries.${i}.recipient`, cause: "no recipient given" };
|
|
181
|
-
const amount = parseAmount(String(e.amount ?? ""));
|
|
182
|
-
if (!amount.ok)
|
|
183
|
-
return { kind: "partial", what: `entries.${i}.amount`, cause: amount.error };
|
|
184
|
-
parsed.push({ recipient, amount: amount.value });
|
|
185
|
-
}
|
|
186
|
-
const tip = await tipOrUnreachable(deps);
|
|
187
|
-
if (typeof tip !== "number")
|
|
188
|
-
return tip;
|
|
189
|
-
const expiresAtRound = tip + (deps.ttlOffset ?? DEFAULT_TTL_OFFSET);
|
|
190
|
-
const fields = {};
|
|
191
|
-
for (let i = 0; i < parsed.length; i++) {
|
|
192
|
-
fields[`recipient.${i}`] = parsed[i].recipient;
|
|
193
|
-
fields[`amount.${i}`] = formatAmount(parsed[i].amount);
|
|
194
|
-
}
|
|
195
|
-
return composeAndSign(deps, {
|
|
196
|
-
ledgerId: LEDGER.identity, // NOT groups — credit lives on identities (ownership: src/group-ownership.ts)
|
|
197
|
-
body: transferBody(parsed.map((e) => ({ recipient: e.recipient, amount: e.amount }))),
|
|
198
|
-
ttlRound: expiresAtRound,
|
|
199
|
-
signedAtRound: tip,
|
|
200
|
-
verb: "group_transfer",
|
|
201
|
-
fields,
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
//# sourceMappingURL=group.js.map
|
package/dist/group.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../src/group.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,iGAAiG;AACjG,qGAAqG;AACrG,EAA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gBAAgB;QACtB,MAAM;KACP,CAAoB,CAAC;AACxB,CAAC"}
|
package/dist/identity.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import type { Signer } from "@mcsherrylabs/evolver-client";
|
|
2
|
-
import type { ChainReads } from "./read.js";
|
|
3
|
-
import type { SignedIdentity, SignedGroup, SignedChannel, SignedRecord } from "./write.js";
|
|
4
|
-
import type { ToolResult } from "./result.js";
|
|
5
|
-
/** What the identity verbs need from the world. NO `submitTx` — deliberately: the five signing
|
|
6
|
-
* verbs submit nothing, so the capability is not present to reach for (SIGN-20 is structural). */
|
|
7
|
-
export interface IdentityOpsDeps {
|
|
8
|
-
readonly identity: string;
|
|
9
|
-
readonly signer: Signer;
|
|
10
|
-
readonly ttlOffset?: number;
|
|
11
|
-
readonly reads: ChainReads;
|
|
12
|
-
}
|
|
13
|
-
/** A signed identity operation, as returned by a signing verb. Always `ok` once composed. */
|
|
14
|
-
export type IdentitySignResult = ToolResult<SignedIdentity>;
|
|
15
|
-
/** Decode a starting credit from a decimal string, refusing `< 1`, non-integers, and negative/hex
|
|
16
|
-
* forms. The chain FINES a zero- or negative-credit creation rather than refusing it, so the whole
|
|
17
|
-
* point is this refusal happening BEFORE anything is signed (Pitfall 4). */
|
|
18
|
-
export declare function parseInitialCredit(input: string): {
|
|
19
|
-
ok: true;
|
|
20
|
-
value: bigint;
|
|
21
|
-
} | {
|
|
22
|
-
ok: false;
|
|
23
|
-
error: string;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Compose a body into a signed identity transaction and record it — in ONE call. Mirrors
|
|
27
|
-
* `signTransfer`'s inline compose→sign→record: `buildSignedTx` → `txIdHex` → record into the two
|
|
28
|
-
* session stores via `recordSigned`. It SUBMITS NOTHING.
|
|
29
|
-
*
|
|
30
|
-
* This is the single compose implementation, re-exported from `src/write.ts` as `composeAndSign`
|
|
31
|
-
* (one compose path, never two). The `ledgerId` is always `LEDGER.identity` at the call sites.
|
|
32
|
-
*/
|
|
33
|
-
export declare function composeIdentityTx(deps: IdentityOpsDeps, args: {
|
|
34
|
-
ledgerId: string;
|
|
35
|
-
body: Uint8Array;
|
|
36
|
-
ttlRound: number;
|
|
37
|
-
signedAtRound: number;
|
|
38
|
-
verb: SignedIdentity["verb"] | SignedGroup["verb"] | SignedChannel["verb"];
|
|
39
|
-
fields: Record<string, string>;
|
|
40
|
-
maxToll?: bigint;
|
|
41
|
-
}): ToolResult<SignedRecord>;
|
|
42
|
-
/**
|
|
43
|
-
* Sponsor a new identity, paid for by this agent — signed for `deps.identity`, the configured host
|
|
44
|
-
* identity as `senderNodeId` (never a caller-chosen node id).
|
|
45
|
-
*
|
|
46
|
-
* ⚠️ THE CHAIN'S KEY RULES ARE ENFORCED HERE, not left to it, because its answer arrives too late
|
|
47
|
-
* to help: a body with the wrong keys is ORDERED and FINED 100, not refused. Exactly one
|
|
48
|
-
* BLS12-381-G1 and one Ed25519, each at label "", a starting credit >= 1, and both keys carrying a
|
|
49
|
-
* proof of possession from their holder.
|
|
50
|
-
*/
|
|
51
|
-
export declare function signCreateIdentity(deps: IdentityOpsDeps, params: {
|
|
52
|
-
keys: Array<{
|
|
53
|
-
keyType: string;
|
|
54
|
-
keyLabel: string;
|
|
55
|
-
publicKey: string;
|
|
56
|
-
popSignature: string;
|
|
57
|
-
}>;
|
|
58
|
-
initialCredit: string;
|
|
59
|
-
}): Promise<ToolResult<SignedRecord>>;
|
|
60
|
-
/**
|
|
61
|
-
* Delete the identity this agent signs as. SELF-DELETION ONLY (Pitfall 5): `confirmName` must match
|
|
62
|
-
* `deps.identity`, else the chain would fine a deletion naming another identity.
|
|
63
|
-
*/
|
|
64
|
-
export declare function signDeleteIdentity(deps: IdentityOpsDeps, params: {
|
|
65
|
-
confirmName: string;
|
|
66
|
-
}): Promise<ToolResult<SignedRecord>>;
|
|
67
|
-
export declare const signAddKey: (deps: IdentityOpsDeps, p: {
|
|
68
|
-
keyType: string;
|
|
69
|
-
keyLabel: string;
|
|
70
|
-
publicKey: string;
|
|
71
|
-
popSignature: string;
|
|
72
|
-
}) => Promise<ToolResult<SignedRecord>>;
|
|
73
|
-
export declare const signReplaceKey: (deps: IdentityOpsDeps, p: {
|
|
74
|
-
keyType: string;
|
|
75
|
-
keyLabel: string;
|
|
76
|
-
publicKey: string;
|
|
77
|
-
popSignature: string;
|
|
78
|
-
}) => Promise<ToolResult<SignedRecord>>;
|
|
79
|
-
/**
|
|
80
|
-
* Remove one of this identity's own keys. ⚠️ THE CHAIN WILL NOT STOP YOU LOCKING YOURSELF OUT — its
|
|
81
|
-
* only guard refuses a committee member deleting its default consensus key.
|
|
82
|
-
*/
|
|
83
|
-
export declare function signDeleteKey(deps: IdentityOpsDeps, p: {
|
|
84
|
-
keyType: string;
|
|
85
|
-
keyLabel: string;
|
|
86
|
-
}): Promise<ToolResult<SignedRecord>>;
|
|
87
|
-
//# sourceMappingURL=identity.d.ts.map
|
package/dist/identity.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,MAAM,EAAY,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;mGACmG;AACnG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B;AAED,6FAA6F;AAC7F,MAAM,MAAM,kBAAkB,GAAG,UA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MAAM,UAAU,GAAI,MAAM,eAAe,EAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,sCACpG,CAAC;AAEhC,eAAO,MAAM,cAAc,GAAI,MAAM,eAAe,EAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,sCACpG,CAAC;AAEpC;;;GAGG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,eAAe,EACrB,CAAC,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACvC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAiBnC"}
|
package/dist/identity.js
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
// Identity-lifecycle signing verbs (SIGN-03..07): sign create/delete identity and add/replace/delete
|
|
2
|
-
// key. Each is a compose→sign→record→return-txId operation with ZERO submit, mirroring Phase 2's
|
|
3
|
-
// `signTransfer` (SIGN-20) and resolving in the SAME `submitSigned`/`inspectSigned` path (SIGN-19).
|
|
4
|
-
//
|
|
5
|
-
// The ledger is pinned to `LEDGER.identity` (never a caller-chosen channel or core-ledger id), so
|
|
6
|
-
// nothing here can reach a node before `evolver_submit`. The costly local refusals — create-identity
|
|
7
|
-
// key rules, delete-identity self-check, empty-PoP refusal — fire BEFORE anything is signed, because
|
|
8
|
-
// the chain's answer for a malformed body arrives as a FINE, too late to refuse (Pitfalls 4/5).
|
|
9
|
-
//
|
|
10
|
-
// ⚠️ KEY MATERIAL NEVER REACHES A RECORD OR A REFUSAL. Records carry key `type`/`label` and the txId
|
|
11
|
-
// only; the caller supplies the holder-produced `popSignature` bytes, which are folded into the
|
|
12
|
-
// composed body by the SDK encoder — this process never computes a PoP digest and never signs for a
|
|
13
|
-
// key it does not hold.
|
|
14
|
-
import { LEDGER, buildSignedTx, txIdHex, hexToBytes, createIdentityInner, createIdentityBody, deleteIdentityBody, addKeyBody, replaceKeyBody, deleteKeyBody, } from "@mcsherrylabs/evolver-client";
|
|
15
|
-
import { DEFAULT_TTL_OFFSET, recordSigned } from "./write.js";
|
|
16
|
-
/** Decode a starting credit from a decimal string, refusing `< 1`, non-integers, and negative/hex
|
|
17
|
-
* forms. The chain FINES a zero- or negative-credit creation rather than refusing it, so the whole
|
|
18
|
-
* point is this refusal happening BEFORE anything is signed (Pitfall 4). */
|
|
19
|
-
export function parseInitialCredit(input) {
|
|
20
|
-
const s = String(input ?? "").trim();
|
|
21
|
-
if (!/^[1-9][0-9]*$/.test(s))
|
|
22
|
-
return {
|
|
23
|
-
ok: false,
|
|
24
|
-
error: `initialCredit "${s}" is not a positive decimal integer — it must be at least 1, because ` +
|
|
25
|
-
`a zero- or negative-credit creation is ordered and FINED rather than refused`,
|
|
26
|
-
};
|
|
27
|
-
return { ok: true, value: BigInt(s) };
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Compose a body into a signed identity transaction and record it — in ONE call. Mirrors
|
|
31
|
-
* `signTransfer`'s inline compose→sign→record: `buildSignedTx` → `txIdHex` → record into the two
|
|
32
|
-
* session stores via `recordSigned`. It SUBMITS NOTHING.
|
|
33
|
-
*
|
|
34
|
-
* This is the single compose implementation, re-exported from `src/write.ts` as `composeAndSign`
|
|
35
|
-
* (one compose path, never two). The `ledgerId` is always `LEDGER.identity` at the call sites.
|
|
36
|
-
*/
|
|
37
|
-
export function composeIdentityTx(deps, args) {
|
|
38
|
-
// Resolve once for the envelope, digest and inspection. Call-site metadata must not override
|
|
39
|
-
// the channel write's effective signed consent (including the SDK's zero default).
|
|
40
|
-
const maxToll = args.maxToll ?? 0n;
|
|
41
|
-
const fields = args.verb === "channel_write"
|
|
42
|
-
? { ...args.fields, maxToll: maxToll.toString() }
|
|
43
|
-
: { ...args.fields };
|
|
44
|
-
const bytes = buildSignedTx({
|
|
45
|
-
ledgerId: args.ledgerId,
|
|
46
|
-
senderNodeId: deps.identity,
|
|
47
|
-
body: args.body,
|
|
48
|
-
ttlRound: args.ttlRound,
|
|
49
|
-
signers: [deps.signer],
|
|
50
|
-
maxToll,
|
|
51
|
-
});
|
|
52
|
-
const id = txIdHex(args.ledgerId, deps.identity, args.ttlRound, args.body, maxToll);
|
|
53
|
-
const signed = {
|
|
54
|
-
txId: id,
|
|
55
|
-
expiresAtRound: args.ttlRound,
|
|
56
|
-
signedAtRound: args.signedAtRound,
|
|
57
|
-
verb: args.verb,
|
|
58
|
-
fields,
|
|
59
|
-
summary: { sender: deps.identity, ...fields },
|
|
60
|
-
};
|
|
61
|
-
recordSigned(signed, bytes);
|
|
62
|
-
return { kind: "ok", value: signed };
|
|
63
|
-
}
|
|
64
|
-
/** Read the chain tip to bound a transaction's life; an unreachable chain is `unreachable`, never a
|
|
65
|
-
* submit. */
|
|
66
|
-
async function tipOrUnreachable(deps) {
|
|
67
|
-
try {
|
|
68
|
-
return await deps.reads.currentRound();
|
|
69
|
-
}
|
|
70
|
-
catch (e) {
|
|
71
|
-
return { kind: "unreachable", chain: "", cause: e instanceof Error ? e.message : String(e) };
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Sponsor a new identity, paid for by this agent — signed for `deps.identity`, the configured host
|
|
76
|
-
* identity as `senderNodeId` (never a caller-chosen node id).
|
|
77
|
-
*
|
|
78
|
-
* ⚠️ THE CHAIN'S KEY RULES ARE ENFORCED HERE, not left to it, because its answer arrives too late
|
|
79
|
-
* to help: a body with the wrong keys is ORDERED and FINED 100, not refused. Exactly one
|
|
80
|
-
* BLS12-381-G1 and one Ed25519, each at label "", a starting credit >= 1, and both keys carrying a
|
|
81
|
-
* proof of possession from their holder.
|
|
82
|
-
*/
|
|
83
|
-
export async function signCreateIdentity(deps, params) {
|
|
84
|
-
const credit = parseInitialCredit(params.initialCredit);
|
|
85
|
-
if (!credit.ok)
|
|
86
|
-
return { kind: "partial", what: "initialCredit", cause: credit.error };
|
|
87
|
-
const keys = Array.isArray(params.keys) ? params.keys : [];
|
|
88
|
-
const bls = keys.filter((k) => k.keyType === "BLS12-381-G1");
|
|
89
|
-
const ed = keys.filter((k) => k.keyType === "Ed25519");
|
|
90
|
-
if (bls.length !== 1 || ed.length !== 1 || keys.length !== 2)
|
|
91
|
-
return {
|
|
92
|
-
kind: "partial",
|
|
93
|
-
what: "keys",
|
|
94
|
-
cause: "exactly one BLS12-381-G1 and one Ed25519 are required, each at the default label. " +
|
|
95
|
-
"A body without both is ordered and FINED 100 rather than refused, so it is refused here.",
|
|
96
|
-
};
|
|
97
|
-
if (keys.some((k) => String(k.keyLabel ?? "") !== ""))
|
|
98
|
-
return {
|
|
99
|
-
kind: "partial",
|
|
100
|
-
what: "keys",
|
|
101
|
-
cause: "both keys must be at the default (empty) label — a non-empty label is refused here rather than fined on-chain",
|
|
102
|
-
};
|
|
103
|
-
// Empty-PoP refusal: this agent signs for NO key it does not hold (T-03-01). Named by field, never bytes.
|
|
104
|
-
const empty = keys.findIndex((k) => !k.popSignature || String(k.popSignature).length === 0);
|
|
105
|
-
if (empty !== -1)
|
|
106
|
-
return {
|
|
107
|
-
kind: "partial",
|
|
108
|
-
what: `keys.${empty}.popSignature`,
|
|
109
|
-
cause: "each key needs a proof of possession from its holder — this agent signs for no key it does not hold",
|
|
110
|
-
};
|
|
111
|
-
// Hex-decode each key, refusing (naming the PATH) on non-hex/odd-length input (T-03-07). The
|
|
112
|
-
// refusal names the field, never echoes the bytes.
|
|
113
|
-
const decoded = [];
|
|
114
|
-
for (let i = 0; i < keys.length; i++) {
|
|
115
|
-
const k = keys[i];
|
|
116
|
-
try {
|
|
117
|
-
const publicKey = hexToBytes(String(k.publicKey ?? ""));
|
|
118
|
-
// Empty-publicKey refusal: zero bytes, not an error — refused for free rather than fined.
|
|
119
|
-
if (publicKey.length === 0)
|
|
120
|
-
return { kind: "partial", what: `keys.${i}.publicKey`, cause: "a key is needed" };
|
|
121
|
-
const popSig = hexToBytes(String(k.popSignature ?? ""));
|
|
122
|
-
decoded.push({ keyType: k.keyType, publicKey, keyLabel: String(k.keyLabel ?? ""), popSig });
|
|
123
|
-
}
|
|
124
|
-
catch (e) {
|
|
125
|
-
return { kind: "partial", what: `keys.${i}`, cause: e instanceof Error ? e.message : String(e) };
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const tip = await tipOrUnreachable(deps);
|
|
129
|
-
if (typeof tip !== "number")
|
|
130
|
-
return tip;
|
|
131
|
-
const expiresAtRound = tip + (deps.ttlOffset ?? DEFAULT_TTL_OFFSET);
|
|
132
|
-
const body = createIdentityBody(createIdentityInner(deps.identity, credit.value, decoded, true));
|
|
133
|
-
return composeIdentityTx(deps, {
|
|
134
|
-
ledgerId: LEDGER.identity,
|
|
135
|
-
body,
|
|
136
|
-
ttlRound: expiresAtRound,
|
|
137
|
-
signedAtRound: tip,
|
|
138
|
-
verb: "create_identity",
|
|
139
|
-
fields: { initialCredit: credit.value.toString() },
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Delete the identity this agent signs as. SELF-DELETION ONLY (Pitfall 5): `confirmName` must match
|
|
144
|
-
* `deps.identity`, else the chain would fine a deletion naming another identity.
|
|
145
|
-
*/
|
|
146
|
-
export async function signDeleteIdentity(deps, params) {
|
|
147
|
-
const confirmName = String(params.confirmName ?? "").trim();
|
|
148
|
-
if (confirmName !== deps.identity)
|
|
149
|
-
return {
|
|
150
|
-
kind: "partial",
|
|
151
|
-
what: "confirmName",
|
|
152
|
-
cause: `this deletes THIS identity and nothing else — the chain fines a deletion naming another. ` +
|
|
153
|
-
`Pass "${deps.identity}" to mean it.`,
|
|
154
|
-
};
|
|
155
|
-
const tip = await tipOrUnreachable(deps);
|
|
156
|
-
if (typeof tip !== "number")
|
|
157
|
-
return tip;
|
|
158
|
-
const expiresAtRound = tip + (deps.ttlOffset ?? DEFAULT_TTL_OFFSET);
|
|
159
|
-
return composeIdentityTx(deps, {
|
|
160
|
-
ledgerId: LEDGER.identity,
|
|
161
|
-
body: deleteIdentityBody(deps.identity),
|
|
162
|
-
ttlRound: expiresAtRound,
|
|
163
|
-
signedAtRound: tip,
|
|
164
|
-
verb: "delete_identity",
|
|
165
|
-
fields: { target: deps.identity },
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
/** Add/replace share one shape, differing only by verb tag and encoder. The SDK encoders keep them
|
|
169
|
-
* distinct (a shared hand-rolled digest would make an AddKey proof valid for a ReplaceKey). */
|
|
170
|
-
async function signKeyOp(deps, verb, p) {
|
|
171
|
-
const keyType = String(p.keyType ?? "").trim();
|
|
172
|
-
const keyLabel = String(p.keyLabel ?? "");
|
|
173
|
-
let publicKey, popSignature;
|
|
174
|
-
try {
|
|
175
|
-
publicKey = hexToBytes(String(p.publicKey ?? ""));
|
|
176
|
-
}
|
|
177
|
-
catch (e) {
|
|
178
|
-
return { kind: "partial", what: "publicKey", cause: e instanceof Error ? e.message : String(e) };
|
|
179
|
-
}
|
|
180
|
-
// Empty-publicKey refusal: `hexToBytes("")` is zero bytes, not an error — a body carrying an
|
|
181
|
-
// empty key would be ordered and fined on-chain, so it is refused for free before anything is
|
|
182
|
-
// signed (reference: admin.ts signKeyOp refuses `publicKey.length === 0`).
|
|
183
|
-
if (publicKey.length === 0)
|
|
184
|
-
return { kind: "partial", what: "publicKey", cause: "a key is needed" };
|
|
185
|
-
try {
|
|
186
|
-
popSignature = hexToBytes(String(p.popSignature ?? ""));
|
|
187
|
-
}
|
|
188
|
-
catch (e) {
|
|
189
|
-
return { kind: "partial", what: "popSignature", cause: e instanceof Error ? e.message : String(e) };
|
|
190
|
-
}
|
|
191
|
-
// Empty-PoP refusal: this agent signs for NO key it does not hold.
|
|
192
|
-
if (popSignature.length === 0)
|
|
193
|
-
return {
|
|
194
|
-
kind: "partial",
|
|
195
|
-
what: "popSignature",
|
|
196
|
-
cause: "the key's holder must prove possession — this agent cannot sign for a key it does not hold",
|
|
197
|
-
};
|
|
198
|
-
const tip = await tipOrUnreachable(deps);
|
|
199
|
-
if (typeof tip !== "number")
|
|
200
|
-
return tip;
|
|
201
|
-
const expiresAtRound = tip + (deps.ttlOffset ?? DEFAULT_TTL_OFFSET);
|
|
202
|
-
const args = { publicKey, keyType, keyLabel, popSignature };
|
|
203
|
-
return composeIdentityTx(deps, {
|
|
204
|
-
ledgerId: LEDGER.identity,
|
|
205
|
-
body: verb === "add_key" ? addKeyBody(args) : replaceKeyBody(args),
|
|
206
|
-
ttlRound: expiresAtRound,
|
|
207
|
-
signedAtRound: tip,
|
|
208
|
-
verb,
|
|
209
|
-
fields: { keyType, keyLabel },
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
export const signAddKey = (deps, p) => signKeyOp(deps, "add_key", p);
|
|
213
|
-
export const signReplaceKey = (deps, p) => signKeyOp(deps, "replace_key", p);
|
|
214
|
-
/**
|
|
215
|
-
* Remove one of this identity's own keys. ⚠️ THE CHAIN WILL NOT STOP YOU LOCKING YOURSELF OUT — its
|
|
216
|
-
* only guard refuses a committee member deleting its default consensus key.
|
|
217
|
-
*/
|
|
218
|
-
export async function signDeleteKey(deps, p) {
|
|
219
|
-
const keyType = String(p.keyType ?? "").trim();
|
|
220
|
-
if (keyType.length === 0)
|
|
221
|
-
return { kind: "partial", what: "keyType", cause: "which key?" };
|
|
222
|
-
const keyLabel = String(p.keyLabel ?? "");
|
|
223
|
-
const tip = await tipOrUnreachable(deps);
|
|
224
|
-
if (typeof tip !== "number")
|
|
225
|
-
return tip;
|
|
226
|
-
const expiresAtRound = tip + (deps.ttlOffset ?? DEFAULT_TTL_OFFSET);
|
|
227
|
-
return composeIdentityTx(deps, {
|
|
228
|
-
ledgerId: LEDGER.identity,
|
|
229
|
-
body: deleteKeyBody({ keyType, keyLabel }),
|
|
230
|
-
ttlRound: expiresAtRound,
|
|
231
|
-
signedAtRound: tip,
|
|
232
|
-
verb: "delete_key",
|
|
233
|
-
fields: { keyType, keyLabel },
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
//# sourceMappingURL=identity.js.map
|