@vibes.diy/identity 3.0.3 → 4.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 +5 -5
- package/clerk-claim.d.ts +1 -0
- package/clerk-claim.js.map +1 -1
- package/dash-api/clerk-token.d.ts +1 -1
- package/dash-api/clerk-token.js +1 -1
- package/dash-api/clerk-token.js.map +1 -1
- package/dash-api/dash-client.d.ts +1 -1
- package/dash-api/dash-client.js.map +1 -1
- package/dash-api/protocols-base-jwt.d.ts +23 -0
- package/dash-api/protocols-base-jwt.js +13 -0
- package/dash-api/protocols-base-jwt.js.map +1 -0
- package/dash-api/protocols-cloud-types.d.ts +127 -0
- package/dash-api/protocols-cloud-types.js +45 -0
- package/dash-api/protocols-cloud-types.js.map +1 -0
- package/dash-api/protocols-dashboard/dash-types.d.ts +27 -0
- package/dash-api/protocols-dashboard/dash-types.js +2 -0
- package/dash-api/protocols-dashboard/dash-types.js.map +1 -0
- package/dash-api/protocols-dashboard/fp-api-interface.d.ts +24 -0
- package/dash-api/protocols-dashboard/fp-api-interface.js +2 -0
- package/dash-api/protocols-dashboard/fp-api-interface.js.map +1 -0
- package/dash-api/protocols-dashboard/index.d.ts +13 -0
- package/dash-api/protocols-dashboard/index.js +6 -0
- package/dash-api/protocols-dashboard/index.js.map +1 -0
- package/dash-api/protocols-dashboard/msg-is.d.ts +68 -0
- package/dash-api/protocols-dashboard/msg-is.js +184 -0
- package/dash-api/protocols-dashboard/msg-is.js.map +1 -0
- package/dash-api/protocols-dashboard/msg-types.d.ts +429 -0
- package/dash-api/protocols-dashboard/msg-types.js +4 -0
- package/dash-api/protocols-dashboard/msg-types.js.map +1 -0
- package/dash-api/protocols-dashboard/token.d.ts +37 -0
- package/dash-api/protocols-dashboard/token.js +7 -0
- package/dash-api/protocols-dashboard/token.js.map +1 -0
- package/dash-api/token.d.ts +3 -3
- package/dash-api/token.js +8 -1
- package/dash-api/token.js.map +1 -1
- package/device-id/ca.d.ts +6 -2
- package/device-id/ca.js.map +1 -1
- package/device-id/certor.d.ts +3 -2
- package/device-id/certor.js.map +1 -1
- package/device-id/csr.d.ts +2 -1
- package/device-id/csr.js.map +1 -1
- package/device-id/device-id-wire-golden.fixture.json +23 -0
- package/device-id/key.d.ts +2 -2
- package/device-id/key.js +1 -1
- package/device-id/key.js.map +1 -1
- package/device-id/register-golden.test.d.ts +1 -0
- package/device-id/register-golden.test.js +98 -0
- package/device-id/register-golden.test.js.map +1 -0
- package/device-id/register.d.ts +22 -0
- package/device-id/register.js +162 -0
- package/device-id/register.js.map +1 -0
- package/device-id/sign.d.ts +3 -1
- package/device-id/sign.js.map +1 -1
- package/device-id/test-helpers.d.ts +19 -0
- package/device-id/test-helpers.js +72 -0
- package/device-id/test-helpers.js.map +1 -0
- package/device-id/validator.d.ts +2 -1
- package/device-id/validator.js +1 -1
- package/device-id/validator.js.map +1 -1
- package/device-id/verify.d.ts +3 -2
- package/device-id/verify.js +1 -1
- package/device-id/verify.js.map +1 -1
- package/device-id/wire-golden.test.d.ts +1 -0
- package/device-id/wire-golden.test.js +20 -0
- package/device-id/wire-golden.test.js.map +1 -0
- package/golden-fixtures.d.ts +21 -0
- package/golden-fixtures.js +48 -0
- package/golden-fixtures.js.map +1 -0
- package/index.d.ts +8 -4
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/keybag/key-bag-file.d.ts +1 -1
- package/keybag/key-bag-memory.d.ts +1 -1
- package/keybag/key-bag.d.ts +3 -1
- package/keybag/key-bag.js.map +1 -1
- package/keybag/keybag-golden.fixture.json +70 -70
- package/keybag/keybag-golden.test.js +9 -9
- package/keybag/keybag-golden.test.js.map +1 -1
- package/keybag/keybag.d.ts +1 -1
- package/keybag/sys-file-system/deno-filesystem.d.ts +1 -1
- package/keybag/sys-file-system/factory.d.ts +1 -1
- package/keybag/sys-file-system/node-filesystem.d.ts +1 -1
- package/node.d.ts +4 -4
- package/node.js +1 -1
- package/node.js.map +1 -1
- package/package.json +9 -8
- package/runtime/superthis.d.ts +10 -0
- package/runtime/superthis.js +276 -0
- package/runtime/superthis.js.map +1 -0
- package/runtime/superthis.test.d.ts +1 -0
- package/runtime/superthis.test.js +47 -0
- package/runtime/superthis.test.js.map +1 -0
- package/runtime-context.d.ts +1 -1
- package/runtime-context.js +1 -1
- package/runtime-context.js.map +1 -1
- package/server.d.ts +1 -1
- package/server.js +1 -1
- package/server.js.map +1 -1
- package/sts/index.d.ts +53 -0
- package/sts/index.js +312 -0
- package/sts/index.js.map +1 -0
- package/sts/sts-golden.test.d.ts +1 -0
- package/sts/sts-golden.test.js +63 -0
- package/sts/sts-golden.test.js.map +1 -0
- package/sts/text-blocks.d.ts +10 -0
- package/sts/text-blocks.js +90 -0
- package/sts/text-blocks.js.map +1 -0
- package/testing.d.ts +7 -0
- package/testing.js +7 -0
- package/testing.js.map +1 -0
- package/types/cert-payload.d.ts +45 -1
- package/types/cert-payload.js.map +1 -1
- package/types/device-id-payload.d.ts +67 -1
- package/types/device-id-payload.js.map +1 -1
- package/types/device-id-payload.test.js +5 -17
- package/types/device-id-payload.test.js.map +1 -1
- package/types/device-id-types.d.ts +93 -0
- package/types/device-id-types.js +2 -0
- package/types/device-id-types.js.map +1 -0
- package/types/keybag-item.d.ts +15 -0
- package/types/keybag-item.js +2 -0
- package/types/keybag-item.js.map +1 -0
- package/types/sthis.d.ts +84 -0
- package/types/sthis.js +2 -0
- package/types/sthis.js.map +1 -0
- package/types/wire.d.ts +53 -1
- package/types/wire.js.map +1 -1
- package/types/wire.test.js +5 -9
- package/types/wire.test.js.map +1 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { Result, Option } from "@adviser/cement";
|
|
2
|
+
function hasType(jso, t) {
|
|
3
|
+
return typeof jso === "object" && jso !== null && jso.type === t;
|
|
4
|
+
}
|
|
5
|
+
export async function validateDeleteTenant(jso) {
|
|
6
|
+
if (hasType(jso, "reqDeleteTenant")) {
|
|
7
|
+
return Result.Ok(Option.Some(jso));
|
|
8
|
+
}
|
|
9
|
+
return Result.Ok(Option.None());
|
|
10
|
+
}
|
|
11
|
+
export async function validateUpdateTenant(jso) {
|
|
12
|
+
if (hasType(jso, "reqUpdateTenant")) {
|
|
13
|
+
return Result.Ok(Option.Some(jso));
|
|
14
|
+
}
|
|
15
|
+
return Result.Ok(Option.None());
|
|
16
|
+
}
|
|
17
|
+
export async function validateCreateTenant(jso) {
|
|
18
|
+
if (hasType(jso, "reqCreateTenant")) {
|
|
19
|
+
return Result.Ok(Option.Some(jso));
|
|
20
|
+
}
|
|
21
|
+
return Result.Ok(Option.None());
|
|
22
|
+
}
|
|
23
|
+
export async function validateCreateLedger(jso) {
|
|
24
|
+
if (hasType(jso, "reqCreateLedger")) {
|
|
25
|
+
return Result.Ok(Option.Some(jso));
|
|
26
|
+
}
|
|
27
|
+
return Result.Ok(Option.None());
|
|
28
|
+
}
|
|
29
|
+
export async function validateDeleteLedger(jso) {
|
|
30
|
+
if (hasType(jso, "reqDeleteLedger")) {
|
|
31
|
+
return Result.Ok(Option.Some(jso));
|
|
32
|
+
}
|
|
33
|
+
return Result.Ok(Option.None());
|
|
34
|
+
}
|
|
35
|
+
export async function validateUpdateLedger(jso) {
|
|
36
|
+
if (hasType(jso, "reqUpdateLedger")) {
|
|
37
|
+
return Result.Ok(Option.Some(jso));
|
|
38
|
+
}
|
|
39
|
+
return Result.Ok(Option.None());
|
|
40
|
+
}
|
|
41
|
+
export async function validateListInvites(jso) {
|
|
42
|
+
if (hasType(jso, "reqListInvites")) {
|
|
43
|
+
return Result.Ok(Option.Some(jso));
|
|
44
|
+
}
|
|
45
|
+
return Result.Ok(Option.None());
|
|
46
|
+
}
|
|
47
|
+
export async function validateInviteUser(jso) {
|
|
48
|
+
if (hasType(jso, "reqInviteUser")) {
|
|
49
|
+
return Result.Ok(Option.Some(jso));
|
|
50
|
+
}
|
|
51
|
+
return Result.Ok(Option.None());
|
|
52
|
+
}
|
|
53
|
+
export async function validateFindUser(jso) {
|
|
54
|
+
if (hasType(jso, "reqFindUser")) {
|
|
55
|
+
return Result.Ok(Option.Some(jso));
|
|
56
|
+
}
|
|
57
|
+
return Result.Ok(Option.None());
|
|
58
|
+
}
|
|
59
|
+
export async function validateRedeemInvite(jso) {
|
|
60
|
+
if (hasType(jso, "reqRedeemInvite")) {
|
|
61
|
+
return Result.Ok(Option.Some(jso));
|
|
62
|
+
}
|
|
63
|
+
return Result.Ok(Option.None());
|
|
64
|
+
}
|
|
65
|
+
export async function validateListTenantsByUser(jso) {
|
|
66
|
+
if (hasType(jso, "reqListTenantsByUser")) {
|
|
67
|
+
return Result.Ok(Option.Some(jso));
|
|
68
|
+
}
|
|
69
|
+
return Result.Ok(Option.None());
|
|
70
|
+
}
|
|
71
|
+
export async function validateUpdateUserTenant(jso) {
|
|
72
|
+
if (hasType(jso, "reqUpdateUserTenant")) {
|
|
73
|
+
return Result.Ok(Option.Some(jso));
|
|
74
|
+
}
|
|
75
|
+
return Result.Ok(Option.None());
|
|
76
|
+
}
|
|
77
|
+
export async function validateListLedgersByUser(jso) {
|
|
78
|
+
if (hasType(jso, "reqListLedgersByUser")) {
|
|
79
|
+
return Result.Ok(Option.Some(jso));
|
|
80
|
+
}
|
|
81
|
+
return Result.Ok(Option.None());
|
|
82
|
+
}
|
|
83
|
+
export async function validateDeleteInvite(jso) {
|
|
84
|
+
if (hasType(jso, "reqDeleteInvite")) {
|
|
85
|
+
return Result.Ok(Option.Some(jso));
|
|
86
|
+
}
|
|
87
|
+
return Result.Ok(Option.None());
|
|
88
|
+
}
|
|
89
|
+
export async function validateCloudSessionToken(jso) {
|
|
90
|
+
if (hasType(jso, "reqCloudSessionToken")) {
|
|
91
|
+
return Result.Ok(Option.Some(jso));
|
|
92
|
+
}
|
|
93
|
+
return Result.Ok(Option.None());
|
|
94
|
+
}
|
|
95
|
+
export async function validateTokenByResultId(jso) {
|
|
96
|
+
if (hasType(jso, "reqTokenByResultId")) {
|
|
97
|
+
return Result.Ok(Option.Some(jso));
|
|
98
|
+
}
|
|
99
|
+
return Result.Ok(Option.None());
|
|
100
|
+
}
|
|
101
|
+
export async function validateCertFromCsr(jso) {
|
|
102
|
+
if (hasType(jso, "reqCertFromCsr")) {
|
|
103
|
+
return Result.Ok(Option.Some(jso));
|
|
104
|
+
}
|
|
105
|
+
return Result.Ok(Option.None());
|
|
106
|
+
}
|
|
107
|
+
export async function validateEnsureUser(jso) {
|
|
108
|
+
if (hasType(jso, "reqEnsureUser")) {
|
|
109
|
+
return Result.Ok(Option.Some(jso));
|
|
110
|
+
}
|
|
111
|
+
return Result.Ok(Option.None());
|
|
112
|
+
}
|
|
113
|
+
export async function validateEnsureCloudToken(jso) {
|
|
114
|
+
if (hasType(jso, "reqEnsureCloudToken")) {
|
|
115
|
+
return Result.Ok(Option.Some(jso));
|
|
116
|
+
}
|
|
117
|
+
return Result.Ok(Option.None());
|
|
118
|
+
}
|
|
119
|
+
export class FAPIMsgImpl {
|
|
120
|
+
isDeleteTenant(jso) {
|
|
121
|
+
return hasType(jso, "reqDeleteTenant");
|
|
122
|
+
}
|
|
123
|
+
isUpdateTenant(jso) {
|
|
124
|
+
return hasType(jso, "reqUpdateTenant");
|
|
125
|
+
}
|
|
126
|
+
isCreateTenant(jso) {
|
|
127
|
+
return hasType(jso, "reqCreateTenant");
|
|
128
|
+
}
|
|
129
|
+
isDeleteInvite(jso) {
|
|
130
|
+
return hasType(jso, "reqDeleteInvite");
|
|
131
|
+
}
|
|
132
|
+
isListInvites(jso) {
|
|
133
|
+
return hasType(jso, "reqListInvites");
|
|
134
|
+
}
|
|
135
|
+
isInviteUser(jso) {
|
|
136
|
+
return hasType(jso, "reqInviteUser");
|
|
137
|
+
}
|
|
138
|
+
isFindUser(jso) {
|
|
139
|
+
return hasType(jso, "reqFindUser");
|
|
140
|
+
}
|
|
141
|
+
isRedeemInvite(jso) {
|
|
142
|
+
return hasType(jso, "reqRedeemInvite");
|
|
143
|
+
}
|
|
144
|
+
isEnsureUser(jso) {
|
|
145
|
+
return hasType(jso, "reqEnsureUser");
|
|
146
|
+
}
|
|
147
|
+
isListTenantsByUser(jso) {
|
|
148
|
+
return hasType(jso, "reqListTenantsByUser");
|
|
149
|
+
}
|
|
150
|
+
isUpdateUserTenant(jso) {
|
|
151
|
+
return hasType(jso, "reqUpdateUserTenant");
|
|
152
|
+
}
|
|
153
|
+
isListLedgersByUser(jso) {
|
|
154
|
+
return hasType(jso, "reqListLedgersByUser");
|
|
155
|
+
}
|
|
156
|
+
isCreateLedger(jso) {
|
|
157
|
+
return hasType(jso, "reqCreateLedger");
|
|
158
|
+
}
|
|
159
|
+
isUpdateLedger(jso) {
|
|
160
|
+
return hasType(jso, "reqUpdateLedger");
|
|
161
|
+
}
|
|
162
|
+
isDeleteLedger(jso) {
|
|
163
|
+
return hasType(jso, "reqDeleteLedger");
|
|
164
|
+
}
|
|
165
|
+
isCloudSessionToken(jso) {
|
|
166
|
+
return hasType(jso, "reqCloudSessionToken");
|
|
167
|
+
}
|
|
168
|
+
isReqTokenByResultId(jso) {
|
|
169
|
+
return hasType(jso, "reqTokenByResultId");
|
|
170
|
+
}
|
|
171
|
+
isResTokenByResultId(jso) {
|
|
172
|
+
return hasType(jso, "resTokenByResultId");
|
|
173
|
+
}
|
|
174
|
+
isReqExtendToken(jso) {
|
|
175
|
+
return hasType(jso, "reqExtendToken");
|
|
176
|
+
}
|
|
177
|
+
isReqCertFromCsr(jso) {
|
|
178
|
+
return hasType(jso, "reqCertFromCsr");
|
|
179
|
+
}
|
|
180
|
+
isEnsureCloudToken(jso) {
|
|
181
|
+
return hasType(jso, "reqEnsureCloudToken");
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=msg-is.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msg-is.js","sourceRoot":"","sources":["../../../jsr/dash-api/protocols-dashboard/msg-is.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAA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Y;QAC/B,OAAO,OAAO,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;IAC5C,CAAC;IACD,gBAAgB,CAAC,GAAY;QAC3B,OAAO,OAAO,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IACxC,CAAC;IACD,gBAAgB,CAAC,GAAY;QAC3B,OAAO,OAAO,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IACxC,CAAC;IACD,kBAAkB,CAAC,GAAY;QAC7B,OAAO,OAAO,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import { ClerkEmailTemplateClaim } from "../../clerk-claim.js";
|
|
2
|
+
import { JWKPublic } from "../../types/wire.js";
|
|
3
|
+
import { FPCloudClaim, ReadWrite, Role, TenantLedger } from "../protocols-cloud-types.js";
|
|
4
|
+
export type AuthProvider = "github" | "google" | "fp" | "invite-per-email" | "device-id";
|
|
5
|
+
export interface Queryable {
|
|
6
|
+
readonly userId?: string;
|
|
7
|
+
readonly queryProvider?: AuthProvider;
|
|
8
|
+
readonly queryEmail?: string;
|
|
9
|
+
readonly queryNick?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface QueryUser {
|
|
12
|
+
readonly byString?: string;
|
|
13
|
+
readonly existingUserId?: string;
|
|
14
|
+
readonly byEmail?: string;
|
|
15
|
+
readonly byNick?: string;
|
|
16
|
+
readonly andProvider?: AuthProvider;
|
|
17
|
+
}
|
|
18
|
+
export interface Tenant {
|
|
19
|
+
readonly tenantId: string;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly ownerUserId: string;
|
|
22
|
+
readonly adminUserIds: string[];
|
|
23
|
+
readonly memberUserIds: string[];
|
|
24
|
+
readonly maxAdminUsers: number;
|
|
25
|
+
readonly maxMemberUsers: number;
|
|
26
|
+
readonly maxLedgers: number;
|
|
27
|
+
readonly createdAt: Date;
|
|
28
|
+
readonly updatedAt: Date;
|
|
29
|
+
}
|
|
30
|
+
export type InviteTicketStatus = "pending" | "accepted" | "rejected" | "expired";
|
|
31
|
+
export interface SqlInvitedParams {
|
|
32
|
+
readonly tenant?: {
|
|
33
|
+
readonly role: "admin" | "member";
|
|
34
|
+
};
|
|
35
|
+
readonly ledger?: {
|
|
36
|
+
readonly role: "admin" | "member";
|
|
37
|
+
readonly right: "read" | "write";
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface InvitedParams {
|
|
41
|
+
readonly tenant?: SqlInvitedParams["tenant"] & {
|
|
42
|
+
readonly id: string;
|
|
43
|
+
};
|
|
44
|
+
readonly ledger?: SqlInvitedParams["ledger"] & {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface InviteTicket {
|
|
49
|
+
readonly inviteId: string;
|
|
50
|
+
readonly sendEmailCount: number;
|
|
51
|
+
readonly inviterUserId: string;
|
|
52
|
+
readonly query: QueryUser;
|
|
53
|
+
readonly status: InviteTicketStatus;
|
|
54
|
+
readonly statusReason: string;
|
|
55
|
+
readonly invitedUserId?: string;
|
|
56
|
+
readonly invitedParams: InvitedParams;
|
|
57
|
+
readonly expiresAfter: Date;
|
|
58
|
+
readonly createdAt: Date;
|
|
59
|
+
readonly updatedAt: Date;
|
|
60
|
+
}
|
|
61
|
+
export type UserStatus = "active" | "inactive" | "banned" | "invited";
|
|
62
|
+
export interface DashAuthType {
|
|
63
|
+
readonly type: "ucan" | "clerk" | "device-id";
|
|
64
|
+
readonly token: string;
|
|
65
|
+
}
|
|
66
|
+
export interface User {
|
|
67
|
+
readonly userId: string;
|
|
68
|
+
readonly maxTenants: number;
|
|
69
|
+
readonly status: UserStatus;
|
|
70
|
+
readonly statusReason?: string;
|
|
71
|
+
readonly createdAt: Date;
|
|
72
|
+
readonly updatedAt: Date;
|
|
73
|
+
readonly byProviders: UserByProvider[];
|
|
74
|
+
}
|
|
75
|
+
export interface UserByProvider extends Queryable {
|
|
76
|
+
readonly providerUserId: string;
|
|
77
|
+
readonly cleanEmail?: string;
|
|
78
|
+
readonly cleanNick?: string;
|
|
79
|
+
readonly queryProvider: AuthProvider;
|
|
80
|
+
readonly queryEmail?: string;
|
|
81
|
+
readonly queryNick?: string;
|
|
82
|
+
readonly params: ClerkEmailTemplateClaim;
|
|
83
|
+
readonly used: Date;
|
|
84
|
+
readonly createdAt: Date;
|
|
85
|
+
readonly updatedAt: Date;
|
|
86
|
+
}
|
|
87
|
+
export interface ResCreateTenant {
|
|
88
|
+
readonly type: "resCreateTenant";
|
|
89
|
+
readonly tenant: OutTenantParams;
|
|
90
|
+
}
|
|
91
|
+
export interface FPApiParameters {
|
|
92
|
+
cloudPublicKeys: JWKPublic[];
|
|
93
|
+
clerkPublishableKey: string;
|
|
94
|
+
maxTenants: number;
|
|
95
|
+
maxAdminUsers: number;
|
|
96
|
+
maxMemberUsers: number;
|
|
97
|
+
maxInvites: number;
|
|
98
|
+
maxLedgers: number;
|
|
99
|
+
maxAppIdBindings: number;
|
|
100
|
+
}
|
|
101
|
+
export interface InCreateTenantParams {
|
|
102
|
+
readonly name?: string;
|
|
103
|
+
readonly ownerUserId: string;
|
|
104
|
+
readonly defaultTenant?: boolean;
|
|
105
|
+
}
|
|
106
|
+
export interface ReqCreateTenant {
|
|
107
|
+
readonly type: "reqCreateTenant";
|
|
108
|
+
readonly auth: DashAuthType;
|
|
109
|
+
readonly tenant: Omit<InCreateTenantParams, "ownerUserId">;
|
|
110
|
+
}
|
|
111
|
+
export interface InUpdateTenantParams {
|
|
112
|
+
readonly tenantId: string;
|
|
113
|
+
readonly name?: string;
|
|
114
|
+
readonly maxAdminUsers?: number;
|
|
115
|
+
readonly maxMemberUsers?: number;
|
|
116
|
+
readonly maxInvites?: number;
|
|
117
|
+
}
|
|
118
|
+
export interface ResUpdateTenant {
|
|
119
|
+
readonly type: "resUpdateTenant";
|
|
120
|
+
readonly tenant: OutTenantParams;
|
|
121
|
+
}
|
|
122
|
+
export interface ReqUpdateTenant {
|
|
123
|
+
readonly type: "reqUpdateTenant";
|
|
124
|
+
readonly auth: DashAuthType;
|
|
125
|
+
readonly tenant: InUpdateTenantParams;
|
|
126
|
+
}
|
|
127
|
+
export interface ResEnsureTenant {
|
|
128
|
+
readonly type: "resEnsureTenant";
|
|
129
|
+
readonly tenant: Tenant;
|
|
130
|
+
}
|
|
131
|
+
export interface ReqRedeemInvite {
|
|
132
|
+
readonly type: "reqRedeemInvite";
|
|
133
|
+
readonly auth: DashAuthType;
|
|
134
|
+
}
|
|
135
|
+
export interface ResRedeemInvite {
|
|
136
|
+
readonly type: "resRedeemInvite";
|
|
137
|
+
readonly invites?: InviteTicket[];
|
|
138
|
+
}
|
|
139
|
+
export interface ReqListLedgersByUser {
|
|
140
|
+
readonly type: "reqListLedgersByUser";
|
|
141
|
+
readonly auth: DashAuthType;
|
|
142
|
+
readonly tenantIds?: string[];
|
|
143
|
+
}
|
|
144
|
+
interface LedgerUserRight {
|
|
145
|
+
readonly userId: string;
|
|
146
|
+
readonly role: Role;
|
|
147
|
+
readonly right: ReadWrite;
|
|
148
|
+
readonly name?: string;
|
|
149
|
+
readonly default: boolean;
|
|
150
|
+
readonly createdAt: Date;
|
|
151
|
+
readonly updatedAt: Date;
|
|
152
|
+
}
|
|
153
|
+
export interface LedgerUser {
|
|
154
|
+
readonly ledgerId: string;
|
|
155
|
+
readonly tenantId: string;
|
|
156
|
+
readonly name: string;
|
|
157
|
+
readonly ownerId: string;
|
|
158
|
+
readonly maxShares: number;
|
|
159
|
+
readonly users: LedgerUserRight[];
|
|
160
|
+
readonly createdAt: Date;
|
|
161
|
+
readonly updatedAt: Date;
|
|
162
|
+
}
|
|
163
|
+
export interface ResListLedgersByUser {
|
|
164
|
+
readonly type: "resListLedgersByUser";
|
|
165
|
+
readonly userId: string;
|
|
166
|
+
readonly ledgers: LedgerUser[];
|
|
167
|
+
}
|
|
168
|
+
export interface ReqListTenantsByUser {
|
|
169
|
+
readonly type: "reqListTenantsByUser";
|
|
170
|
+
readonly auth: DashAuthType;
|
|
171
|
+
}
|
|
172
|
+
export interface UserTenantCommon {
|
|
173
|
+
readonly name?: string;
|
|
174
|
+
readonly status: UserStatus;
|
|
175
|
+
readonly statusReason: string;
|
|
176
|
+
readonly createdAt: Date;
|
|
177
|
+
readonly updatedAt: Date;
|
|
178
|
+
}
|
|
179
|
+
export interface TenantLimits {
|
|
180
|
+
readonly maxAdminUsers: number;
|
|
181
|
+
readonly maxMemberUsers: number;
|
|
182
|
+
readonly maxInvites: number;
|
|
183
|
+
readonly maxLedgers: number;
|
|
184
|
+
}
|
|
185
|
+
export interface UserTenant {
|
|
186
|
+
readonly tenantId: string;
|
|
187
|
+
readonly role: Role;
|
|
188
|
+
readonly default: boolean;
|
|
189
|
+
readonly user: UserTenantCommon & {
|
|
190
|
+
readonly limits: {
|
|
191
|
+
readonly maxTenants: number;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
readonly tenant: UserTenantCommon & {
|
|
195
|
+
readonly limits: TenantLimits;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
export declare function isAdmin(ut: UserTenant): boolean;
|
|
199
|
+
export interface AdminTenant extends UserTenant {
|
|
200
|
+
readonly role: "admin";
|
|
201
|
+
readonly adminUserIds: string[];
|
|
202
|
+
readonly memberUserIds: string[];
|
|
203
|
+
readonly maxAdminUsers: number;
|
|
204
|
+
readonly maxMemberUsers: number;
|
|
205
|
+
}
|
|
206
|
+
export interface ResListTenantsByUser {
|
|
207
|
+
readonly type: "resListTenantsByUser";
|
|
208
|
+
readonly userId: string;
|
|
209
|
+
readonly authUserId: string;
|
|
210
|
+
readonly tenants: (AdminTenant | UserTenant)[];
|
|
211
|
+
}
|
|
212
|
+
export interface ReqFindUser {
|
|
213
|
+
readonly type: "reqFindUser";
|
|
214
|
+
readonly auth: DashAuthType;
|
|
215
|
+
readonly query: QueryUser;
|
|
216
|
+
}
|
|
217
|
+
export interface ResFindUser {
|
|
218
|
+
readonly type: "resFindUser";
|
|
219
|
+
readonly query: QueryUser;
|
|
220
|
+
readonly results: User[];
|
|
221
|
+
}
|
|
222
|
+
export interface QueryInviteTicket {
|
|
223
|
+
readonly incSendEmailCount?: boolean;
|
|
224
|
+
readonly inviteId?: string;
|
|
225
|
+
readonly query: QueryUser;
|
|
226
|
+
readonly invitedParams: InvitedParams;
|
|
227
|
+
}
|
|
228
|
+
export interface ReqInviteUser {
|
|
229
|
+
readonly type: "reqInviteUser";
|
|
230
|
+
readonly auth: DashAuthType;
|
|
231
|
+
readonly ticket: QueryInviteTicket;
|
|
232
|
+
}
|
|
233
|
+
export interface ResInviteUser {
|
|
234
|
+
readonly type: "resInviteUser";
|
|
235
|
+
readonly invite: InviteTicket;
|
|
236
|
+
}
|
|
237
|
+
export interface ReqDeleteInvite {
|
|
238
|
+
readonly type: "reqDeleteInvite";
|
|
239
|
+
readonly auth: DashAuthType;
|
|
240
|
+
readonly inviteId: string;
|
|
241
|
+
}
|
|
242
|
+
export interface ResDeleteInvite {
|
|
243
|
+
readonly type: "resDeleteInvite";
|
|
244
|
+
readonly inviteId: string;
|
|
245
|
+
}
|
|
246
|
+
export interface ReqListInvites {
|
|
247
|
+
readonly type: "reqListInvites";
|
|
248
|
+
readonly auth: DashAuthType;
|
|
249
|
+
readonly tenantIds?: string[];
|
|
250
|
+
readonly ledgerIds?: string[];
|
|
251
|
+
}
|
|
252
|
+
export interface ResListInvites {
|
|
253
|
+
readonly type: "resListInvites";
|
|
254
|
+
readonly tickets: InviteTicket[];
|
|
255
|
+
}
|
|
256
|
+
export interface ReqUpdateUserTenant {
|
|
257
|
+
readonly type: "reqUpdateUserTenant";
|
|
258
|
+
readonly auth: DashAuthType;
|
|
259
|
+
readonly tenantId: string;
|
|
260
|
+
readonly userId?: string;
|
|
261
|
+
readonly role: Role;
|
|
262
|
+
readonly default?: boolean;
|
|
263
|
+
readonly name?: string;
|
|
264
|
+
}
|
|
265
|
+
export interface ResUpdateUserTenant {
|
|
266
|
+
readonly type: "resUpdateUserTenant";
|
|
267
|
+
readonly tenantId: string;
|
|
268
|
+
readonly userId: string;
|
|
269
|
+
readonly role: Role;
|
|
270
|
+
readonly default: boolean;
|
|
271
|
+
readonly name?: string;
|
|
272
|
+
}
|
|
273
|
+
export interface CreateLedger {
|
|
274
|
+
readonly tenantId: string;
|
|
275
|
+
readonly name: string;
|
|
276
|
+
}
|
|
277
|
+
export interface ReqCreateLedger {
|
|
278
|
+
readonly type: "reqCreateLedger";
|
|
279
|
+
readonly auth: DashAuthType;
|
|
280
|
+
readonly ledger: CreateLedger;
|
|
281
|
+
}
|
|
282
|
+
export interface ResCreateLedger {
|
|
283
|
+
readonly type: "resCreateLedger";
|
|
284
|
+
readonly ledger: LedgerUser;
|
|
285
|
+
}
|
|
286
|
+
export interface UpdateLedger {
|
|
287
|
+
readonly ledgerId: string;
|
|
288
|
+
readonly tenantId: string;
|
|
289
|
+
readonly right?: ReadWrite;
|
|
290
|
+
readonly role?: Role;
|
|
291
|
+
readonly name?: string;
|
|
292
|
+
readonly default?: boolean;
|
|
293
|
+
}
|
|
294
|
+
export interface ReqUpdateLedger {
|
|
295
|
+
readonly type: "reqUpdateLedger";
|
|
296
|
+
readonly auth: DashAuthType;
|
|
297
|
+
readonly ledger: UpdateLedger;
|
|
298
|
+
}
|
|
299
|
+
export interface ResUpdateLedger {
|
|
300
|
+
readonly type: "resUpdateLedger";
|
|
301
|
+
readonly ledger: LedgerUser;
|
|
302
|
+
}
|
|
303
|
+
export interface DeleteLedger {
|
|
304
|
+
readonly ledgerId: string;
|
|
305
|
+
readonly tenantId: string;
|
|
306
|
+
}
|
|
307
|
+
export interface ReqDeleteLedger {
|
|
308
|
+
readonly type: "reqDeleteLedger";
|
|
309
|
+
readonly auth: DashAuthType;
|
|
310
|
+
readonly ledger: DeleteLedger;
|
|
311
|
+
}
|
|
312
|
+
export interface ResDeleteLedger {
|
|
313
|
+
readonly type: "resDeleteLedger";
|
|
314
|
+
}
|
|
315
|
+
export interface ReqCloudSessionToken {
|
|
316
|
+
readonly type: "reqCloudSessionToken";
|
|
317
|
+
readonly auth: DashAuthType;
|
|
318
|
+
readonly selected?: Partial<TenantLedger>;
|
|
319
|
+
readonly resultId?: string;
|
|
320
|
+
}
|
|
321
|
+
export interface ResCloudSessionToken {
|
|
322
|
+
readonly type: "resCloudSessionToken";
|
|
323
|
+
readonly token: string;
|
|
324
|
+
}
|
|
325
|
+
export interface ReqTokenByResultId {
|
|
326
|
+
readonly type: "reqTokenByResultId";
|
|
327
|
+
readonly resultId: string;
|
|
328
|
+
}
|
|
329
|
+
export interface ResTokenByResultId {
|
|
330
|
+
readonly type: "resTokenByResultId";
|
|
331
|
+
readonly status: "found" | "not-found";
|
|
332
|
+
readonly resultId: string;
|
|
333
|
+
readonly token?: string;
|
|
334
|
+
}
|
|
335
|
+
export interface ResDeleteTenant {
|
|
336
|
+
readonly type: "resDeleteTenant";
|
|
337
|
+
readonly tenantId: string;
|
|
338
|
+
}
|
|
339
|
+
export interface ReqDeleteTenant {
|
|
340
|
+
readonly type: "reqDeleteTenant";
|
|
341
|
+
readonly auth: DashAuthType;
|
|
342
|
+
readonly tenantId: string;
|
|
343
|
+
}
|
|
344
|
+
export interface OutTenantParams {
|
|
345
|
+
readonly tenantId: string;
|
|
346
|
+
readonly name: string;
|
|
347
|
+
readonly ownerUserId: string;
|
|
348
|
+
readonly maxAdminUsers: number;
|
|
349
|
+
readonly maxMemberUsers: number;
|
|
350
|
+
readonly maxInvites: number;
|
|
351
|
+
readonly maxLedgers: number;
|
|
352
|
+
readonly status: UserStatus;
|
|
353
|
+
readonly statusReason: string;
|
|
354
|
+
readonly createdAt: Date;
|
|
355
|
+
readonly updatedAt: Date;
|
|
356
|
+
}
|
|
357
|
+
export interface ResEnsureUser {
|
|
358
|
+
readonly type: "resEnsureUser";
|
|
359
|
+
readonly user: User;
|
|
360
|
+
readonly tenants: UserTenant[];
|
|
361
|
+
}
|
|
362
|
+
export interface ReqEnsureUser {
|
|
363
|
+
readonly type: "reqEnsureUser";
|
|
364
|
+
readonly auth: DashAuthType;
|
|
365
|
+
}
|
|
366
|
+
interface RoleBase {
|
|
367
|
+
readonly tenantId?: string;
|
|
368
|
+
readonly ledgerId?: string;
|
|
369
|
+
readonly userId: string;
|
|
370
|
+
readonly role: Role;
|
|
371
|
+
readonly adminUserIds: string[];
|
|
372
|
+
readonly memberUserIds: string[];
|
|
373
|
+
}
|
|
374
|
+
interface TenantRole extends RoleBase {
|
|
375
|
+
readonly tenantId: string;
|
|
376
|
+
}
|
|
377
|
+
interface LedgerRole extends RoleBase {
|
|
378
|
+
readonly ledgerId: string;
|
|
379
|
+
readonly right: ReadWrite;
|
|
380
|
+
}
|
|
381
|
+
export type RoleType = TenantRole | LedgerRole;
|
|
382
|
+
export interface ReqInsertTenant {
|
|
383
|
+
readonly tenantId: string;
|
|
384
|
+
readonly name?: string;
|
|
385
|
+
readonly ownerUserId: string;
|
|
386
|
+
readonly adminUserIds?: string[];
|
|
387
|
+
readonly memberUserIds?: string[];
|
|
388
|
+
readonly maxAdminUsers?: number;
|
|
389
|
+
readonly maxMemberUsers?: number;
|
|
390
|
+
readonly createdAt?: Date;
|
|
391
|
+
readonly updatedAt?: Date;
|
|
392
|
+
}
|
|
393
|
+
export interface ReqExtendToken {
|
|
394
|
+
readonly type: "reqExtendToken";
|
|
395
|
+
readonly token: string;
|
|
396
|
+
}
|
|
397
|
+
export interface ResExtendToken {
|
|
398
|
+
readonly type: "resExtendToken";
|
|
399
|
+
readonly token: string;
|
|
400
|
+
}
|
|
401
|
+
export interface ReqCertFromCsr {
|
|
402
|
+
readonly type: "reqCertFromCsr";
|
|
403
|
+
readonly auth: DashAuthType;
|
|
404
|
+
readonly csr: string;
|
|
405
|
+
}
|
|
406
|
+
export interface ResCertFromCsr {
|
|
407
|
+
readonly type: "resCertFromCsr";
|
|
408
|
+
readonly certificate: string;
|
|
409
|
+
}
|
|
410
|
+
export interface ReqEnsureCloudToken {
|
|
411
|
+
readonly type: "reqEnsureCloudToken";
|
|
412
|
+
readonly auth: DashAuthType;
|
|
413
|
+
readonly appId: string;
|
|
414
|
+
readonly env?: string;
|
|
415
|
+
readonly tenant?: string;
|
|
416
|
+
readonly ledger?: string;
|
|
417
|
+
readonly prevCloudToken?: string;
|
|
418
|
+
}
|
|
419
|
+
export interface ResEnsureCloudToken {
|
|
420
|
+
readonly type: "resEnsureCloudToken";
|
|
421
|
+
readonly cloudToken: string;
|
|
422
|
+
readonly appId: string;
|
|
423
|
+
readonly tenant: string;
|
|
424
|
+
readonly ledger: string;
|
|
425
|
+
readonly expiresInSec: number;
|
|
426
|
+
readonly expiresDate: string;
|
|
427
|
+
readonly claims: FPCloudClaim;
|
|
428
|
+
}
|
|
429
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msg-types.js","sourceRoot":"","sources":["../../../jsr/dash-api/protocols-dashboard/msg-types.ts"],"names":[],"mappings":"AAqPA,MAAM,UAAU,OAAO,CAAC,EAAc;IACpC,OAAO,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Result } from "@adviser/cement";
|
|
2
|
+
import { DashAuthType, User } from "./msg-types.js";
|
|
3
|
+
import { ClerkClaim } from "../../clerk-claim.js";
|
|
4
|
+
export interface TokenByResultIdParam {
|
|
5
|
+
readonly status: "found" | "not-found";
|
|
6
|
+
readonly resultId: string;
|
|
7
|
+
readonly token?: string;
|
|
8
|
+
readonly now: Date;
|
|
9
|
+
}
|
|
10
|
+
export interface FPApiToken {
|
|
11
|
+
verify(token: string): Promise<Result<VerifiedClaimsResult>>;
|
|
12
|
+
decode(token: string): Promise<Result<VerifiedClaimsResult>>;
|
|
13
|
+
}
|
|
14
|
+
export interface WithAuth {
|
|
15
|
+
readonly auth: DashAuthType;
|
|
16
|
+
}
|
|
17
|
+
export interface VerifiedClaimsResult {
|
|
18
|
+
readonly type: DashAuthType["type"];
|
|
19
|
+
readonly token: string;
|
|
20
|
+
readonly claims: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface ClerkVerifiedAuth {
|
|
23
|
+
readonly type: "clerk";
|
|
24
|
+
readonly claims: ClerkClaim;
|
|
25
|
+
}
|
|
26
|
+
export interface VerifiedAuthResult {
|
|
27
|
+
readonly type: "VerifiedAuthResult";
|
|
28
|
+
readonly inDashAuth: DashAuthType;
|
|
29
|
+
readonly verifiedAuth: ClerkVerifiedAuth;
|
|
30
|
+
}
|
|
31
|
+
export interface VerifiedAuthUserResult extends Omit<VerifiedAuthResult, "type"> {
|
|
32
|
+
readonly type: "VerifiedAuthUserResult";
|
|
33
|
+
readonly user: User;
|
|
34
|
+
}
|
|
35
|
+
export type VerifiedResult = VerifiedAuthResult | VerifiedAuthUserResult;
|
|
36
|
+
export declare function isVerifiedAuth(obj: VerifiedResult): obj is VerifiedAuthResult;
|
|
37
|
+
export declare function isVerifiedAuthUser(obj: VerifiedResult): obj is VerifiedAuthUserResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../jsr/dash-api/protocols-dashboard/token.ts"],"names":[],"mappings":"AAsDA,MAAM,UAAU,cAAc,CAAC,GAAmB;IAChD,OAAQ,GAA0B,CAAC,IAAI,KAAK,oBAAoB,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,GAAmB;IACpD,OAAQ,GAA8B,CAAC,IAAI,KAAK,wBAAwB,CAAC;AAC3E,CAAC"}
|
package/dash-api/token.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Result } from "@adviser/cement";
|
|
2
|
-
import type { SuperThis
|
|
3
|
-
import type { VerifyWithCertificateOptions } from "
|
|
2
|
+
import type { SuperThis } from "../types/sthis.js";
|
|
3
|
+
import type { VerifyWithCertificateOptions } from "../types/device-id-types.js";
|
|
4
4
|
import { DeviceIdCA } from "../device-id/ca.js";
|
|
5
5
|
import { ClerkApiToken } from "./clerk-token.js";
|
|
6
|
-
import type { FPApiToken, VerifiedClaimsResult } from "../types/wire.js";
|
|
6
|
+
import type { FPApiToken, VerifiedClaimsResult, JWKPublic } from "../types/wire.js";
|
|
7
7
|
export { ClerkApiToken } from "./clerk-token.js";
|
|
8
8
|
export declare class DeviceIdApiToken implements FPApiToken {
|
|
9
9
|
readonly sthis: SuperThis;
|