@tearleads/client-sdk 0.1.48 → 0.1.50
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/client/organizations/currentPrincipalMutations.js +36 -17
- package/client/organizations/currentPrincipalMutations.js.map +1 -1
- package/client/organizations/principalContainerMutations.js +1 -0
- package/client/organizations/principalContainerMutations.js.map +1 -1
- package/client/organizations/principalMutations.js +2 -2
- package/client/organizations/principalMutations.js.map +1 -1
- package/data/principals/principalMutationJournalShape.js +6 -0
- package/data/principals/principalMutationJournalShape.js.map +1 -1
- package/internal/api-client/ApiClient.d.ts +122 -0
- package/internal/api-client/principalPolicyRequests.d.ts +122 -0
- package/internal/validators/operation/principals.d.ts +1026 -206
- package/internal/validators/request/principal.d.ts +332 -0
- package/internal/validators/request/principal.js +1 -0
- package/internal/validators/request/principal.js.map +1 -1
- package/internal/validators/response/principal.d.ts +488 -0
- package/internal/validators/response/principal.js +1 -0
- package/internal/validators/response/principal.js.map +1 -1
- package/package.json +1 -1
- package/workflows/containers/child/rekeyProjection.d.ts +6 -1
- package/workflows/containers/child/rekeyProjection.js +41 -0
- package/workflows/containers/child/rekeyProjection.js.map +1 -1
- package/workflows/organizations/authoredPrincipalPolicyWarmer.js +25 -0
- package/workflows/organizations/authoredPrincipalPolicyWarmer.js.map +1 -0
- package/workflows/organizations/commitCurrentGroupPolicyMutation.js +101 -34
- package/workflows/organizations/commitCurrentGroupPolicyMutation.js.map +1 -1
- package/workflows/organizations/groupPolicyMutationContext.d.ts +5 -52
- package/workflows/organizations/groupPolicyMutationContext.js +2 -65
- package/workflows/organizations/groupPolicyMutationContext.js.map +1 -1
- package/workflows/organizations/precedingPrincipalRematerialization.js +31 -0
- package/workflows/organizations/precedingPrincipalRematerialization.js.map +1 -0
- package/workflows/organizations/principalContainerRematerialization.js +39 -7
- package/workflows/organizations/principalContainerRematerialization.js.map +1 -1
- package/workflows/organizations/principalContainerRematerializationPlanning.js +6 -1
- package/workflows/organizations/principalContainerRematerializationPlanning.js.map +1 -1
- package/workflows/organizations/principalContainerRematerializationTargets.js +0 -11
- package/workflows/organizations/principalContainerRematerializationTargets.js.map +1 -1
- package/workflows/organizations/principalMutationReceipt.js +6 -0
- package/workflows/organizations/principalMutationReceipt.js.map +1 -1
- package/workflows/organizations/principalPolicyApi.d.ts +33 -0
- package/workflows/organizations/principalPolicyApi.js +2 -0
- package/workflows/organizations/principalPolicyApi.js.map +1 -0
- package/workflows/organizations/runtimeCurrentGroupMutation.js +36 -19
- package/workflows/organizations/runtimeCurrentGroupMutation.js.map +1 -1
- package/workflows/organizations/submitGroupPolicyCommit.d.ts +22 -0
- package/workflows/organizations/submitGroupPolicyCommit.js +71 -0
- package/workflows/organizations/submitGroupPolicyCommit.js.map +1 -0
|
@@ -1356,6 +1356,128 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
1356
1356
|
version: number;
|
|
1357
1357
|
};
|
|
1358
1358
|
};
|
|
1359
|
+
memberPolicy?: {
|
|
1360
|
+
containerMutations: {
|
|
1361
|
+
createdAt: string;
|
|
1362
|
+
manifestHead: {
|
|
1363
|
+
epoch: number;
|
|
1364
|
+
manifestHash: string;
|
|
1365
|
+
};
|
|
1366
|
+
organizationId: string;
|
|
1367
|
+
parentId: string | null;
|
|
1368
|
+
referencedPrincipalHeads: {
|
|
1369
|
+
principalType: "group";
|
|
1370
|
+
keyEpoch: number;
|
|
1371
|
+
keyFingerprint: string;
|
|
1372
|
+
principalId: string;
|
|
1373
|
+
stateHash: string;
|
|
1374
|
+
version: number;
|
|
1375
|
+
}[];
|
|
1376
|
+
updatedAt: string;
|
|
1377
|
+
accessManifest: {
|
|
1378
|
+
event: {
|
|
1379
|
+
body: unknown;
|
|
1380
|
+
event: Record<string, unknown>;
|
|
1381
|
+
eventHash: string;
|
|
1382
|
+
};
|
|
1383
|
+
manifest: Record<string, unknown>;
|
|
1384
|
+
manifestHash: string;
|
|
1385
|
+
state: Record<string, unknown>;
|
|
1386
|
+
};
|
|
1387
|
+
containerId: string;
|
|
1388
|
+
containerKek: {
|
|
1389
|
+
accessManifestHash: string;
|
|
1390
|
+
containerId: string;
|
|
1391
|
+
containerKeyEpoch: number;
|
|
1392
|
+
containerKeyEpochId: string;
|
|
1393
|
+
containerManifestHistory: {
|
|
1394
|
+
event: {
|
|
1395
|
+
body: unknown;
|
|
1396
|
+
event: Record<string, unknown>;
|
|
1397
|
+
eventHash: string;
|
|
1398
|
+
};
|
|
1399
|
+
manifest: Record<string, unknown>;
|
|
1400
|
+
manifestHash: string;
|
|
1401
|
+
state: Record<string, unknown>;
|
|
1402
|
+
}[];
|
|
1403
|
+
keyEpoch: Record<string, unknown>;
|
|
1404
|
+
keyEpochHash: string;
|
|
1405
|
+
keyring: {
|
|
1406
|
+
containerId: string;
|
|
1407
|
+
containerKeyEpochId: string;
|
|
1408
|
+
iv: string;
|
|
1409
|
+
sealed: string;
|
|
1410
|
+
sealingSuite: string;
|
|
1411
|
+
version: number;
|
|
1412
|
+
} | null;
|
|
1413
|
+
keyTargetHash: string;
|
|
1414
|
+
parentContainerKeyEpochId: string | null;
|
|
1415
|
+
recipientTargets: Record<string, unknown>[];
|
|
1416
|
+
wraps: Record<string, unknown>[];
|
|
1417
|
+
};
|
|
1418
|
+
systemSlot?: string | null | undefined;
|
|
1419
|
+
}[];
|
|
1420
|
+
currentGrants: {
|
|
1421
|
+
accessLevel: "admin" | "read" | "write";
|
|
1422
|
+
containerId: string;
|
|
1423
|
+
}[];
|
|
1424
|
+
currentMemberEnvelopes: {
|
|
1425
|
+
envelopes: {
|
|
1426
|
+
kemCipherText: string;
|
|
1427
|
+
memberKeyFingerprint: string;
|
|
1428
|
+
userId: string;
|
|
1429
|
+
wrappedKey: string;
|
|
1430
|
+
}[];
|
|
1431
|
+
epoch: number;
|
|
1432
|
+
principalId: string;
|
|
1433
|
+
principalType: "group" | "organization";
|
|
1434
|
+
stateHash: string;
|
|
1435
|
+
};
|
|
1436
|
+
currentPayload: {
|
|
1437
|
+
cipherSuite: "aes-256-gcm";
|
|
1438
|
+
ciphertext: string;
|
|
1439
|
+
ciphertextHash: string;
|
|
1440
|
+
createdAt: string;
|
|
1441
|
+
principalId: string;
|
|
1442
|
+
principalType: "group" | "organization";
|
|
1443
|
+
stateHash: string;
|
|
1444
|
+
};
|
|
1445
|
+
currentProjection: {
|
|
1446
|
+
role: "member" | "admin";
|
|
1447
|
+
userId: string;
|
|
1448
|
+
}[];
|
|
1449
|
+
currentState: {
|
|
1450
|
+
createdAt: string;
|
|
1451
|
+
encapsulationPublicKey: string;
|
|
1452
|
+
externalAuthority: {
|
|
1453
|
+
keyEpoch: number;
|
|
1454
|
+
keyFingerprint: string;
|
|
1455
|
+
principalId: string;
|
|
1456
|
+
principalType: "group";
|
|
1457
|
+
stateHash: string;
|
|
1458
|
+
version: number;
|
|
1459
|
+
} | null;
|
|
1460
|
+
grantCount: number;
|
|
1461
|
+
grantRoot: string;
|
|
1462
|
+
keyEpoch: number;
|
|
1463
|
+
keyFingerprint: string;
|
|
1464
|
+
memberCount: number;
|
|
1465
|
+
memberEnvelopesRoot: string;
|
|
1466
|
+
membershipMode: "projection";
|
|
1467
|
+
membershipRoot: string;
|
|
1468
|
+
payloadCiphertextHash: string;
|
|
1469
|
+
prevStateHash: string | null;
|
|
1470
|
+
principalId: string;
|
|
1471
|
+
principalType: "group" | "organization";
|
|
1472
|
+
projectionRoot: string;
|
|
1473
|
+
signature: string;
|
|
1474
|
+
signedAt: string;
|
|
1475
|
+
signerUserId: string;
|
|
1476
|
+
signerUserKeyFingerprint: string;
|
|
1477
|
+
stateHash: string;
|
|
1478
|
+
version: number;
|
|
1479
|
+
};
|
|
1480
|
+
} | undefined;
|
|
1359
1481
|
}, {
|
|
1360
1482
|
groupPolicy: {
|
|
1361
1483
|
containerMutations: {
|
|
@@ -1601,6 +1723,128 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
1601
1723
|
version: number;
|
|
1602
1724
|
};
|
|
1603
1725
|
};
|
|
1726
|
+
memberPolicy?: {
|
|
1727
|
+
containerMutations: {
|
|
1728
|
+
createdAt: string;
|
|
1729
|
+
manifestHead: {
|
|
1730
|
+
epoch: number;
|
|
1731
|
+
manifestHash: string;
|
|
1732
|
+
};
|
|
1733
|
+
organizationId: string;
|
|
1734
|
+
parentId: string | null;
|
|
1735
|
+
referencedPrincipalHeads: {
|
|
1736
|
+
principalType: "group";
|
|
1737
|
+
keyEpoch: number;
|
|
1738
|
+
keyFingerprint: string;
|
|
1739
|
+
principalId: string;
|
|
1740
|
+
stateHash: string;
|
|
1741
|
+
version: number;
|
|
1742
|
+
}[];
|
|
1743
|
+
updatedAt: string;
|
|
1744
|
+
accessManifest: {
|
|
1745
|
+
event: {
|
|
1746
|
+
body: unknown;
|
|
1747
|
+
event: Record<string, unknown>;
|
|
1748
|
+
eventHash: string;
|
|
1749
|
+
};
|
|
1750
|
+
manifest: Record<string, unknown>;
|
|
1751
|
+
manifestHash: string;
|
|
1752
|
+
state: Record<string, unknown>;
|
|
1753
|
+
};
|
|
1754
|
+
containerId: string;
|
|
1755
|
+
containerKek: {
|
|
1756
|
+
accessManifestHash: string;
|
|
1757
|
+
containerId: string;
|
|
1758
|
+
containerKeyEpoch: number;
|
|
1759
|
+
containerKeyEpochId: string;
|
|
1760
|
+
containerManifestHistory: {
|
|
1761
|
+
event: {
|
|
1762
|
+
body: unknown;
|
|
1763
|
+
event: Record<string, unknown>;
|
|
1764
|
+
eventHash: string;
|
|
1765
|
+
};
|
|
1766
|
+
manifest: Record<string, unknown>;
|
|
1767
|
+
manifestHash: string;
|
|
1768
|
+
state: Record<string, unknown>;
|
|
1769
|
+
}[];
|
|
1770
|
+
keyEpoch: Record<string, unknown>;
|
|
1771
|
+
keyEpochHash: string;
|
|
1772
|
+
keyring: {
|
|
1773
|
+
containerId: string;
|
|
1774
|
+
containerKeyEpochId: string;
|
|
1775
|
+
iv: string;
|
|
1776
|
+
sealed: string;
|
|
1777
|
+
sealingSuite: string;
|
|
1778
|
+
version: number;
|
|
1779
|
+
} | null;
|
|
1780
|
+
keyTargetHash: string;
|
|
1781
|
+
parentContainerKeyEpochId: string | null;
|
|
1782
|
+
recipientTargets: Record<string, unknown>[];
|
|
1783
|
+
wraps: Record<string, unknown>[];
|
|
1784
|
+
};
|
|
1785
|
+
systemSlot?: string | null | undefined;
|
|
1786
|
+
}[];
|
|
1787
|
+
currentGrants: {
|
|
1788
|
+
accessLevel: "admin" | "read" | "write";
|
|
1789
|
+
containerId: string;
|
|
1790
|
+
}[];
|
|
1791
|
+
currentMemberEnvelopes: {
|
|
1792
|
+
envelopes: {
|
|
1793
|
+
kemCipherText: string;
|
|
1794
|
+
memberKeyFingerprint: string;
|
|
1795
|
+
userId: string;
|
|
1796
|
+
wrappedKey: string;
|
|
1797
|
+
}[];
|
|
1798
|
+
epoch: number;
|
|
1799
|
+
principalId: string;
|
|
1800
|
+
principalType: "group" | "organization";
|
|
1801
|
+
stateHash: string;
|
|
1802
|
+
};
|
|
1803
|
+
currentPayload: {
|
|
1804
|
+
cipherSuite: "aes-256-gcm";
|
|
1805
|
+
ciphertext: string;
|
|
1806
|
+
ciphertextHash: string;
|
|
1807
|
+
createdAt: string;
|
|
1808
|
+
principalId: string;
|
|
1809
|
+
principalType: "group" | "organization";
|
|
1810
|
+
stateHash: string;
|
|
1811
|
+
};
|
|
1812
|
+
currentProjection: {
|
|
1813
|
+
role: "member" | "admin";
|
|
1814
|
+
userId: string;
|
|
1815
|
+
}[];
|
|
1816
|
+
currentState: {
|
|
1817
|
+
createdAt: string;
|
|
1818
|
+
encapsulationPublicKey: string;
|
|
1819
|
+
externalAuthority: {
|
|
1820
|
+
keyEpoch: number;
|
|
1821
|
+
keyFingerprint: string;
|
|
1822
|
+
principalId: string;
|
|
1823
|
+
principalType: "group";
|
|
1824
|
+
stateHash: string;
|
|
1825
|
+
version: number;
|
|
1826
|
+
} | null;
|
|
1827
|
+
grantCount: number;
|
|
1828
|
+
grantRoot: string;
|
|
1829
|
+
keyEpoch: number;
|
|
1830
|
+
keyFingerprint: string;
|
|
1831
|
+
memberCount: number;
|
|
1832
|
+
memberEnvelopesRoot: string;
|
|
1833
|
+
membershipMode: "projection";
|
|
1834
|
+
membershipRoot: string;
|
|
1835
|
+
payloadCiphertextHash: string;
|
|
1836
|
+
prevStateHash: string | null;
|
|
1837
|
+
principalId: string;
|
|
1838
|
+
principalType: "group" | "organization";
|
|
1839
|
+
projectionRoot: string;
|
|
1840
|
+
signature: string;
|
|
1841
|
+
signedAt: string;
|
|
1842
|
+
signerUserId: string;
|
|
1843
|
+
signerUserKeyFingerprint: string;
|
|
1844
|
+
stateHash: string;
|
|
1845
|
+
version: number;
|
|
1846
|
+
};
|
|
1847
|
+
} | undefined;
|
|
1604
1848
|
}, z.core.$ZodTypeInternals<{
|
|
1605
1849
|
groupPolicy: {
|
|
1606
1850
|
containerMutations: {
|
|
@@ -1846,6 +2090,128 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
1846
2090
|
version: number;
|
|
1847
2091
|
};
|
|
1848
2092
|
};
|
|
2093
|
+
memberPolicy?: {
|
|
2094
|
+
containerMutations: {
|
|
2095
|
+
createdAt: string;
|
|
2096
|
+
manifestHead: {
|
|
2097
|
+
epoch: number;
|
|
2098
|
+
manifestHash: string;
|
|
2099
|
+
};
|
|
2100
|
+
organizationId: string;
|
|
2101
|
+
parentId: string | null;
|
|
2102
|
+
referencedPrincipalHeads: {
|
|
2103
|
+
principalType: "group";
|
|
2104
|
+
keyEpoch: number;
|
|
2105
|
+
keyFingerprint: string;
|
|
2106
|
+
principalId: string;
|
|
2107
|
+
stateHash: string;
|
|
2108
|
+
version: number;
|
|
2109
|
+
}[];
|
|
2110
|
+
updatedAt: string;
|
|
2111
|
+
accessManifest: {
|
|
2112
|
+
event: {
|
|
2113
|
+
body: unknown;
|
|
2114
|
+
event: Record<string, unknown>;
|
|
2115
|
+
eventHash: string;
|
|
2116
|
+
};
|
|
2117
|
+
manifest: Record<string, unknown>;
|
|
2118
|
+
manifestHash: string;
|
|
2119
|
+
state: Record<string, unknown>;
|
|
2120
|
+
};
|
|
2121
|
+
containerId: string;
|
|
2122
|
+
containerKek: {
|
|
2123
|
+
accessManifestHash: string;
|
|
2124
|
+
containerId: string;
|
|
2125
|
+
containerKeyEpoch: number;
|
|
2126
|
+
containerKeyEpochId: string;
|
|
2127
|
+
containerManifestHistory: {
|
|
2128
|
+
event: {
|
|
2129
|
+
body: unknown;
|
|
2130
|
+
event: Record<string, unknown>;
|
|
2131
|
+
eventHash: string;
|
|
2132
|
+
};
|
|
2133
|
+
manifest: Record<string, unknown>;
|
|
2134
|
+
manifestHash: string;
|
|
2135
|
+
state: Record<string, unknown>;
|
|
2136
|
+
}[];
|
|
2137
|
+
keyEpoch: Record<string, unknown>;
|
|
2138
|
+
keyEpochHash: string;
|
|
2139
|
+
keyring: {
|
|
2140
|
+
containerId: string;
|
|
2141
|
+
containerKeyEpochId: string;
|
|
2142
|
+
iv: string;
|
|
2143
|
+
sealed: string;
|
|
2144
|
+
sealingSuite: string;
|
|
2145
|
+
version: number;
|
|
2146
|
+
} | null;
|
|
2147
|
+
keyTargetHash: string;
|
|
2148
|
+
parentContainerKeyEpochId: string | null;
|
|
2149
|
+
recipientTargets: Record<string, unknown>[];
|
|
2150
|
+
wraps: Record<string, unknown>[];
|
|
2151
|
+
};
|
|
2152
|
+
systemSlot?: string | null | undefined;
|
|
2153
|
+
}[];
|
|
2154
|
+
currentGrants: {
|
|
2155
|
+
accessLevel: "admin" | "read" | "write";
|
|
2156
|
+
containerId: string;
|
|
2157
|
+
}[];
|
|
2158
|
+
currentMemberEnvelopes: {
|
|
2159
|
+
envelopes: {
|
|
2160
|
+
kemCipherText: string;
|
|
2161
|
+
memberKeyFingerprint: string;
|
|
2162
|
+
userId: string;
|
|
2163
|
+
wrappedKey: string;
|
|
2164
|
+
}[];
|
|
2165
|
+
epoch: number;
|
|
2166
|
+
principalId: string;
|
|
2167
|
+
principalType: "group" | "organization";
|
|
2168
|
+
stateHash: string;
|
|
2169
|
+
};
|
|
2170
|
+
currentPayload: {
|
|
2171
|
+
cipherSuite: "aes-256-gcm";
|
|
2172
|
+
ciphertext: string;
|
|
2173
|
+
ciphertextHash: string;
|
|
2174
|
+
createdAt: string;
|
|
2175
|
+
principalId: string;
|
|
2176
|
+
principalType: "group" | "organization";
|
|
2177
|
+
stateHash: string;
|
|
2178
|
+
};
|
|
2179
|
+
currentProjection: {
|
|
2180
|
+
role: "member" | "admin";
|
|
2181
|
+
userId: string;
|
|
2182
|
+
}[];
|
|
2183
|
+
currentState: {
|
|
2184
|
+
createdAt: string;
|
|
2185
|
+
encapsulationPublicKey: string;
|
|
2186
|
+
externalAuthority: {
|
|
2187
|
+
keyEpoch: number;
|
|
2188
|
+
keyFingerprint: string;
|
|
2189
|
+
principalId: string;
|
|
2190
|
+
principalType: "group";
|
|
2191
|
+
stateHash: string;
|
|
2192
|
+
version: number;
|
|
2193
|
+
} | null;
|
|
2194
|
+
grantCount: number;
|
|
2195
|
+
grantRoot: string;
|
|
2196
|
+
keyEpoch: number;
|
|
2197
|
+
keyFingerprint: string;
|
|
2198
|
+
memberCount: number;
|
|
2199
|
+
memberEnvelopesRoot: string;
|
|
2200
|
+
membershipMode: "projection";
|
|
2201
|
+
membershipRoot: string;
|
|
2202
|
+
payloadCiphertextHash: string;
|
|
2203
|
+
prevStateHash: string | null;
|
|
2204
|
+
principalId: string;
|
|
2205
|
+
principalType: "group" | "organization";
|
|
2206
|
+
projectionRoot: string;
|
|
2207
|
+
signature: string;
|
|
2208
|
+
signedAt: string;
|
|
2209
|
+
signerUserId: string;
|
|
2210
|
+
signerUserKeyFingerprint: string;
|
|
2211
|
+
stateHash: string;
|
|
2212
|
+
version: number;
|
|
2213
|
+
};
|
|
2214
|
+
} | undefined;
|
|
1849
2215
|
}, {
|
|
1850
2216
|
groupPolicy: {
|
|
1851
2217
|
containerMutations: {
|
|
@@ -2091,6 +2457,128 @@ export declare const CommitOrganizationGroupPolicyResponseSchema: z.ZodType<{
|
|
|
2091
2457
|
version: number;
|
|
2092
2458
|
};
|
|
2093
2459
|
};
|
|
2460
|
+
memberPolicy?: {
|
|
2461
|
+
containerMutations: {
|
|
2462
|
+
createdAt: string;
|
|
2463
|
+
manifestHead: {
|
|
2464
|
+
epoch: number;
|
|
2465
|
+
manifestHash: string;
|
|
2466
|
+
};
|
|
2467
|
+
organizationId: string;
|
|
2468
|
+
parentId: string | null;
|
|
2469
|
+
referencedPrincipalHeads: {
|
|
2470
|
+
principalType: "group";
|
|
2471
|
+
keyEpoch: number;
|
|
2472
|
+
keyFingerprint: string;
|
|
2473
|
+
principalId: string;
|
|
2474
|
+
stateHash: string;
|
|
2475
|
+
version: number;
|
|
2476
|
+
}[];
|
|
2477
|
+
updatedAt: string;
|
|
2478
|
+
accessManifest: {
|
|
2479
|
+
event: {
|
|
2480
|
+
body: unknown;
|
|
2481
|
+
event: Record<string, unknown>;
|
|
2482
|
+
eventHash: string;
|
|
2483
|
+
};
|
|
2484
|
+
manifest: Record<string, unknown>;
|
|
2485
|
+
manifestHash: string;
|
|
2486
|
+
state: Record<string, unknown>;
|
|
2487
|
+
};
|
|
2488
|
+
containerId: string;
|
|
2489
|
+
containerKek: {
|
|
2490
|
+
accessManifestHash: string;
|
|
2491
|
+
containerId: string;
|
|
2492
|
+
containerKeyEpoch: number;
|
|
2493
|
+
containerKeyEpochId: string;
|
|
2494
|
+
containerManifestHistory: {
|
|
2495
|
+
event: {
|
|
2496
|
+
body: unknown;
|
|
2497
|
+
event: Record<string, unknown>;
|
|
2498
|
+
eventHash: string;
|
|
2499
|
+
};
|
|
2500
|
+
manifest: Record<string, unknown>;
|
|
2501
|
+
manifestHash: string;
|
|
2502
|
+
state: Record<string, unknown>;
|
|
2503
|
+
}[];
|
|
2504
|
+
keyEpoch: Record<string, unknown>;
|
|
2505
|
+
keyEpochHash: string;
|
|
2506
|
+
keyring: {
|
|
2507
|
+
containerId: string;
|
|
2508
|
+
containerKeyEpochId: string;
|
|
2509
|
+
iv: string;
|
|
2510
|
+
sealed: string;
|
|
2511
|
+
sealingSuite: string;
|
|
2512
|
+
version: number;
|
|
2513
|
+
} | null;
|
|
2514
|
+
keyTargetHash: string;
|
|
2515
|
+
parentContainerKeyEpochId: string | null;
|
|
2516
|
+
recipientTargets: Record<string, unknown>[];
|
|
2517
|
+
wraps: Record<string, unknown>[];
|
|
2518
|
+
};
|
|
2519
|
+
systemSlot?: string | null | undefined;
|
|
2520
|
+
}[];
|
|
2521
|
+
currentGrants: {
|
|
2522
|
+
accessLevel: "admin" | "read" | "write";
|
|
2523
|
+
containerId: string;
|
|
2524
|
+
}[];
|
|
2525
|
+
currentMemberEnvelopes: {
|
|
2526
|
+
envelopes: {
|
|
2527
|
+
kemCipherText: string;
|
|
2528
|
+
memberKeyFingerprint: string;
|
|
2529
|
+
userId: string;
|
|
2530
|
+
wrappedKey: string;
|
|
2531
|
+
}[];
|
|
2532
|
+
epoch: number;
|
|
2533
|
+
principalId: string;
|
|
2534
|
+
principalType: "group" | "organization";
|
|
2535
|
+
stateHash: string;
|
|
2536
|
+
};
|
|
2537
|
+
currentPayload: {
|
|
2538
|
+
cipherSuite: "aes-256-gcm";
|
|
2539
|
+
ciphertext: string;
|
|
2540
|
+
ciphertextHash: string;
|
|
2541
|
+
createdAt: string;
|
|
2542
|
+
principalId: string;
|
|
2543
|
+
principalType: "group" | "organization";
|
|
2544
|
+
stateHash: string;
|
|
2545
|
+
};
|
|
2546
|
+
currentProjection: {
|
|
2547
|
+
role: "member" | "admin";
|
|
2548
|
+
userId: string;
|
|
2549
|
+
}[];
|
|
2550
|
+
currentState: {
|
|
2551
|
+
createdAt: string;
|
|
2552
|
+
encapsulationPublicKey: string;
|
|
2553
|
+
externalAuthority: {
|
|
2554
|
+
keyEpoch: number;
|
|
2555
|
+
keyFingerprint: string;
|
|
2556
|
+
principalId: string;
|
|
2557
|
+
principalType: "group";
|
|
2558
|
+
stateHash: string;
|
|
2559
|
+
version: number;
|
|
2560
|
+
} | null;
|
|
2561
|
+
grantCount: number;
|
|
2562
|
+
grantRoot: string;
|
|
2563
|
+
keyEpoch: number;
|
|
2564
|
+
keyFingerprint: string;
|
|
2565
|
+
memberCount: number;
|
|
2566
|
+
memberEnvelopesRoot: string;
|
|
2567
|
+
membershipMode: "projection";
|
|
2568
|
+
membershipRoot: string;
|
|
2569
|
+
payloadCiphertextHash: string;
|
|
2570
|
+
prevStateHash: string | null;
|
|
2571
|
+
principalId: string;
|
|
2572
|
+
principalType: "group" | "organization";
|
|
2573
|
+
projectionRoot: string;
|
|
2574
|
+
signature: string;
|
|
2575
|
+
signedAt: string;
|
|
2576
|
+
signerUserId: string;
|
|
2577
|
+
signerUserKeyFingerprint: string;
|
|
2578
|
+
stateHash: string;
|
|
2579
|
+
version: number;
|
|
2580
|
+
};
|
|
2581
|
+
} | undefined;
|
|
2094
2582
|
}>>;
|
|
2095
2583
|
export type CommitOrganizationGroupPolicyResponse = z.infer<typeof CommitOrganizationGroupPolicyResponseSchema>;
|
|
2096
2584
|
export declare const PrincipalPolicyErrorResponseSchema: z.ZodType<{
|
|
@@ -25,6 +25,7 @@ export const PrincipalPolicyMutationResponseSchema = loosePlainObject({
|
|
|
25
25
|
});
|
|
26
26
|
export const CommitOrganizationGroupPolicyResponseSchema = loosePlainObject({
|
|
27
27
|
groupPolicy: PrincipalPolicyMutationResponseSchema,
|
|
28
|
+
memberPolicy: PrincipalPolicyMutationResponseSchema.optional(),
|
|
28
29
|
organizationPolicy: PrincipalPolicyMutationResponseSchema,
|
|
29
30
|
});
|
|
30
31
|
export const PrincipalPolicyErrorResponseSchema = BillingErrorResponseSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"principal.js","sourceRoot":"","sources":["principal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE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AO,uCAAuC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { arraySchema, loosePlainObject, nonEmptyStringSchema } from \"../schema\";\nimport { MAX_ROTATION_CONTAINER_REKEYS } from \"../util\";\nimport { PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT } from \"../util/principalHistoryWire\";\nimport { ContainerMutationResponseSchema } from \"./container\";\nimport { CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE } from \"./descendantRekeysRequiredError\";\nimport { BillingErrorResponseSchema } from \"./organizationBilling\";\nimport { ReferencedPrincipalStateResponseSchema } from \"./principalReference\";\n\nimport {\n CurrentPrincipalMemberEnvelopesResponseSchema,\n PrincipalContainerGrantResponseSchema,\n PrincipalPolicyStateChainEntryResponseSchema,\n PrincipalProjectionMemberResponseSchema,\n PrincipalStatePayloadResponseSchema,\n PrincipalStateResponseSchema,\n} from \"./principalSnapshot\";\n\nexport {\n type CurrentPrincipalMemberEnvelopesResponse,\n CurrentPrincipalMemberEnvelopesResponseSchema,\n isCurrentPrincipalMemberEnvelopesResponse,\n isPrincipalPolicyStateChainEntryResponse,\n isPrincipalStatePayloadResponse,\n isPrincipalStateResponse,\n type PrincipalContainerGrantResponse,\n PrincipalContainerGrantResponseSchema,\n type PrincipalMemberEnvelopeResponse,\n PrincipalMemberEnvelopeResponseSchema,\n type PrincipalPolicySnapshotResponse,\n PrincipalPolicySnapshotResponseSchema,\n type PrincipalPolicyStateChainEntryResponse,\n PrincipalPolicyStateChainEntryResponseSchema,\n type PrincipalProjectionMemberResponse,\n PrincipalProjectionMemberResponseSchema,\n type PrincipalStateExternalAuthorityResponse,\n PrincipalStateExternalAuthorityResponseSchema,\n type PrincipalStatePayloadResponse,\n PrincipalStatePayloadResponseSchema,\n type PrincipalStateResponse,\n PrincipalStateResponseSchema,\n} from \"./principalSnapshot\";\n\nexport const principalPolicyCurrentResponseShape = {\n currentGrants: arraySchema(PrincipalContainerGrantResponseSchema),\n currentMemberEnvelopes: CurrentPrincipalMemberEnvelopesResponseSchema,\n currentPayload: PrincipalStatePayloadResponseSchema,\n currentProjection: arraySchema(PrincipalProjectionMemberResponseSchema),\n currentState: PrincipalStateResponseSchema,\n};\n\nexport const PrincipalPolicyBundleResponseSchema = loosePlainObject({\n ...principalPolicyCurrentResponseShape,\n previousStates: arraySchema(PrincipalPolicyStateChainEntryResponseSchema),\n});\n\nexport type PrincipalPolicyBundleResponse = z.infer<\n typeof PrincipalPolicyBundleResponseSchema\n>;\n\nexport const PrincipalPolicyMutationResponseSchema = loosePlainObject({\n ...principalPolicyCurrentResponseShape,\n containerMutations: arraySchema(ContainerMutationResponseSchema),\n});\n\nexport type PrincipalPolicyMutationResponse = z.infer<\n typeof PrincipalPolicyMutationResponseSchema\n>;\n\nexport const CommitOrganizationGroupPolicyResponseSchema = loosePlainObject({\n groupPolicy: PrincipalPolicyMutationResponseSchema,\n organizationPolicy: PrincipalPolicyMutationResponseSchema,\n});\n\nexport type CommitOrganizationGroupPolicyResponse = z.infer<\n typeof CommitOrganizationGroupPolicyResponseSchema\n>;\n\nexport const PrincipalPolicyErrorResponseSchema = BillingErrorResponseSchema;\n\nexport type PrincipalPolicyErrorResponse = z.infer<\n typeof PrincipalPolicyErrorResponseSchema\n>;\n\n/**\n * A group policy change rematerializes its granted containers, and a rekey or\n * revoke among them is a rotation like any other: one that would leave a level\n * above a directly granted container pinned to a retired epoch is refused, and\n * this names the descendant rekeys the batch must carry, parent-first.\n */\nconst PrincipalPolicyDescendantRekeysRequiredResponseSchema = loosePlainObject({\n code: z.literal(CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE),\n error: z.string().min(1),\n requiredContainerIds: arraySchema(\n nonEmptyStringSchema,\n MAX_ROTATION_CONTAINER_REKEYS,\n ),\n});\n\n/**\n * The commit's conflict envelope alone: only a group commit carries container\n * mutations, so only it can be refused for what they strand. The principal\n * policy read and the organization policy write keep the plain envelope.\n */\nexport const CommitOrganizationGroupPolicyConflictResponseSchema = z.union([\n PrincipalPolicyErrorResponseSchema,\n PrincipalPolicyDescendantRekeysRequiredResponseSchema,\n]);\n\nexport const PrincipalPolicyStaleErrorResponseSchema = loosePlainObject({\n code: z.literal(\"principal_policy_stale\"),\n error: z.string().min(1),\n principalHeads: arraySchema(\n ReferencedPrincipalStateResponseSchema,\n PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT,\n ),\n});\n\nexport type PrincipalPolicyStaleErrorResponse = z.infer<\n typeof PrincipalPolicyStaleErrorResponseSchema\n>;\n\nexport function isPrincipalPolicyBundleResponse(\n value: unknown,\n): value is PrincipalPolicyBundleResponse {\n return PrincipalPolicyBundleResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyMutationResponse(\n value: unknown,\n): value is PrincipalPolicyMutationResponse {\n return PrincipalPolicyMutationResponseSchema.safeParse(value).success;\n}\n\nexport function isCommitOrganizationGroupPolicyResponse(\n value: unknown,\n): value is CommitOrganizationGroupPolicyResponse {\n return CommitOrganizationGroupPolicyResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyStaleErrorResponse(\n value: unknown,\n): value is PrincipalPolicyStaleErrorResponse {\n return PrincipalPolicyStaleErrorResponseSchema.safeParse(value).success;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"principal.js","sourceRoot":"","sources":["principal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,kCAAkC,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,+CAA+C,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAAE,0BA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AAC;IAC7E,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,+CAA+C,CAAC;IAChE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,oBAAoB,EAAE,WAAW,CAC/B,oBAAoB,EACpB,6BAA6B,CAC9B;CACF,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mDAAmD,GAAG,CAAC,CAAC,KAAK,CAAC;IACzE,kCAAkC;IAClC,qDAAqD;CACtD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uCAAuC,GAAG,gBAAgB,CAAC;IACtE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,cAAc,EAAE,WAAW,CACzB,sCAAsC,EACtC,kCAAkC,CACnC;CACF,CAAC,CAAC;AAMH,MAAM,UAAU,+BAA+B,CAC7C,KAAc;IAEd,OAAO,mCAAmC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,KAAc;IAEd,OAAO,qCAAqC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,KAAc;IAEd,OAAO,2CAA2C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,OAAO,uCAAuC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC1E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { arraySchema, loosePlainObject, nonEmptyStringSchema } from \"../schema\";\nimport { MAX_ROTATION_CONTAINER_REKEYS } from \"../util\";\nimport { PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT } from \"../util/principalHistoryWire\";\nimport { ContainerMutationResponseSchema } from \"./container\";\nimport { CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE } from \"./descendantRekeysRequiredError\";\nimport { BillingErrorResponseSchema } from \"./organizationBilling\";\nimport { ReferencedPrincipalStateResponseSchema } from \"./principalReference\";\n\nimport {\n CurrentPrincipalMemberEnvelopesResponseSchema,\n PrincipalContainerGrantResponseSchema,\n PrincipalPolicyStateChainEntryResponseSchema,\n PrincipalProjectionMemberResponseSchema,\n PrincipalStatePayloadResponseSchema,\n PrincipalStateResponseSchema,\n} from \"./principalSnapshot\";\n\nexport {\n type CurrentPrincipalMemberEnvelopesResponse,\n CurrentPrincipalMemberEnvelopesResponseSchema,\n isCurrentPrincipalMemberEnvelopesResponse,\n isPrincipalPolicyStateChainEntryResponse,\n isPrincipalStatePayloadResponse,\n isPrincipalStateResponse,\n type PrincipalContainerGrantResponse,\n PrincipalContainerGrantResponseSchema,\n type PrincipalMemberEnvelopeResponse,\n PrincipalMemberEnvelopeResponseSchema,\n type PrincipalPolicySnapshotResponse,\n PrincipalPolicySnapshotResponseSchema,\n type PrincipalPolicyStateChainEntryResponse,\n PrincipalPolicyStateChainEntryResponseSchema,\n type PrincipalProjectionMemberResponse,\n PrincipalProjectionMemberResponseSchema,\n type PrincipalStateExternalAuthorityResponse,\n PrincipalStateExternalAuthorityResponseSchema,\n type PrincipalStatePayloadResponse,\n PrincipalStatePayloadResponseSchema,\n type PrincipalStateResponse,\n PrincipalStateResponseSchema,\n} from \"./principalSnapshot\";\n\nexport const principalPolicyCurrentResponseShape = {\n currentGrants: arraySchema(PrincipalContainerGrantResponseSchema),\n currentMemberEnvelopes: CurrentPrincipalMemberEnvelopesResponseSchema,\n currentPayload: PrincipalStatePayloadResponseSchema,\n currentProjection: arraySchema(PrincipalProjectionMemberResponseSchema),\n currentState: PrincipalStateResponseSchema,\n};\n\nexport const PrincipalPolicyBundleResponseSchema = loosePlainObject({\n ...principalPolicyCurrentResponseShape,\n previousStates: arraySchema(PrincipalPolicyStateChainEntryResponseSchema),\n});\n\nexport type PrincipalPolicyBundleResponse = z.infer<\n typeof PrincipalPolicyBundleResponseSchema\n>;\n\nexport const PrincipalPolicyMutationResponseSchema = loosePlainObject({\n ...principalPolicyCurrentResponseShape,\n containerMutations: arraySchema(ContainerMutationResponseSchema),\n});\n\nexport type PrincipalPolicyMutationResponse = z.infer<\n typeof PrincipalPolicyMutationResponseSchema\n>;\n\nexport const CommitOrganizationGroupPolicyResponseSchema = loosePlainObject({\n groupPolicy: PrincipalPolicyMutationResponseSchema,\n memberPolicy: PrincipalPolicyMutationResponseSchema.optional(),\n organizationPolicy: PrincipalPolicyMutationResponseSchema,\n});\n\nexport type CommitOrganizationGroupPolicyResponse = z.infer<\n typeof CommitOrganizationGroupPolicyResponseSchema\n>;\n\nexport const PrincipalPolicyErrorResponseSchema = BillingErrorResponseSchema;\n\nexport type PrincipalPolicyErrorResponse = z.infer<\n typeof PrincipalPolicyErrorResponseSchema\n>;\n\n/**\n * A group policy change rematerializes its granted containers, and a rekey or\n * revoke among them is a rotation like any other: one that would leave a level\n * above a directly granted container pinned to a retired epoch is refused, and\n * this names the descendant rekeys the batch must carry, parent-first.\n */\nconst PrincipalPolicyDescendantRekeysRequiredResponseSchema = loosePlainObject({\n code: z.literal(CONTAINER_DESCENDANT_REKEYS_REQUIRED_ERROR_CODE),\n error: z.string().min(1),\n requiredContainerIds: arraySchema(\n nonEmptyStringSchema,\n MAX_ROTATION_CONTAINER_REKEYS,\n ),\n});\n\n/**\n * The commit's conflict envelope alone: only a group commit carries container\n * mutations, so only it can be refused for what they strand. The principal\n * policy read and the organization policy write keep the plain envelope.\n */\nexport const CommitOrganizationGroupPolicyConflictResponseSchema = z.union([\n PrincipalPolicyErrorResponseSchema,\n PrincipalPolicyDescendantRekeysRequiredResponseSchema,\n]);\n\nexport const PrincipalPolicyStaleErrorResponseSchema = loosePlainObject({\n code: z.literal(\"principal_policy_stale\"),\n error: z.string().min(1),\n principalHeads: arraySchema(\n ReferencedPrincipalStateResponseSchema,\n PRINCIPAL_POLICY_REPAIR_HEAD_LIMIT,\n ),\n});\n\nexport type PrincipalPolicyStaleErrorResponse = z.infer<\n typeof PrincipalPolicyStaleErrorResponseSchema\n>;\n\nexport function isPrincipalPolicyBundleResponse(\n value: unknown,\n): value is PrincipalPolicyBundleResponse {\n return PrincipalPolicyBundleResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyMutationResponse(\n value: unknown,\n): value is PrincipalPolicyMutationResponse {\n return PrincipalPolicyMutationResponseSchema.safeParse(value).success;\n}\n\nexport function isCommitOrganizationGroupPolicyResponse(\n value: unknown,\n): value is CommitOrganizationGroupPolicyResponse {\n return CommitOrganizationGroupPolicyResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyStaleErrorResponse(\n value: unknown,\n): value is PrincipalPolicyStaleErrorResponse {\n return PrincipalPolicyStaleErrorResponseSchema.safeParse(value).success;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ContainerWriterProjectionResponse } from "../../../internal/validators/response/index.js";
|
|
2
|
-
import type { MaterializedContainerRekeyPlan } from "../../../data/containers/shared/types.js";
|
|
2
|
+
import type { MaterializedContainerRekeyPlan, MaterializedContainerSharePlan } from "../../../data/containers/shared/types.js";
|
|
3
3
|
export declare function isSpeculativeContainerWriterProjection(projection: ContainerWriterProjectionResponse): boolean;
|
|
4
4
|
/**
|
|
5
5
|
* What any rotation plan (rekey, revoke, move) holds in common: enough to say
|
|
@@ -39,3 +39,8 @@ export declare function containerWriterProjectionFromRekeyPlan(input: {
|
|
|
39
39
|
* container. Null when the descendant does not sit below that container.
|
|
40
40
|
*/
|
|
41
41
|
export declare function rebaseContainerWriterProjection(descendant: ContainerWriterProjectionResponse, rotated: Pick<ContainerWriterProjectionResponse, "containerKeks" | "path" | "policyEvidence">): ContainerWriterProjectionResponse | null;
|
|
42
|
+
/** A grant keeps its key epoch while advancing the manifest and recipient wraps. */
|
|
43
|
+
export declare function containerWriterProjectionFromSharePlan(input: {
|
|
44
|
+
plan: MaterializedContainerSharePlan["plan"];
|
|
45
|
+
previousProjection: ContainerWriterProjectionResponse;
|
|
46
|
+
}): Promise<ContainerWriterProjectionResponse>;
|
|
@@ -107,4 +107,45 @@ export function rebaseContainerWriterProjection(descendant, rotated) {
|
|
|
107
107
|
speculativeProjections.add(projection);
|
|
108
108
|
return projection;
|
|
109
109
|
}
|
|
110
|
+
/** A grant keeps its key epoch while advancing the manifest and recipient wraps. */
|
|
111
|
+
export async function containerWriterProjectionFromSharePlan(input) {
|
|
112
|
+
const { plan, previousProjection } = input;
|
|
113
|
+
const previous = previousProjection.path.at(-1);
|
|
114
|
+
const kek = previousProjection.containerKeks.at(-1);
|
|
115
|
+
if (!previous ||
|
|
116
|
+
!kek ||
|
|
117
|
+
previous.manifestHash !== plan.previousManifest.manifestHash ||
|
|
118
|
+
kek.containerId !== plan.containerId)
|
|
119
|
+
throw new Error("Container grant projection predecessor mismatch");
|
|
120
|
+
const targets = recipientTargets({ wraps: plan.wraps });
|
|
121
|
+
const projection = {
|
|
122
|
+
...previousProjection,
|
|
123
|
+
path: [
|
|
124
|
+
...previousProjection.path.slice(0, -1),
|
|
125
|
+
{
|
|
126
|
+
event: {
|
|
127
|
+
body: readCanonicalRecord(plan.body, "Container grant body"),
|
|
128
|
+
event: readCanonicalRecord(plan.event, "Container grant event"),
|
|
129
|
+
eventHash: plan.eventHash,
|
|
130
|
+
},
|
|
131
|
+
manifest: readCanonicalRecord(plan.manifest, "Container grant manifest"),
|
|
132
|
+
manifestHash: plan.manifestHash,
|
|
133
|
+
state: readCanonicalRecord(plan.state, "Container grant state"),
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
containerKeks: [
|
|
137
|
+
...previousProjection.containerKeks.slice(0, -1),
|
|
138
|
+
{
|
|
139
|
+
...kek,
|
|
140
|
+
accessManifestHash: plan.manifestHash,
|
|
141
|
+
containerManifestHistory: [previous, ...kek.containerManifestHistory],
|
|
142
|
+
keyTargetHash: await computeContainerKekRecipientTargetHash(targets),
|
|
143
|
+
recipientTargets: readCanonicalRecords(targets, "Container grant targets"),
|
|
144
|
+
wraps: readCanonicalRecords(plan.wraps, "Container grant wraps"),
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
};
|
|
148
|
+
speculativeProjections.add(projection);
|
|
149
|
+
return projection;
|
|
150
|
+
}
|
|
110
151
|
//# sourceMappingURL=rekeyProjection.js.map
|