@ternent/core 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +17 -0
- package/.github/workflows/deploy-armour.yml +42 -0
- package/.github/workflows/deploy-identity.yml +42 -0
- package/.github/workflows/deploy-seal.yml +42 -0
- package/.github/workflows/deploy-ui.yml +42 -0
- package/.github/workflows/deploy-utils.yml +42 -0
- package/.github/workflows/release-create.yml +59 -0
- package/.github/workflows/release-publish.yml +54 -0
- package/.nvmrc +1 -0
- package/.ops/publish.mjs +31 -0
- package/package.json +16 -0
- package/packages/README.md +0 -0
- package/packages/armour/CHANGELOG.md +66 -0
- package/packages/armour/CLAUDE.md +8 -0
- package/packages/armour/README.md +103 -0
- package/packages/armour/SPEC.md +92 -0
- package/packages/armour/package.json +45 -0
- package/packages/armour/src/constants.ts +5 -0
- package/packages/armour/src/deps.d.ts +56 -0
- package/packages/armour/src/errors.ts +172 -0
- package/packages/armour/src/files.ts +73 -0
- package/packages/armour/src/identity.ts +72 -0
- package/packages/armour/src/index.ts +56 -0
- package/packages/armour/src/init.ts +10 -0
- package/packages/armour/src/passphrase.ts +33 -0
- package/packages/armour/src/recipients.ts +73 -0
- package/packages/armour/src/text.ts +68 -0
- package/packages/armour/src/types.ts +93 -0
- package/packages/armour/test/armour.test.ts +270 -0
- package/packages/armour/tsconfig.build.json +12 -0
- package/packages/armour/tsconfig.json +12 -0
- package/packages/armour/vite.config.ts +29 -0
- package/packages/concord/CHANGELOG.md +83 -0
- package/packages/concord/CLAUDE.md +9 -0
- package/packages/concord/README.md +146 -0
- package/packages/concord/SPEC.md +287 -0
- package/packages/concord/package.json +51 -0
- package/packages/concord/src/app.ts +717 -0
- package/packages/concord/src/errors.ts +9 -0
- package/packages/concord/src/index.ts +20 -0
- package/packages/concord/src/types.ts +127 -0
- package/packages/concord/test/concord.test.ts +978 -0
- package/packages/concord/tsconfig.json +12 -0
- package/packages/concord/vite.browser.config.ts +27 -0
- package/packages/concord/vite.config.ts +35 -0
- package/packages/concord/vite.config.ts.timestamp-1774262297922-ffd76e35ea668.mjs +83 -0
- package/packages/identity/CHANGELOG.md +47 -0
- package/packages/identity/README.md +236 -0
- package/packages/identity/package.json +41 -0
- package/packages/identity/src/index.ts +538 -0
- package/packages/identity/test/identity.test.ts +172 -0
- package/packages/identity/tsconfig.build.json +12 -0
- package/packages/identity/vite.config.ts +17 -0
- package/packages/ledger/CHANGELOG.md +69 -0
- package/packages/ledger/CLAUDE.md +9 -0
- package/packages/ledger/SPEC.md +304 -0
- package/packages/ledger/package.json +48 -0
- package/packages/ledger/src/index.ts +2 -0
- package/packages/ledger/src/ledger.ts +1286 -0
- package/packages/ledger/src/seal-cli.d.ts +25 -0
- package/packages/ledger/src/types.ts +294 -0
- package/packages/ledger/test/ledger.test.ts +838 -0
- package/packages/ledger/tsconfig.json +12 -0
- package/packages/ledger/vite.browser.config.ts +27 -0
- package/packages/ledger/vite.config.ts +39 -0
- package/packages/seal/CHANGELOG.md +137 -0
- package/packages/seal/CLAUDE.md +8 -0
- package/packages/seal/README.md +258 -0
- package/packages/seal/bin/seal +6 -0
- package/packages/seal/package.json +59 -0
- package/packages/seal/src/artifact.ts +380 -0
- package/packages/seal/src/cli.ts +372 -0
- package/packages/seal/src/commands/identity.ts +52 -0
- package/packages/seal/src/commands/manifest.ts +71 -0
- package/packages/seal/src/commands/publicKey.ts +7 -0
- package/packages/seal/src/commands/sign.ts +56 -0
- package/packages/seal/src/commands/verify.ts +54 -0
- package/packages/seal/src/crypto.ts +85 -0
- package/packages/seal/src/errors.ts +88 -0
- package/packages/seal/src/index.ts +5 -0
- package/packages/seal/src/manifest.ts +114 -0
- package/packages/seal/src/node.ts +18 -0
- package/packages/seal/src/proof.ts +344 -0
- package/packages/seal/test/artifact.test.ts +86 -0
- package/packages/seal/test/cli.test.ts +208 -0
- package/packages/seal/test/crypto.test.ts +21 -0
- package/packages/seal/test/manifest.test.ts +32 -0
- package/packages/seal/test/proof.test.ts +60 -0
- package/packages/seal/tsconfig.json +12 -0
- package/packages/seal/vite.config.ts +54 -0
- package/packages/ui/CHANGELOG.md +393 -0
- package/packages/ui/README.md +57 -0
- package/packages/ui/jsconfig.json +19 -0
- package/packages/ui/package.json +64 -0
- package/packages/ui/scripts/check-tokens.js +56 -0
- package/packages/ui/scripts/generate-theme-css.mjs +85 -0
- package/packages/ui/src/design-system/base.css +8 -0
- package/packages/ui/src/design-system/docs/ACCESSIBILITY_RULES.md +186 -0
- package/packages/ui/src/design-system/docs/AI_SYSTEM.md +281 -0
- package/packages/ui/src/design-system/docs/PATTERN_RULES.md +83 -0
- package/packages/ui/src/design-system/docs/PRIMITIVE_RULES.md +258 -0
- package/packages/ui/src/design-system/docs/TOKEN_RULES.md +235 -0
- package/packages/ui/src/design-system/docs/VISUAL_DIRECTION.md +68 -0
- package/packages/ui/src/design-system/foundation.js +420 -0
- package/packages/ui/src/design-system/tokens.css +140 -0
- package/packages/ui/src/design-system/tokens.js +327 -0
- package/packages/ui/src/design-system/utils.js +246 -0
- package/packages/ui/src/main.js +4 -0
- package/packages/ui/src/patterns/FeatureCard/FeatureCard.spec.md +24 -0
- package/packages/ui/src/patterns/FeatureCard/FeatureCard.types.ts +8 -0
- package/packages/ui/src/patterns/FeatureCard/FeatureCard.vue +175 -0
- package/packages/ui/src/patterns/FormField/FormField.spec.md +65 -0
- package/packages/ui/src/patterns/FormField/FormField.types.ts +11 -0
- package/packages/ui/src/patterns/FormField/FormField.vue +87 -0
- package/packages/ui/src/patterns/IdentityGlyph/IdentityGlyph.vue +61 -0
- package/packages/ui/src/patterns/IdentityGlyph/IdentityHandle.vue +58 -0
- package/packages/ui/src/patterns/IdentityGlyph/identityGlyph.types.ts +36 -0
- package/packages/ui/src/patterns/IdentityGlyph/identityGlyph.utils.ts +585 -0
- package/packages/ui/src/patterns/IdentityGlyph/index.ts +5 -0
- package/packages/ui/src/patterns/KeyValueList/KeyValueList.spec.md +28 -0
- package/packages/ui/src/patterns/KeyValueList/KeyValueList.types.ts +16 -0
- package/packages/ui/src/patterns/KeyValueList/KeyValueList.vue +50 -0
- package/packages/ui/src/patterns/LandingPage/LandingIcon.vue +90 -0
- package/packages/ui/src/patterns/LandingPage/LandingPage.spec.md +24 -0
- package/packages/ui/src/patterns/LandingPage/LandingPage.types.ts +212 -0
- package/packages/ui/src/patterns/LandingPage/LandingPage.vue +599 -0
- package/packages/ui/src/patterns/ListWorkspaceLayout/ListWorkspaceLayout.test.ts +33 -0
- package/packages/ui/src/patterns/ListWorkspaceLayout/ListWorkspaceLayout.vue +44 -0
- package/packages/ui/src/patterns/Logo/Logo.spec.md +22 -0
- package/packages/ui/src/patterns/Logo/Logo.vue +160 -0
- package/packages/ui/src/patterns/PageSurface/PageSurface.spec.md +15 -0
- package/packages/ui/src/patterns/PageSurface/PageSurface.vue +85 -0
- package/packages/ui/src/patterns/PanelChrome/PanelChrome.spec.md +39 -0
- package/packages/ui/src/patterns/PanelChrome/PanelChrome.types.ts +1 -0
- package/packages/ui/src/patterns/PanelChrome/PanelChrome.vue +187 -0
- package/packages/ui/src/patterns/PreviewPanel/PreviewPanel.spec.md +31 -0
- package/packages/ui/src/patterns/PreviewPanel/PreviewPanel.types.ts +23 -0
- package/packages/ui/src/patterns/PreviewPanel/PreviewPanel.vue +354 -0
- package/packages/ui/src/patterns/RecordList/RecordList.spec.md +35 -0
- package/packages/ui/src/patterns/RecordList/RecordList.test.ts +42 -0
- package/packages/ui/src/patterns/RecordList/RecordList.types.ts +9 -0
- package/packages/ui/src/patterns/RecordList/RecordList.utils.ts +5 -0
- package/packages/ui/src/patterns/RecordList/RecordList.vue +134 -0
- package/packages/ui/src/patterns/SectionClarifier/SectionClarifier.vue +85 -0
- package/packages/ui/src/patterns/SectionIntro/SectionIntro.spec.md +25 -0
- package/packages/ui/src/patterns/SectionIntro/SectionIntro.types.ts +7 -0
- package/packages/ui/src/patterns/SectionIntro/SectionIntro.vue +141 -0
- package/packages/ui/src/patterns/SidebarNav/SidebarNav.spec.md +34 -0
- package/packages/ui/src/patterns/SidebarNav/SidebarNav.types.ts +17 -0
- package/packages/ui/src/patterns/SidebarNav/SidebarNav.vue +110 -0
- package/packages/ui/src/patterns/SplitView/SplitView.spec.md +28 -0
- package/packages/ui/src/patterns/SplitView/SplitView.test.ts +22 -0
- package/packages/ui/src/patterns/SplitView/SplitView.types.ts +3 -0
- package/packages/ui/src/patterns/SplitView/SplitView.utils.ts +13 -0
- package/packages/ui/src/patterns/SplitView/SplitView.vue +39 -0
- package/packages/ui/src/patterns/StepList/StepList.spec.md +15 -0
- package/packages/ui/src/patterns/StepList/StepList.types.ts +4 -0
- package/packages/ui/src/patterns/StepList/StepList.vue +91 -0
- package/packages/ui/src/patterns/Verification/VerificationBadge.vue +97 -0
- package/packages/ui/src/patterns/Verification/VerificationComponents.test.ts +153 -0
- package/packages/ui/src/patterns/Verification/VerificationDetailsPanel.vue +270 -0
- package/packages/ui/src/patterns/Verification/VerificationSummary.vue +171 -0
- package/packages/ui/src/patterns/Verification/index.ts +6 -0
- package/packages/ui/src/patterns/Verification/verification.types.ts +8 -0
- package/packages/ui/src/patterns/Verification/verification.utils.test.ts +37 -0
- package/packages/ui/src/patterns/Verification/verification.utils.ts +75 -0
- package/packages/ui/src/patterns/index.ts +25 -0
- package/packages/ui/src/primitives/Accordian/Accordian.vue +11 -0
- package/packages/ui/src/primitives/Accordian/AccordianItem.vue +14 -0
- package/packages/ui/src/primitives/Accordion/Accordion.props.ts +21 -0
- package/packages/ui/src/primitives/Accordion/Accordion.spec.md +50 -0
- package/packages/ui/src/primitives/Accordion/Accordion.types.ts +4 -0
- package/packages/ui/src/primitives/Accordion/Accordion.variants.ts +12 -0
- package/packages/ui/src/primitives/Accordion/Accordion.vue +71 -0
- package/packages/ui/src/primitives/Accordion/AccordionItem.props.ts +14 -0
- package/packages/ui/src/primitives/Accordion/AccordionItem.vue +40 -0
- package/packages/ui/src/primitives/Badge/Badge.props.ts +17 -0
- package/packages/ui/src/primitives/Badge/Badge.spec.md +17 -0
- package/packages/ui/src/primitives/Badge/Badge.types.ts +15 -0
- package/packages/ui/src/primitives/Badge/Badge.variants.ts +48 -0
- package/packages/ui/src/primitives/Badge/Badge.vue +31 -0
- package/packages/ui/src/primitives/Button/Button.props.ts +29 -0
- package/packages/ui/src/primitives/Button/Button.spec.md +139 -0
- package/packages/ui/src/primitives/Button/Button.types.ts +19 -0
- package/packages/ui/src/primitives/Button/Button.variants.ts +72 -0
- package/packages/ui/src/primitives/Button/Button.vue +90 -0
- package/packages/ui/src/primitives/Card/Card.props.ts +17 -0
- package/packages/ui/src/primitives/Card/Card.spec.md +29 -0
- package/packages/ui/src/primitives/Card/Card.types.ts +12 -0
- package/packages/ui/src/primitives/Card/Card.variants.ts +27 -0
- package/packages/ui/src/primitives/Card/Card.vue +37 -0
- package/packages/ui/src/primitives/Checkbox/Checkbox.props.ts +21 -0
- package/packages/ui/src/primitives/Checkbox/Checkbox.spec.md +51 -0
- package/packages/ui/src/primitives/Checkbox/Checkbox.types.ts +4 -0
- package/packages/ui/src/primitives/Checkbox/Checkbox.variants.ts +34 -0
- package/packages/ui/src/primitives/Checkbox/Checkbox.vue +92 -0
- package/packages/ui/src/primitives/Dialog/Dialog.props.ts +29 -0
- package/packages/ui/src/primitives/Dialog/Dialog.spec.md +52 -0
- package/packages/ui/src/primitives/Dialog/Dialog.types.ts +3 -0
- package/packages/ui/src/primitives/Dialog/Dialog.variants.ts +27 -0
- package/packages/ui/src/primitives/Dialog/Dialog.vue +78 -0
- package/packages/ui/src/primitives/Drawer/Drawer.props.ts +33 -0
- package/packages/ui/src/primitives/Drawer/Drawer.spec.md +50 -0
- package/packages/ui/src/primitives/Drawer/Drawer.types.ts +5 -0
- package/packages/ui/src/primitives/Drawer/Drawer.variants.ts +35 -0
- package/packages/ui/src/primitives/Drawer/Drawer.vue +88 -0
- package/packages/ui/src/primitives/FieldMessage/FieldMessage.props.ts +17 -0
- package/packages/ui/src/primitives/FieldMessage/FieldMessage.spec.md +35 -0
- package/packages/ui/src/primitives/FieldMessage/FieldMessage.types.ts +5 -0
- package/packages/ui/src/primitives/FieldMessage/FieldMessage.variants.ts +14 -0
- package/packages/ui/src/primitives/FieldMessage/FieldMessage.vue +40 -0
- package/packages/ui/src/primitives/FileInput/FileInput.props.ts +41 -0
- package/packages/ui/src/primitives/FileInput/FileInput.types.ts +6 -0
- package/packages/ui/src/primitives/FileInput/FileInput.variants.ts +46 -0
- package/packages/ui/src/primitives/FileInput/FileInput.vue +163 -0
- package/packages/ui/src/primitives/Input/Input.props.ts +29 -0
- package/packages/ui/src/primitives/Input/Input.spec.md +79 -0
- package/packages/ui/src/primitives/Input/Input.types.ts +13 -0
- package/packages/ui/src/primitives/Input/Input.variants.ts +54 -0
- package/packages/ui/src/primitives/Input/Input.vue +99 -0
- package/packages/ui/src/primitives/Label/Label.props.ts +25 -0
- package/packages/ui/src/primitives/Label/Label.spec.md +31 -0
- package/packages/ui/src/primitives/Label/Label.types.ts +3 -0
- package/packages/ui/src/primitives/Label/Label.variants.ts +17 -0
- package/packages/ui/src/primitives/Label/Label.vue +38 -0
- package/packages/ui/src/primitives/Menu/Menu.props.ts +17 -0
- package/packages/ui/src/primitives/Menu/Menu.spec.md +38 -0
- package/packages/ui/src/primitives/Menu/Menu.types.ts +10 -0
- package/packages/ui/src/primitives/Menu/Menu.variants.ts +10 -0
- package/packages/ui/src/primitives/Menu/Menu.vue +57 -0
- package/packages/ui/src/primitives/Popover/Popover.props.ts +25 -0
- package/packages/ui/src/primitives/Popover/Popover.spec.md +49 -0
- package/packages/ui/src/primitives/Popover/Popover.types.ts +3 -0
- package/packages/ui/src/primitives/Popover/Popover.variants.ts +18 -0
- package/packages/ui/src/primitives/Popover/Popover.vue +74 -0
- package/packages/ui/src/primitives/RadioGroup/RadioGroup.props.ts +29 -0
- package/packages/ui/src/primitives/RadioGroup/RadioGroup.spec.md +50 -0
- package/packages/ui/src/primitives/RadioGroup/RadioGroup.types.ts +12 -0
- package/packages/ui/src/primitives/RadioGroup/RadioGroup.variants.ts +48 -0
- package/packages/ui/src/primitives/RadioGroup/RadioGroup.vue +87 -0
- package/packages/ui/src/primitives/Separator/Separator.props.ts +9 -0
- package/packages/ui/src/primitives/Separator/Separator.spec.md +15 -0
- package/packages/ui/src/primitives/Separator/Separator.types.ts +3 -0
- package/packages/ui/src/primitives/Separator/Separator.variants.ts +8 -0
- package/packages/ui/src/primitives/Separator/Separator.vue +23 -0
- package/packages/ui/src/primitives/Skeleton/Skeleton.props.ts +21 -0
- package/packages/ui/src/primitives/Skeleton/Skeleton.spec.md +18 -0
- package/packages/ui/src/primitives/Skeleton/Skeleton.types.ts +5 -0
- package/packages/ui/src/primitives/Skeleton/Skeleton.variants.ts +18 -0
- package/packages/ui/src/primitives/Skeleton/Skeleton.vue +37 -0
- package/packages/ui/src/primitives/Spinner/Spinner.props.ts +13 -0
- package/packages/ui/src/primitives/Spinner/Spinner.spec.md +16 -0
- package/packages/ui/src/primitives/Spinner/Spinner.types.ts +5 -0
- package/packages/ui/src/primitives/Spinner/Spinner.variants.ts +15 -0
- package/packages/ui/src/primitives/Spinner/Spinner.vue +33 -0
- package/packages/ui/src/primitives/SplitButton/SplitButton.vue +108 -0
- package/packages/ui/src/primitives/Switch/Switch.props.ts +21 -0
- package/packages/ui/src/primitives/Switch/Switch.spec.md +49 -0
- package/packages/ui/src/primitives/Switch/Switch.types.ts +3 -0
- package/packages/ui/src/primitives/Switch/Switch.variants.ts +34 -0
- package/packages/ui/src/primitives/Switch/Switch.vue +71 -0
- package/packages/ui/src/primitives/Tabs/Tabs.props.ts +25 -0
- package/packages/ui/src/primitives/Tabs/Tabs.spec.md +48 -0
- package/packages/ui/src/primitives/Tabs/Tabs.types.ts +11 -0
- package/packages/ui/src/primitives/Tabs/Tabs.variants.ts +28 -0
- package/packages/ui/src/primitives/Tabs/Tabs.vue +59 -0
- package/packages/ui/src/primitives/Textarea/Textarea.props.ts +33 -0
- package/packages/ui/src/primitives/Textarea/Textarea.spec.md +59 -0
- package/packages/ui/src/primitives/Textarea/Textarea.types.ts +5 -0
- package/packages/ui/src/primitives/Textarea/Textarea.variants.ts +27 -0
- package/packages/ui/src/primitives/Textarea/Textarea.vue +74 -0
- package/packages/ui/src/primitives/Tooltip/Tooltip.props.ts +21 -0
- package/packages/ui/src/primitives/Tooltip/Tooltip.spec.md +45 -0
- package/packages/ui/src/primitives/Tooltip/Tooltip.types.ts +3 -0
- package/packages/ui/src/primitives/Tooltip/Tooltip.variants.ts +4 -0
- package/packages/ui/src/primitives/Tooltip/Tooltip.vue +31 -0
- package/packages/ui/src/primitives/TreeView/TreeView.types.ts +10 -0
- package/packages/ui/src/primitives/TreeView/TreeView.vue +113 -0
- package/packages/ui/src/primitives/TreeView/TreeViewNode.vue +190 -0
- package/packages/ui/src/primitives/index.ts +29 -0
- package/packages/ui/src/style.css +7 -0
- package/packages/ui/src/style.js +1 -0
- package/packages/ui/src/themes/armour.css +147 -0
- package/packages/ui/src/themes/aurora.css +147 -0
- package/packages/ui/src/themes/citrine-ash.css +147 -0
- package/packages/ui/src/themes/concord.css +147 -0
- package/packages/ui/src/themes/garnet-honey.css +147 -0
- package/packages/ui/src/themes/harbor-rose.css +147 -0
- package/packages/ui/src/themes/ledger.css +147 -0
- package/packages/ui/src/themes/neon-noir.css +74 -0
- package/packages/ui/src/themes/obsidian-iris.css +147 -0
- package/packages/ui/src/themes/pixpax.css +147 -0
- package/packages/ui/src/themes/print.css +147 -0
- package/packages/ui/src/themes/prism.css +147 -0
- package/packages/ui/src/themes/proof.css +145 -0
- package/packages/ui/src/themes/semanticThemeContract.js +2256 -0
- package/packages/ui/src/themes/spruce-ink.css +147 -0
- package/packages/ui/src/themes/sunset.css +147 -0
- package/packages/ui/tailwind.config.js +64 -0
- package/packages/ui/vite.config.js +35 -0
- package/packages/ui/vite.config.js.timestamp-1780697224943-89fbc929987bc.mjs +38 -0
- package/packages/utils/CHANGELOG.md +111 -0
- package/packages/utils/README.md +3 -0
- package/packages/utils/package.json +46 -0
- package/packages/utils/src/index.test.js +39 -0
- package/packages/utils/src/index.ts +289 -0
- package/packages/utils/tsconfig.build.json +12 -0
- package/packages/utils/vite.config.js +28 -0
- package/pnpm-workspace.yaml +8 -0
- package/scripts/vite/package-lib-config.ts +59 -0
- package/tsconfig.json +24 -0
- package/tsconfig.node.json +9 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare module "@ternent/seal-cli" {
|
|
2
|
+
export function createSealHash(bytes: Uint8Array | ArrayBuffer): Promise<`sha256:${string}`>;
|
|
3
|
+
|
|
4
|
+
export function createSealProof(input: {
|
|
5
|
+
createdAt?: string;
|
|
6
|
+
signer: { identity: unknown };
|
|
7
|
+
subject: {
|
|
8
|
+
kind: "file" | "manifest" | "artifact";
|
|
9
|
+
path: string;
|
|
10
|
+
hash: `sha256:${string}`;
|
|
11
|
+
};
|
|
12
|
+
}): Promise<unknown>;
|
|
13
|
+
|
|
14
|
+
export function verifySealProofAgainstBytes(
|
|
15
|
+
proof: unknown,
|
|
16
|
+
bytes: Uint8Array | ArrayBuffer,
|
|
17
|
+
): Promise<{
|
|
18
|
+
valid: boolean;
|
|
19
|
+
hashMatch: boolean;
|
|
20
|
+
signatureValid: boolean;
|
|
21
|
+
keyId: string;
|
|
22
|
+
algorithm: string;
|
|
23
|
+
subjectHash: `sha256:${string}`;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import type { SerializedIdentity } from "@ternent/identity";
|
|
2
|
+
|
|
3
|
+
export type SealProof = {
|
|
4
|
+
version: string;
|
|
5
|
+
type: "seal-proof";
|
|
6
|
+
algorithm: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
subject: {
|
|
9
|
+
kind: "file" | "manifest" | "artifact";
|
|
10
|
+
path: string;
|
|
11
|
+
hash: `sha256:${string}`;
|
|
12
|
+
};
|
|
13
|
+
signer: {
|
|
14
|
+
publicKey: string;
|
|
15
|
+
keyId: string;
|
|
16
|
+
};
|
|
17
|
+
signature: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type SealSigner = {
|
|
21
|
+
identity: SerializedIdentity;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type LedgerDecryptor = {
|
|
25
|
+
identity: SerializedIdentity;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type LedgerRecipientResolver = (recipients: string[]) => Promise<string[]> | string[];
|
|
29
|
+
|
|
30
|
+
export type LedgerIdentityContext = {
|
|
31
|
+
signer: SealSigner;
|
|
32
|
+
authorResolver: () => Promise<string> | string;
|
|
33
|
+
recipientResolver?: LedgerRecipientResolver;
|
|
34
|
+
decryptor?: LedgerDecryptor;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type LedgerPlainPayloadRecord = {
|
|
38
|
+
type: "plain";
|
|
39
|
+
data: unknown;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type LedgerEncryptedPayloadRecord = {
|
|
43
|
+
type: "encrypted";
|
|
44
|
+
scheme: "age";
|
|
45
|
+
mode: "recipients";
|
|
46
|
+
encoding: "armor" | "binary";
|
|
47
|
+
data: string;
|
|
48
|
+
payloadHash: `sha256:${string}` | string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type LedgerPayloadRecord = LedgerPlainPayloadRecord | LedgerEncryptedPayloadRecord;
|
|
52
|
+
|
|
53
|
+
export type LedgerEntryRecord = {
|
|
54
|
+
entryId: string;
|
|
55
|
+
kind: string;
|
|
56
|
+
authoredAt: string;
|
|
57
|
+
author: string;
|
|
58
|
+
meta: Record<string, unknown> | null;
|
|
59
|
+
payload: LedgerPayloadRecord;
|
|
60
|
+
seal: SealProof;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type LedgerCommitRecord = {
|
|
64
|
+
commitId: string;
|
|
65
|
+
parentCommitId: string | null;
|
|
66
|
+
committedAt: string;
|
|
67
|
+
metadata: Record<string, unknown> | null;
|
|
68
|
+
entryIds: string[];
|
|
69
|
+
seal: SealProof;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export type LedgerUnsignedCommitRecord = Omit<LedgerCommitRecord, "commitId" | "seal">;
|
|
73
|
+
|
|
74
|
+
export type LedgerContainer = {
|
|
75
|
+
format: "concord-ledger";
|
|
76
|
+
version: "1";
|
|
77
|
+
commits: Record<string, LedgerCommitRecord>;
|
|
78
|
+
entries: Record<string, LedgerEntryRecord>;
|
|
79
|
+
head: string;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export type LedgerVerificationSnapshot = {
|
|
83
|
+
valid: boolean;
|
|
84
|
+
checkedAt: string;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type LedgerState<P> = {
|
|
88
|
+
container: LedgerContainer | null;
|
|
89
|
+
staged: LedgerEntryRecord[];
|
|
90
|
+
projection: P;
|
|
91
|
+
verification: LedgerVerificationSnapshot | null;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type LedgerProtectionInput =
|
|
95
|
+
| { type: "none" }
|
|
96
|
+
| {
|
|
97
|
+
type: "recipients";
|
|
98
|
+
recipients: string[];
|
|
99
|
+
encoding?: "armor" | "binary";
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type LedgerAppendInput = {
|
|
103
|
+
kind: string;
|
|
104
|
+
payload?: unknown;
|
|
105
|
+
meta?: Record<string, unknown>;
|
|
106
|
+
protection?: LedgerProtectionInput;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type LedgerAppendResult = {
|
|
110
|
+
entry: LedgerEntryRecord;
|
|
111
|
+
stagedCount: number;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export type LedgerCommitInput = {
|
|
115
|
+
metadata?: Record<string, unknown>;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type LedgerCommitResult = {
|
|
119
|
+
commit: LedgerCommitRecord;
|
|
120
|
+
committedEntries: LedgerEntryRecord[];
|
|
121
|
+
committedEntryIds: string[];
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export type LedgerReplayOptions = {
|
|
125
|
+
fromEntryId?: string;
|
|
126
|
+
toEntryId?: string;
|
|
127
|
+
verify?: boolean;
|
|
128
|
+
decrypt?: boolean;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type LedgerVerifyOptions = {
|
|
132
|
+
includeProofs?: boolean;
|
|
133
|
+
includePayloadHashes?: boolean;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export type LedgerReplayEntry =
|
|
137
|
+
| {
|
|
138
|
+
entryId: string;
|
|
139
|
+
kind: string;
|
|
140
|
+
author: string;
|
|
141
|
+
authoredAt: string;
|
|
142
|
+
meta: Record<string, unknown> | null;
|
|
143
|
+
payload: { type: "plain"; data: unknown };
|
|
144
|
+
verified: true;
|
|
145
|
+
}
|
|
146
|
+
| {
|
|
147
|
+
entryId: string;
|
|
148
|
+
kind: string;
|
|
149
|
+
author: string;
|
|
150
|
+
authoredAt: string;
|
|
151
|
+
meta: Record<string, unknown> | null;
|
|
152
|
+
payload: {
|
|
153
|
+
type: "encrypted";
|
|
154
|
+
scheme: "age";
|
|
155
|
+
mode: "recipients";
|
|
156
|
+
encoding: "armor" | "binary";
|
|
157
|
+
data: string;
|
|
158
|
+
};
|
|
159
|
+
verified: true;
|
|
160
|
+
decrypted: false;
|
|
161
|
+
}
|
|
162
|
+
| {
|
|
163
|
+
entryId: string;
|
|
164
|
+
kind: string;
|
|
165
|
+
author: string;
|
|
166
|
+
authoredAt: string;
|
|
167
|
+
meta: Record<string, unknown> | null;
|
|
168
|
+
payload: {
|
|
169
|
+
type: "decrypted";
|
|
170
|
+
original: "encrypted";
|
|
171
|
+
data: unknown;
|
|
172
|
+
};
|
|
173
|
+
verified: true;
|
|
174
|
+
decrypted: true;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export type LedgerProjector<P> = (projection: P, entry: LedgerReplayEntry) => P;
|
|
178
|
+
|
|
179
|
+
export type LedgerVerificationResult = {
|
|
180
|
+
valid: boolean;
|
|
181
|
+
committedHistoryValid: boolean;
|
|
182
|
+
commitChainValid: boolean;
|
|
183
|
+
commitProofsValid: boolean;
|
|
184
|
+
entriesValid: boolean;
|
|
185
|
+
entryProofsValid: boolean;
|
|
186
|
+
payloadHashesValid: boolean;
|
|
187
|
+
proofsValid: boolean;
|
|
188
|
+
invalidCommitIds: string[];
|
|
189
|
+
invalidEntryIds: string[];
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export type LedgerPersistenceSnapshot = {
|
|
193
|
+
container: LedgerContainer | null;
|
|
194
|
+
staged: LedgerEntryRecord[];
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export type LedgerStorageAdapter = {
|
|
198
|
+
name: string;
|
|
199
|
+
load(): Promise<LedgerPersistenceSnapshot | null>;
|
|
200
|
+
save(snapshot: LedgerPersistenceSnapshot): Promise<void>;
|
|
201
|
+
clear?(): Promise<void>;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export type LedgerReplayPolicy = {
|
|
205
|
+
verify?: boolean;
|
|
206
|
+
decrypt?: boolean;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export type LedgerProtocolContract = {
|
|
210
|
+
canonicalizePayload: (value: unknown) => string;
|
|
211
|
+
getEntrySubjectBytes: (entry: Omit<LedgerEntryRecord, "entryId" | "seal">) => Uint8Array;
|
|
212
|
+
getCommitSubjectBytes: (commit: LedgerUnsignedCommitRecord) => Uint8Array;
|
|
213
|
+
deriveEntryId: (entry: LedgerEntryRecord) => Promise<string>;
|
|
214
|
+
deriveCommitId: (commit: LedgerUnsignedCommitRecord) => Promise<string>;
|
|
215
|
+
getCommitChain: (container: LedgerContainer) => string[];
|
|
216
|
+
validateContainer: (container: LedgerContainer) => {
|
|
217
|
+
ok: boolean;
|
|
218
|
+
errors: string[];
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export type LedgerSealContract = {
|
|
223
|
+
createEntryProof: (input: {
|
|
224
|
+
entry: Omit<LedgerEntryRecord, "entryId" | "seal">;
|
|
225
|
+
subjectBytes: Uint8Array;
|
|
226
|
+
signer: SealSigner;
|
|
227
|
+
}) => Promise<SealProof>;
|
|
228
|
+
verifyEntryProof: (input: {
|
|
229
|
+
entry: LedgerEntryRecord;
|
|
230
|
+
subjectBytes: Uint8Array;
|
|
231
|
+
proof: SealProof;
|
|
232
|
+
}) => Promise<boolean>;
|
|
233
|
+
createCommitProof: (input: {
|
|
234
|
+
commit: LedgerUnsignedCommitRecord;
|
|
235
|
+
commitId: string;
|
|
236
|
+
subjectBytes: Uint8Array;
|
|
237
|
+
signer: SealSigner;
|
|
238
|
+
}) => Promise<SealProof>;
|
|
239
|
+
verifyCommitProof: (input: {
|
|
240
|
+
commit: LedgerCommitRecord;
|
|
241
|
+
subjectBytes: Uint8Array;
|
|
242
|
+
proof: SealProof;
|
|
243
|
+
}) => Promise<boolean>;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export type LedgerArmourContract = {
|
|
247
|
+
encrypt: (input: {
|
|
248
|
+
recipients: string[];
|
|
249
|
+
data: Uint8Array;
|
|
250
|
+
encoding: "armor" | "binary";
|
|
251
|
+
}) => Promise<{
|
|
252
|
+
data: string;
|
|
253
|
+
payloadHash: `sha256:${string}` | string;
|
|
254
|
+
}>;
|
|
255
|
+
decrypt: (input: {
|
|
256
|
+
payload: LedgerEncryptedPayloadRecord;
|
|
257
|
+
decryptor: LedgerDecryptor;
|
|
258
|
+
}) => Promise<unknown>;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export type CreateLedgerParams = {
|
|
262
|
+
metadata?: Record<string, unknown>;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export type CreateLedgerConfig<P> = {
|
|
266
|
+
identity: LedgerIdentityContext;
|
|
267
|
+
initialProjection: P;
|
|
268
|
+
projector: LedgerProjector<P>;
|
|
269
|
+
storage?: LedgerStorageAdapter;
|
|
270
|
+
protocol?: LedgerProtocolContract;
|
|
271
|
+
seal?: LedgerSealContract;
|
|
272
|
+
armour?: LedgerArmourContract;
|
|
273
|
+
now?: () => string;
|
|
274
|
+
autoCommit?: boolean;
|
|
275
|
+
replayPolicy?: LedgerReplayPolicy;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
export type LedgerInstance<P> = {
|
|
279
|
+
create(params?: CreateLedgerParams): Promise<void>;
|
|
280
|
+
load(container: LedgerContainer): Promise<void>;
|
|
281
|
+
loadFromStorage(): Promise<boolean>;
|
|
282
|
+
append(input: LedgerAppendInput): Promise<LedgerAppendResult>;
|
|
283
|
+
appendMany(inputs: LedgerAppendInput[]): Promise<LedgerAppendResult[]>;
|
|
284
|
+
commit(input?: LedgerCommitInput): Promise<LedgerCommitResult>;
|
|
285
|
+
replay(options?: LedgerReplayOptions): Promise<P>;
|
|
286
|
+
recompute(): Promise<P>;
|
|
287
|
+
verify(options?: LedgerVerifyOptions): Promise<LedgerVerificationResult>;
|
|
288
|
+
export(): Promise<LedgerContainer>;
|
|
289
|
+
import(container: LedgerContainer): Promise<void>;
|
|
290
|
+
getState(): Readonly<LedgerState<P>>;
|
|
291
|
+
subscribe(listener: (state: Readonly<LedgerState<P>>) => void): () => void;
|
|
292
|
+
clearStaged(): Promise<void>;
|
|
293
|
+
destroy(): Promise<void>;
|
|
294
|
+
};
|