@witnium-tech/witniumchain 0.7.0 → 0.9.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/index.d.mts +977 -1
- package/dist/index.d.ts +977 -1
- package/dist/index.js +96 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +96 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -119,6 +119,8 @@ var WitniumchainClient = class {
|
|
|
119
119
|
oauth;
|
|
120
120
|
/** MFA self-management. Accessed as `client.mfa.totp.*` and `client.mfa.recoveryCodes.*`. */
|
|
121
121
|
mfa;
|
|
122
|
+
/** Session-cookie team management (org-admin only). `client.orgUsers.*`. */
|
|
123
|
+
orgUsers;
|
|
122
124
|
constructor(config) {
|
|
123
125
|
if (!config.baseUrl) {
|
|
124
126
|
throw new Error("WitniumchainClient: baseUrl is required");
|
|
@@ -142,6 +144,7 @@ var WitniumchainClient = class {
|
|
|
142
144
|
this.keys = new SigningKeys(this);
|
|
143
145
|
this.oauth = new OauthNamespace(this);
|
|
144
146
|
this.mfa = new MfaNamespace(this);
|
|
147
|
+
this.orgUsers = new OrgMembers(this);
|
|
145
148
|
}
|
|
146
149
|
/**
|
|
147
150
|
* Convenience alias for {@link getAccount} — returns the authenticated
|
|
@@ -169,6 +172,53 @@ var WitniumchainClient = class {
|
|
|
169
172
|
createOrg(body) {
|
|
170
173
|
return this.req("POST", "/v1/orgs", { auth: "Public", body });
|
|
171
174
|
}
|
|
175
|
+
// ── Team management (session-cookie; org-admin only) ──────────────────────
|
|
176
|
+
// Backing methods for the `orgUsers` namespace. All resolve the caller's
|
|
177
|
+
// org + org-admin role server-side from the session — no orgId in the path.
|
|
178
|
+
listMembers() {
|
|
179
|
+
return this.req("GET", "/v1/orgs/me/members", { auth: "SessionCookie" });
|
|
180
|
+
}
|
|
181
|
+
inviteMember(body) {
|
|
182
|
+
return this.req("POST", "/v1/orgs/me/members/invite", {
|
|
183
|
+
auth: "SessionCookie",
|
|
184
|
+
body
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
suspendMember(userId) {
|
|
188
|
+
return this.req(
|
|
189
|
+
"POST",
|
|
190
|
+
`/v1/orgs/me/members/${encodeURIComponent(userId)}/suspend`,
|
|
191
|
+
{ auth: "SessionCookie" }
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
unsuspendMember(userId) {
|
|
195
|
+
return this.req(
|
|
196
|
+
"POST",
|
|
197
|
+
`/v1/orgs/me/members/${encodeURIComponent(userId)}/unsuspend`,
|
|
198
|
+
{ auth: "SessionCookie" }
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
setMemberRole(userId, body) {
|
|
202
|
+
return this.req(
|
|
203
|
+
"PUT",
|
|
204
|
+
`/v1/orgs/me/members/${encodeURIComponent(userId)}/role`,
|
|
205
|
+
{ auth: "SessionCookie", body }
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
removeMember(userId) {
|
|
209
|
+
return this.req(
|
|
210
|
+
"DELETE",
|
|
211
|
+
`/v1/orgs/me/members/${encodeURIComponent(userId)}`,
|
|
212
|
+
{ auth: "SessionCookie" }
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
resendMemberInvite(userId) {
|
|
216
|
+
return this.req(
|
|
217
|
+
"POST",
|
|
218
|
+
`/v1/orgs/me/members/${encodeURIComponent(userId)}/resend-invite`,
|
|
219
|
+
{ auth: "SessionCookie" }
|
|
220
|
+
);
|
|
221
|
+
}
|
|
172
222
|
verifyEmail(token) {
|
|
173
223
|
return this.req("GET", "/v1/auth/verify", {
|
|
174
224
|
auth: "Public",
|
|
@@ -423,6 +473,17 @@ var WitniumchainClient = class {
|
|
|
423
473
|
deleteAccount() {
|
|
424
474
|
return this.req("DELETE", "/v1/account", { auth: "SessionCookie" });
|
|
425
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* Re-mint a provisioning token for a verified-but-not-yet-provisioned
|
|
478
|
+
* account. Use when the token from `verifyEmail` was lost (e.g. the verify
|
|
479
|
+
* link was opened on a different device). Throws 409 if the email isn't
|
|
480
|
+
* verified or a contract already exists; rate-limited per account.
|
|
481
|
+
*/
|
|
482
|
+
reissueProvisioningToken() {
|
|
483
|
+
return this.req("POST", "/v1/account/provisioning-token/reissue", {
|
|
484
|
+
auth: "SessionCookie"
|
|
485
|
+
});
|
|
486
|
+
}
|
|
426
487
|
// ────────────────────────────────────────────────────────────────────────
|
|
427
488
|
// MFA (/v1/account/mfa/*)
|
|
428
489
|
//
|
|
@@ -1241,6 +1302,40 @@ var MfaNamespace = class {
|
|
|
1241
1302
|
this.recoveryCodes = new MfaRecoveryCodes(client);
|
|
1242
1303
|
}
|
|
1243
1304
|
};
|
|
1305
|
+
var OrgMembers = class {
|
|
1306
|
+
constructor(client) {
|
|
1307
|
+
this.client = client;
|
|
1308
|
+
}
|
|
1309
|
+
client;
|
|
1310
|
+
/** List the caller's org members (role, suspendedAt, isOwner, keys). */
|
|
1311
|
+
list() {
|
|
1312
|
+
return this.client.listMembers();
|
|
1313
|
+
}
|
|
1314
|
+
/** Invite a member by email (default role `member`). */
|
|
1315
|
+
invite(body) {
|
|
1316
|
+
return this.client.inviteMember(body);
|
|
1317
|
+
}
|
|
1318
|
+
/** Suspend a member (reversible). The owner cannot be suspended. */
|
|
1319
|
+
suspend(userId) {
|
|
1320
|
+
return this.client.suspendMember(userId);
|
|
1321
|
+
}
|
|
1322
|
+
/** Lift a member's suspension. */
|
|
1323
|
+
unsuspend(userId) {
|
|
1324
|
+
return this.client.unsuspendMember(userId);
|
|
1325
|
+
}
|
|
1326
|
+
/** Set a member's role. Refuses to demote the owner. */
|
|
1327
|
+
setRole(userId, role) {
|
|
1328
|
+
return this.client.setMemberRole(userId, { role });
|
|
1329
|
+
}
|
|
1330
|
+
/** Remove a member (terminal; revokes their delegated keys). Owner protected. */
|
|
1331
|
+
remove(userId) {
|
|
1332
|
+
return this.client.removeMember(userId);
|
|
1333
|
+
}
|
|
1334
|
+
/** Re-mint an email-verify token for a pending member. */
|
|
1335
|
+
resendInvite(userId) {
|
|
1336
|
+
return this.client.resendMemberInvite(userId);
|
|
1337
|
+
}
|
|
1338
|
+
};
|
|
1244
1339
|
var MfaTotp = class {
|
|
1245
1340
|
constructor(client) {
|
|
1246
1341
|
this.client = client;
|
|
@@ -1558,6 +1653,6 @@ function buildRevokeSigningKeyPayload(args) {
|
|
|
1558
1653
|
});
|
|
1559
1654
|
}
|
|
1560
1655
|
|
|
1561
|
-
export { DelegatedKeys, MfaNamespace, MfaRecoveryCodes, MfaTotp, OWNER_OP, OauthNamespace, OauthSessions, OrgUsers, SigningKeys, Subscriptions, WitniumchainAdminClient, WitniumchainApiError, WitniumchainChainAdminClient, WitniumchainClient, WitniumchainOrgClient, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage };
|
|
1656
|
+
export { DelegatedKeys, MfaNamespace, MfaRecoveryCodes, MfaTotp, OWNER_OP, OauthNamespace, OauthSessions, OrgMembers, OrgUsers, SigningKeys, Subscriptions, WitniumchainAdminClient, WitniumchainApiError, WitniumchainChainAdminClient, WitniumchainClient, WitniumchainOrgClient, buildAddSigningKeyPayload, buildPausePayload, buildRevokeSigningKeyPayload, buildUnpausePayload, defaultVerifierStorage };
|
|
1562
1657
|
//# sourceMappingURL=index.mjs.map
|
|
1563
1658
|
//# sourceMappingURL=index.mjs.map
|