@tinycloud/sdk-core 3.0.0-beta.1 → 3.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{credential-admission-C_cO1QqB.d.cts → credential-admission-CFjUChF8.d.cts} +122 -2
- package/dist/{credential-admission-cvHe-HUC.d.ts → credential-admission-DIEPgQ0o.d.ts} +122 -2
- package/dist/delegations/index.cjs +80 -133
- package/dist/delegations/index.cjs.map +1 -1
- package/dist/delegations/index.d.cts +3 -3
- package/dist/delegations/index.d.ts +3 -3
- package/dist/delegations/index.js +81 -138
- package/dist/delegations/index.js.map +1 -1
- package/dist/index.cjs +758 -306
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +67 -8
- package/dist/index.d.ts +67 -8
- package/dist/index.js +760 -311
- package/dist/index.js.map +1 -1
- package/dist/policy/index.cjs +324 -8
- package/dist/policy/index.cjs.map +1 -1
- package/dist/policy/index.d.cts +2 -2
- package/dist/policy/index.d.ts +2 -2
- package/dist/policy/index.js +324 -8
- package/dist/policy/index.js.map +1 -1
- package/dist/{recipient-types.schema-G8NEKRoo.d.cts → recipient-types.schema-Cz5zJzED.d.cts} +50 -77
- package/dist/{recipient-types.schema-G8NEKRoo.d.ts → recipient-types.schema-Cz5zJzED.d.ts} +50 -77
- package/package.json +4 -4
|
@@ -445,6 +445,49 @@ interface UnifiedPolicyV1 {
|
|
|
445
445
|
readonly value: string;
|
|
446
446
|
};
|
|
447
447
|
}
|
|
448
|
+
interface PolicyRootV3 {
|
|
449
|
+
readonly cid: string;
|
|
450
|
+
readonly authorization: string;
|
|
451
|
+
}
|
|
452
|
+
interface RegisterPolicyV3Input {
|
|
453
|
+
readonly nodeOrigin: string;
|
|
454
|
+
readonly policyCid: string;
|
|
455
|
+
readonly policy: Readonly<Record<string, unknown>>;
|
|
456
|
+
readonly policyRoot: PolicyRootV3;
|
|
457
|
+
readonly enforcementRoot: PolicyRootV3;
|
|
458
|
+
readonly contentSourceDigestHex: string;
|
|
459
|
+
readonly nativeProjectionHashHex: string;
|
|
460
|
+
readonly rootExpiresAt: string;
|
|
461
|
+
readonly enforcerDid: string;
|
|
462
|
+
readonly expectedNodeAudience: string;
|
|
463
|
+
readonly fetch?: typeof fetch;
|
|
464
|
+
readonly signal?: AbortSignal;
|
|
465
|
+
}
|
|
466
|
+
interface AttestedEnforcerBindingV2 {
|
|
467
|
+
readonly schema: "xyz.tinycloud.policy/attested-enforcer/v2";
|
|
468
|
+
readonly enforcerDid: string;
|
|
469
|
+
readonly nodeAudience: string;
|
|
470
|
+
readonly attestationBindingDigestHex: string;
|
|
471
|
+
readonly issuedAt: string;
|
|
472
|
+
readonly expiresAt: string;
|
|
473
|
+
readonly signature: {
|
|
474
|
+
readonly suite: "Ed25519";
|
|
475
|
+
readonly signerDid: string;
|
|
476
|
+
readonly value: string;
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
interface RegisterPolicyV3Receipt {
|
|
480
|
+
readonly policyCid: string;
|
|
481
|
+
readonly policyRootCid: string;
|
|
482
|
+
readonly enforcementRootCid: string;
|
|
483
|
+
readonly attestedEnforcerBinding: AttestedEnforcerBindingV2;
|
|
484
|
+
}
|
|
485
|
+
type PolicySessionUcanFactV1 = Readonly<Record<string, unknown>> & {
|
|
486
|
+
/** Present only on accountless PolicyCredentialPresentation/v4 admissions. */
|
|
487
|
+
readonly credentialIdAuditDigestHex?: string;
|
|
488
|
+
/** Present only on accountless PolicyCredentialPresentation/v4 admissions. */
|
|
489
|
+
readonly presentationJtiAuditDigestHex?: string;
|
|
490
|
+
};
|
|
448
491
|
interface PolicySessionUcanV1 {
|
|
449
492
|
readonly authorization: string;
|
|
450
493
|
readonly cid: string;
|
|
@@ -455,7 +498,7 @@ interface PolicySessionUcanV1 {
|
|
|
455
498
|
readonly nbf: number;
|
|
456
499
|
readonly exp: number;
|
|
457
500
|
readonly nnc: string;
|
|
458
|
-
readonly fact:
|
|
501
|
+
readonly fact: PolicySessionUcanFactV1;
|
|
459
502
|
}
|
|
460
503
|
interface PolicyChallengeV3 {
|
|
461
504
|
readonly challengeId: string;
|
|
@@ -468,10 +511,17 @@ interface PolicyChallengeV3 {
|
|
|
468
511
|
}
|
|
469
512
|
declare function requestPolicyChallengeV3(input: {
|
|
470
513
|
readonly nodeOrigin: string;
|
|
514
|
+
/**
|
|
515
|
+
* Policy control routes are part of the recipient's TinyCloud Node. This is
|
|
516
|
+
* deliberately a path, not a second origin: applications must not send a
|
|
517
|
+
* credential presentation to a separately discovered policy service.
|
|
518
|
+
*/
|
|
519
|
+
readonly policyRuntimePath?: string;
|
|
471
520
|
readonly policyCid: string;
|
|
472
521
|
readonly recipientDid: string;
|
|
473
522
|
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
474
523
|
readonly fetch?: typeof fetch;
|
|
524
|
+
readonly signal?: AbortSignal;
|
|
475
525
|
}): Promise<PolicyChallengeV3>;
|
|
476
526
|
declare function mintPolicySessionV3(input: {
|
|
477
527
|
readonly nodeOrigin: string;
|
|
@@ -485,6 +535,7 @@ declare function mintPolicySessionV3(input: {
|
|
|
485
535
|
readonly presentation: Readonly<Record<string, unknown>>;
|
|
486
536
|
readonly challenge?: PolicyChallengeV3;
|
|
487
537
|
readonly fetch?: typeof fetch;
|
|
538
|
+
readonly signal?: AbortSignal;
|
|
488
539
|
}): Promise<PolicySessionUcanV1>;
|
|
489
540
|
interface PolicyRootStatusV3 {
|
|
490
541
|
readonly rootCid: string;
|
|
@@ -543,6 +594,12 @@ declare function projectUnifiedPolicyCapabilities(input: readonly unknown[]): Un
|
|
|
543
594
|
declare function unifiedNativeProjectionHashHex(input: readonly unknown[]): string;
|
|
544
595
|
declare function unifiedPolicyCapabilityFromNative(input: unknown): UnifiedPolicyCapability;
|
|
545
596
|
declare function contentSourceDigestHex(input: UnifiedContentSource): string;
|
|
597
|
+
/**
|
|
598
|
+
* Register a signed policy and its sibling roots with the embedded Node
|
|
599
|
+
* Policy/v3 runtime. This is intentionally application-neutral: callers
|
|
600
|
+
* supply policy material, while Node owns both transport endpoints.
|
|
601
|
+
*/
|
|
602
|
+
declare function registerPolicyV3(input: RegisterPolicyV3Input): Promise<RegisterPolicyV3Receipt>;
|
|
546
603
|
declare function policyDigestHex(policy: Omit<UnifiedPolicyV1, "policyId" | "signature">): string;
|
|
547
604
|
declare function policyIdForDigestHex(digestHex: string): string;
|
|
548
605
|
declare function policyCidFromCanonicalBytes(bytes: Uint8Array): string;
|
|
@@ -682,6 +739,8 @@ declare const POLICY_V2_DOMAIN = "xyz.tinycloud.policy/policy/v2\0";
|
|
|
682
739
|
declare const POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE: "TinyCloudPolicyCredentialRequirement";
|
|
683
740
|
declare const POLICY_PRESENTATION_V3_SCHEMA: "xyz.tinycloud.policy/presentation/v3";
|
|
684
741
|
declare const POLICY_PRESENTATION_V3_DOMAIN = "xyz.tinycloud.policy/Presentation/v3\0";
|
|
742
|
+
declare const POLICY_PRESENTATION_V4_SCHEMA: "xyz.tinycloud.policy/presentation/v4";
|
|
743
|
+
declare const POLICY_PRESENTATION_V4_DOMAIN = "xyz.tinycloud.policy/Presentation/v4\0";
|
|
685
744
|
interface PolicyCredentialRequirementV1 {
|
|
686
745
|
readonly type: typeof POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE;
|
|
687
746
|
readonly version: 1;
|
|
@@ -736,6 +795,29 @@ interface PolicyCredentialPresentationV3 {
|
|
|
736
795
|
readonly value: string;
|
|
737
796
|
};
|
|
738
797
|
}
|
|
798
|
+
interface UnsignedPolicyCredentialPresentationV4 {
|
|
799
|
+
readonly schema: typeof POLICY_PRESENTATION_V4_SCHEMA;
|
|
800
|
+
readonly jti: string;
|
|
801
|
+
readonly challengeId: string;
|
|
802
|
+
readonly nonce: string;
|
|
803
|
+
readonly policyCid: string;
|
|
804
|
+
readonly nodeAudience: string;
|
|
805
|
+
readonly holderDid: string;
|
|
806
|
+
readonly subjectDid: string;
|
|
807
|
+
readonly credentialDigest: string;
|
|
808
|
+
readonly requirementDigest: string;
|
|
809
|
+
readonly descriptorDigest: string;
|
|
810
|
+
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
811
|
+
readonly issuedAt: string;
|
|
812
|
+
readonly expiresAt: string;
|
|
813
|
+
}
|
|
814
|
+
interface PolicyCredentialPresentationV4 extends UnsignedPolicyCredentialPresentationV4 {
|
|
815
|
+
readonly signature: {
|
|
816
|
+
readonly suite: "Ed25519";
|
|
817
|
+
readonly signerDid: string;
|
|
818
|
+
readonly value: string;
|
|
819
|
+
};
|
|
820
|
+
}
|
|
739
821
|
declare function validatePolicyCredentialRequirementV1(value: unknown): PolicyCredentialRequirementV1;
|
|
740
822
|
declare function policyV2DigestHex(input: UnsignedUnifiedPolicyV2): string;
|
|
741
823
|
/**
|
|
@@ -744,6 +826,21 @@ declare function policyV2DigestHex(input: UnsignedUnifiedPolicyV2): string;
|
|
|
744
826
|
* Node remains the authoritative signature verifier at admission.
|
|
745
827
|
*/
|
|
746
828
|
declare function validateUnifiedPolicyV2(value: unknown, expectedPolicyCid?: string): UnifiedPolicyV2;
|
|
829
|
+
declare function issuedCredentialEnvelopeFromVerified(verified: VerifiedCredential): IssuedCredentialEnvelope;
|
|
830
|
+
/** Sign the exact accountless v4 wire value. No account custody fields exist. */
|
|
831
|
+
declare function signPolicyCredentialPresentationV4(value: UnsignedPolicyCredentialPresentationV4, sign: (digest: Uint8Array) => Promise<Uint8Array>): Promise<PolicyCredentialPresentationV4>;
|
|
832
|
+
interface BuildPolicyCredentialPresentationV4Input {
|
|
833
|
+
readonly policy: UnifiedPolicyV2;
|
|
834
|
+
readonly policyCid: string;
|
|
835
|
+
readonly challenge: PolicyChallengeV3;
|
|
836
|
+
readonly requirement: CredentialRequirement;
|
|
837
|
+
readonly credential: VerifiedCredential;
|
|
838
|
+
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
839
|
+
readonly sign: (digest: Uint8Array) => Promise<Uint8Array>;
|
|
840
|
+
readonly now?: Date;
|
|
841
|
+
readonly jti?: string;
|
|
842
|
+
}
|
|
843
|
+
declare function buildPolicyCredentialPresentationV4(input: BuildPolicyCredentialPresentationV4Input): Promise<PolicyCredentialPresentationV4>;
|
|
747
844
|
interface BuildPolicyCredentialPresentationV3Input {
|
|
748
845
|
readonly policy: UnifiedPolicyV2;
|
|
749
846
|
readonly policyCid: string;
|
|
@@ -761,11 +858,14 @@ interface AdmitPolicyCredentialV3Input extends Omit<BuildPolicyCredentialPresent
|
|
|
761
858
|
readonly policyRootCid: string;
|
|
762
859
|
readonly enforcementRootCid: string;
|
|
763
860
|
readonly nodeOrigin: string;
|
|
861
|
+
/** Path to the embedded Node policy runtime. Defaults to `/policy/v3`. */
|
|
862
|
+
readonly policyRuntimePath?: string;
|
|
764
863
|
/** Root authorization CID of the recipient's active TinyCloud account session. */
|
|
765
864
|
readonly accountAuthorizationCid: string;
|
|
766
865
|
/** Recipient-owned `credentials` space covered by the account authorization. */
|
|
767
866
|
readonly credentialSpaceId: string;
|
|
768
867
|
readonly fetch?: typeof fetch;
|
|
868
|
+
readonly signal?: AbortSignal;
|
|
769
869
|
}
|
|
770
870
|
interface PolicyCredentialAdmissionV3 {
|
|
771
871
|
readonly challenge: PolicyChallengeV3;
|
|
@@ -777,5 +877,25 @@ interface PolicyCredentialAdmissionV3 {
|
|
|
777
877
|
* Raw credential material appears only in the TLS POST body.
|
|
778
878
|
*/
|
|
779
879
|
declare function admitPolicyCredentialV3(input: AdmitPolicyCredentialV3Input): Promise<PolicyCredentialAdmissionV3>;
|
|
880
|
+
interface AdmitPolicyCredentialV4Input extends Omit<BuildPolicyCredentialPresentationV4Input, "challenge"> {
|
|
881
|
+
readonly policyRootCid: string;
|
|
882
|
+
readonly enforcementRootCid: string;
|
|
883
|
+
readonly expectedNodeAudience: string;
|
|
884
|
+
readonly expectedEnforcerDid: string;
|
|
885
|
+
readonly nodeOrigin: string;
|
|
886
|
+
/** Path to the embedded Node policy runtime. Defaults to `/policy/v3`. */
|
|
887
|
+
readonly policyRuntimePath?: string;
|
|
888
|
+
readonly fetch?: typeof fetch;
|
|
889
|
+
readonly signal?: AbortSignal;
|
|
890
|
+
}
|
|
891
|
+
interface PolicyCredentialAdmissionV4 {
|
|
892
|
+
readonly challenge: PolicyChallengeV3;
|
|
893
|
+
readonly presentation: PolicyCredentialPresentationV4;
|
|
894
|
+
readonly session: PolicySessionUcanV1;
|
|
895
|
+
/** The ordinary delegation has been activated using Node's generic `/delegate`. */
|
|
896
|
+
readonly delegationImported: true;
|
|
897
|
+
}
|
|
898
|
+
/** Accountless admission. The request deliberately has no account custody fields. */
|
|
899
|
+
declare function admitPolicyCredentialV4(input: AdmitPolicyCredentialV4Input): Promise<PolicyCredentialAdmissionV4>;
|
|
780
900
|
|
|
781
|
-
export { type
|
|
901
|
+
export { type RegisterPolicyV3Receipt as $, ATTESTED_ENFORCER_BINDING_V2_SCHEMA as A, type BuildPolicyCredentialPresentationV3Input as B, CONTENT_SOURCE_V1_DOMAIN as C, type PolicyCredentialAdmissionV3 as D, ED25519_JCS_SIGNATURE_SUITE as E, type PolicyCredentialAdmissionV4 as F, type PolicyCredentialPresentationV3 as G, type PolicyCredentialPresentationV4 as H, type PolicyCredentialRequirementV1 as I, type JsonObject as J, type PolicyRootStatusV3 as K, LAST_V2_CREATE_AT as L, MAX_LEGACY_ENVELOPE_EXPIRES_AT as M, NATIVE_PROJECTION_V1_DOMAIN as N, type PolicyRootV3 as O, type PolicyEngineRecord as P, type PolicySessionUcanFactV1 as Q, type PolicySessionUcanV1 as R, type SignedObjectSigner as S, type PolicyStatus as T, type UnsignedPolicyEngineRecord as U, ROOT_REVOCATION_V1_DOMAIN as V, ROOT_REVOCATION_V1_SCHEMA as W, ROOT_STATUS_CHECKPOINT_V1_SCHEMA as X, ROOT_STATUS_RENEWAL_V1_DOMAIN as Y, ROOT_STATUS_V1_DOMAIN as Z, type RegisterPolicyV3Input as _, type Policy as a, signCompactUcanRootAuthorization as a$, type SignCompactUcanAuthorizationInput as a0, type SignCompactUcanRootAuthorizationInput as a1, SignatureMaterialError as a2, type SignatureSuite as a3, SignatureVerificationError as a4, SignedObjectCanonicalizationError as a5, SignedObjectDigestError as a6, type SignedObjectErrorCode as a7, SignedObjectIdError as a8, type SignedObjectKind as a9, canonicalizeUnifiedPolicyCapability as aA, compactAttenuationContains as aB, contentSourceDigestHex as aC, createAndSignPolicy as aD, createAndSignPolicyEngineRecord as aE, createAndSignPolicyStatus as aF, createAndSignSignedObject as aG, createCompactPolicyDescendant as aH, createCompactPolicyInvocation as aI, deriveSignedObjectMaterial as aJ, getPolicyRootStatusV3 as aK, issuedCredentialEnvelopeFromVerified as aL, mintPolicySessionV3 as aM, normalizeUnifiedPolicyCapability as aN, parseCompactUcanAuthorization as aO, parsePolicySessionUcan as aP, policyCidFromCanonicalBytes as aQ, policyDigestHex as aR, policyIdForDigestHex as aS, policyV2DigestHex as aT, projectUnifiedPolicyCapabilities as aU, projectUnifiedPolicyCapability as aV, registerPolicyV3 as aW, renewPolicyRootStatusV3 as aX, requestPolicyChallengeV3 as aY, revokePolicyRootV3 as aZ, signCompactUcanAuthorization as a_, type SignedObjectMaterial as aa, SignedObjectProfileError as ab, SignedObjectSchemaError as ac, type SignedObjectSignature as ad, type SignedObjectVerificationResult as ae, type SignedPolicyObject as af, SigningKeyBindingError as ag, type UnifiedContentSource as ah, type UnifiedEncryptionCapability as ai, type UnifiedKvCapability as aj, type UnifiedNativeCapability as ak, type UnifiedPolicyCapability as al, type UnifiedPolicyV1 as am, type UnifiedPolicyV2 as an, type UnifiedResourceSelector as ao, type UnsignedPolicy as ap, type UnsignedPolicyCredentialPresentationV4 as aq, type UnsignedPolicyObject as ar, type UnsignedPolicyStatus as as, type UnsignedUnifiedPolicyV2 as at, UnsupportedSignatureSuiteError as au, admitPolicyCredentialV3 as av, admitPolicyCredentialV4 as aw, buildPolicyCredentialPresentationV3 as ax, buildPolicyCredentialPresentationV4 as ay, canonicalizeSignedObjectUnsigned as az, type AdmitPolicyCredentialV3Input as b, signPolicyCredentialPresentationV4 as b0, signedObjectIdFor as b1, toSignedObjectError as b2, unifiedNativeProjectionHashHex as b3, unifiedPolicyCapabilityContains as b4, unifiedPolicyCapabilityDigestHex as b5, unifiedPolicyCapabilityFromNative as b6, validatePolicyCredentialRequirementV1 as b7, validatePolicyEngineRecordSigned as b8, validatePolicyEngineRecordSignedShape as b9, type CredentialClaimDescriptor as bA, type CredentialEndpointId as bB, type CredentialInputDescriptor as bC, type CredentialProgressEvent as bD, type CredentialStepDescriptor as bE, type CredentialStepType as bF, type CredentialUxState as bG, HOLDER_BINDING_DOMAIN as bH, type IssuerVerificationKey as bI, validatePolicyEngineRecordUnsigned as ba, validatePolicySigned as bb, validatePolicySignedShape as bc, validatePolicyStatusSigned as bd, validatePolicyStatusSignedShape as be, validatePolicyStatusUnsigned as bf, validatePolicyUnsigned as bg, validateUnifiedPolicyV2 as bh, verifyPolicy as bi, verifyPolicyEngineRecord as bj, verifyPolicyRootRevocationV3 as bk, verifyPolicyRootStatusCheckpointV3 as bl, verifyPolicyStatus as bm, verifySignedObject as bn, type CredentialHolderBinding as bo, type CredentialFlowDescriptor as bp, type CredentialRequirement as bq, type StoredCredentialRecord as br, type VerifiedCredential as bs, type CredentialStorageReceipt as bt, type IssuedCredentialEnvelope as bu, type CredentialIssuerMetadata as bv, CREDENTIAL_ACQUISITION_PROTOCOL as bw, CREDENTIAL_CONTRACT_VERSION as bx, CREDENTIAL_FORMAT as by, CREDENTIAL_STEP_REGISTRY_VERSION as bz, type AdmitPolicyCredentialV4Input as c, type AttestedEnforcerBindingV2 as d, type BuildPolicyCredentialPresentationV4Input as e, type CompactPolicyInvocationInput as f, type CompactUcanAuthorizationV1 as g, EIP191_JCS_SIGNATURE_SUITE as h, LAST_V2_READ_AT as i, POLICY_CAPABILITY_V1_DOMAIN as j, POLICY_CAPABILITY_V1_SCHEMA as k, POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE as l, POLICY_ENFORCEMENT_DELEGATION_V2_SCHEMA as m, POLICY_ENGINE_RECORD_SCHEMA as n, POLICY_PRESENTATION_V3_DOMAIN as o, POLICY_PRESENTATION_V3_SCHEMA as p, POLICY_PRESENTATION_V4_DOMAIN as q, POLICY_PRESENTATION_V4_SCHEMA as r, POLICY_SCHEMA as s, POLICY_SESSION_UCAN_V1_PROFILE as t, POLICY_STATUS_SCHEMA as u, POLICY_V1_DOMAIN as v, POLICY_V1_SCHEMA as w, POLICY_V2_DOMAIN as x, POLICY_V2_SCHEMA as y, type PolicyChallengeV3 as z };
|
|
@@ -445,6 +445,49 @@ interface UnifiedPolicyV1 {
|
|
|
445
445
|
readonly value: string;
|
|
446
446
|
};
|
|
447
447
|
}
|
|
448
|
+
interface PolicyRootV3 {
|
|
449
|
+
readonly cid: string;
|
|
450
|
+
readonly authorization: string;
|
|
451
|
+
}
|
|
452
|
+
interface RegisterPolicyV3Input {
|
|
453
|
+
readonly nodeOrigin: string;
|
|
454
|
+
readonly policyCid: string;
|
|
455
|
+
readonly policy: Readonly<Record<string, unknown>>;
|
|
456
|
+
readonly policyRoot: PolicyRootV3;
|
|
457
|
+
readonly enforcementRoot: PolicyRootV3;
|
|
458
|
+
readonly contentSourceDigestHex: string;
|
|
459
|
+
readonly nativeProjectionHashHex: string;
|
|
460
|
+
readonly rootExpiresAt: string;
|
|
461
|
+
readonly enforcerDid: string;
|
|
462
|
+
readonly expectedNodeAudience: string;
|
|
463
|
+
readonly fetch?: typeof fetch;
|
|
464
|
+
readonly signal?: AbortSignal;
|
|
465
|
+
}
|
|
466
|
+
interface AttestedEnforcerBindingV2 {
|
|
467
|
+
readonly schema: "xyz.tinycloud.policy/attested-enforcer/v2";
|
|
468
|
+
readonly enforcerDid: string;
|
|
469
|
+
readonly nodeAudience: string;
|
|
470
|
+
readonly attestationBindingDigestHex: string;
|
|
471
|
+
readonly issuedAt: string;
|
|
472
|
+
readonly expiresAt: string;
|
|
473
|
+
readonly signature: {
|
|
474
|
+
readonly suite: "Ed25519";
|
|
475
|
+
readonly signerDid: string;
|
|
476
|
+
readonly value: string;
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
interface RegisterPolicyV3Receipt {
|
|
480
|
+
readonly policyCid: string;
|
|
481
|
+
readonly policyRootCid: string;
|
|
482
|
+
readonly enforcementRootCid: string;
|
|
483
|
+
readonly attestedEnforcerBinding: AttestedEnforcerBindingV2;
|
|
484
|
+
}
|
|
485
|
+
type PolicySessionUcanFactV1 = Readonly<Record<string, unknown>> & {
|
|
486
|
+
/** Present only on accountless PolicyCredentialPresentation/v4 admissions. */
|
|
487
|
+
readonly credentialIdAuditDigestHex?: string;
|
|
488
|
+
/** Present only on accountless PolicyCredentialPresentation/v4 admissions. */
|
|
489
|
+
readonly presentationJtiAuditDigestHex?: string;
|
|
490
|
+
};
|
|
448
491
|
interface PolicySessionUcanV1 {
|
|
449
492
|
readonly authorization: string;
|
|
450
493
|
readonly cid: string;
|
|
@@ -455,7 +498,7 @@ interface PolicySessionUcanV1 {
|
|
|
455
498
|
readonly nbf: number;
|
|
456
499
|
readonly exp: number;
|
|
457
500
|
readonly nnc: string;
|
|
458
|
-
readonly fact:
|
|
501
|
+
readonly fact: PolicySessionUcanFactV1;
|
|
459
502
|
}
|
|
460
503
|
interface PolicyChallengeV3 {
|
|
461
504
|
readonly challengeId: string;
|
|
@@ -468,10 +511,17 @@ interface PolicyChallengeV3 {
|
|
|
468
511
|
}
|
|
469
512
|
declare function requestPolicyChallengeV3(input: {
|
|
470
513
|
readonly nodeOrigin: string;
|
|
514
|
+
/**
|
|
515
|
+
* Policy control routes are part of the recipient's TinyCloud Node. This is
|
|
516
|
+
* deliberately a path, not a second origin: applications must not send a
|
|
517
|
+
* credential presentation to a separately discovered policy service.
|
|
518
|
+
*/
|
|
519
|
+
readonly policyRuntimePath?: string;
|
|
471
520
|
readonly policyCid: string;
|
|
472
521
|
readonly recipientDid: string;
|
|
473
522
|
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
474
523
|
readonly fetch?: typeof fetch;
|
|
524
|
+
readonly signal?: AbortSignal;
|
|
475
525
|
}): Promise<PolicyChallengeV3>;
|
|
476
526
|
declare function mintPolicySessionV3(input: {
|
|
477
527
|
readonly nodeOrigin: string;
|
|
@@ -485,6 +535,7 @@ declare function mintPolicySessionV3(input: {
|
|
|
485
535
|
readonly presentation: Readonly<Record<string, unknown>>;
|
|
486
536
|
readonly challenge?: PolicyChallengeV3;
|
|
487
537
|
readonly fetch?: typeof fetch;
|
|
538
|
+
readonly signal?: AbortSignal;
|
|
488
539
|
}): Promise<PolicySessionUcanV1>;
|
|
489
540
|
interface PolicyRootStatusV3 {
|
|
490
541
|
readonly rootCid: string;
|
|
@@ -543,6 +594,12 @@ declare function projectUnifiedPolicyCapabilities(input: readonly unknown[]): Un
|
|
|
543
594
|
declare function unifiedNativeProjectionHashHex(input: readonly unknown[]): string;
|
|
544
595
|
declare function unifiedPolicyCapabilityFromNative(input: unknown): UnifiedPolicyCapability;
|
|
545
596
|
declare function contentSourceDigestHex(input: UnifiedContentSource): string;
|
|
597
|
+
/**
|
|
598
|
+
* Register a signed policy and its sibling roots with the embedded Node
|
|
599
|
+
* Policy/v3 runtime. This is intentionally application-neutral: callers
|
|
600
|
+
* supply policy material, while Node owns both transport endpoints.
|
|
601
|
+
*/
|
|
602
|
+
declare function registerPolicyV3(input: RegisterPolicyV3Input): Promise<RegisterPolicyV3Receipt>;
|
|
546
603
|
declare function policyDigestHex(policy: Omit<UnifiedPolicyV1, "policyId" | "signature">): string;
|
|
547
604
|
declare function policyIdForDigestHex(digestHex: string): string;
|
|
548
605
|
declare function policyCidFromCanonicalBytes(bytes: Uint8Array): string;
|
|
@@ -682,6 +739,8 @@ declare const POLICY_V2_DOMAIN = "xyz.tinycloud.policy/policy/v2\0";
|
|
|
682
739
|
declare const POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE: "TinyCloudPolicyCredentialRequirement";
|
|
683
740
|
declare const POLICY_PRESENTATION_V3_SCHEMA: "xyz.tinycloud.policy/presentation/v3";
|
|
684
741
|
declare const POLICY_PRESENTATION_V3_DOMAIN = "xyz.tinycloud.policy/Presentation/v3\0";
|
|
742
|
+
declare const POLICY_PRESENTATION_V4_SCHEMA: "xyz.tinycloud.policy/presentation/v4";
|
|
743
|
+
declare const POLICY_PRESENTATION_V4_DOMAIN = "xyz.tinycloud.policy/Presentation/v4\0";
|
|
685
744
|
interface PolicyCredentialRequirementV1 {
|
|
686
745
|
readonly type: typeof POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE;
|
|
687
746
|
readonly version: 1;
|
|
@@ -736,6 +795,29 @@ interface PolicyCredentialPresentationV3 {
|
|
|
736
795
|
readonly value: string;
|
|
737
796
|
};
|
|
738
797
|
}
|
|
798
|
+
interface UnsignedPolicyCredentialPresentationV4 {
|
|
799
|
+
readonly schema: typeof POLICY_PRESENTATION_V4_SCHEMA;
|
|
800
|
+
readonly jti: string;
|
|
801
|
+
readonly challengeId: string;
|
|
802
|
+
readonly nonce: string;
|
|
803
|
+
readonly policyCid: string;
|
|
804
|
+
readonly nodeAudience: string;
|
|
805
|
+
readonly holderDid: string;
|
|
806
|
+
readonly subjectDid: string;
|
|
807
|
+
readonly credentialDigest: string;
|
|
808
|
+
readonly requirementDigest: string;
|
|
809
|
+
readonly descriptorDigest: string;
|
|
810
|
+
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
811
|
+
readonly issuedAt: string;
|
|
812
|
+
readonly expiresAt: string;
|
|
813
|
+
}
|
|
814
|
+
interface PolicyCredentialPresentationV4 extends UnsignedPolicyCredentialPresentationV4 {
|
|
815
|
+
readonly signature: {
|
|
816
|
+
readonly suite: "Ed25519";
|
|
817
|
+
readonly signerDid: string;
|
|
818
|
+
readonly value: string;
|
|
819
|
+
};
|
|
820
|
+
}
|
|
739
821
|
declare function validatePolicyCredentialRequirementV1(value: unknown): PolicyCredentialRequirementV1;
|
|
740
822
|
declare function policyV2DigestHex(input: UnsignedUnifiedPolicyV2): string;
|
|
741
823
|
/**
|
|
@@ -744,6 +826,21 @@ declare function policyV2DigestHex(input: UnsignedUnifiedPolicyV2): string;
|
|
|
744
826
|
* Node remains the authoritative signature verifier at admission.
|
|
745
827
|
*/
|
|
746
828
|
declare function validateUnifiedPolicyV2(value: unknown, expectedPolicyCid?: string): UnifiedPolicyV2;
|
|
829
|
+
declare function issuedCredentialEnvelopeFromVerified(verified: VerifiedCredential): IssuedCredentialEnvelope;
|
|
830
|
+
/** Sign the exact accountless v4 wire value. No account custody fields exist. */
|
|
831
|
+
declare function signPolicyCredentialPresentationV4(value: UnsignedPolicyCredentialPresentationV4, sign: (digest: Uint8Array) => Promise<Uint8Array>): Promise<PolicyCredentialPresentationV4>;
|
|
832
|
+
interface BuildPolicyCredentialPresentationV4Input {
|
|
833
|
+
readonly policy: UnifiedPolicyV2;
|
|
834
|
+
readonly policyCid: string;
|
|
835
|
+
readonly challenge: PolicyChallengeV3;
|
|
836
|
+
readonly requirement: CredentialRequirement;
|
|
837
|
+
readonly credential: VerifiedCredential;
|
|
838
|
+
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
839
|
+
readonly sign: (digest: Uint8Array) => Promise<Uint8Array>;
|
|
840
|
+
readonly now?: Date;
|
|
841
|
+
readonly jti?: string;
|
|
842
|
+
}
|
|
843
|
+
declare function buildPolicyCredentialPresentationV4(input: BuildPolicyCredentialPresentationV4Input): Promise<PolicyCredentialPresentationV4>;
|
|
747
844
|
interface BuildPolicyCredentialPresentationV3Input {
|
|
748
845
|
readonly policy: UnifiedPolicyV2;
|
|
749
846
|
readonly policyCid: string;
|
|
@@ -761,11 +858,14 @@ interface AdmitPolicyCredentialV3Input extends Omit<BuildPolicyCredentialPresent
|
|
|
761
858
|
readonly policyRootCid: string;
|
|
762
859
|
readonly enforcementRootCid: string;
|
|
763
860
|
readonly nodeOrigin: string;
|
|
861
|
+
/** Path to the embedded Node policy runtime. Defaults to `/policy/v3`. */
|
|
862
|
+
readonly policyRuntimePath?: string;
|
|
764
863
|
/** Root authorization CID of the recipient's active TinyCloud account session. */
|
|
765
864
|
readonly accountAuthorizationCid: string;
|
|
766
865
|
/** Recipient-owned `credentials` space covered by the account authorization. */
|
|
767
866
|
readonly credentialSpaceId: string;
|
|
768
867
|
readonly fetch?: typeof fetch;
|
|
868
|
+
readonly signal?: AbortSignal;
|
|
769
869
|
}
|
|
770
870
|
interface PolicyCredentialAdmissionV3 {
|
|
771
871
|
readonly challenge: PolicyChallengeV3;
|
|
@@ -777,5 +877,25 @@ interface PolicyCredentialAdmissionV3 {
|
|
|
777
877
|
* Raw credential material appears only in the TLS POST body.
|
|
778
878
|
*/
|
|
779
879
|
declare function admitPolicyCredentialV3(input: AdmitPolicyCredentialV3Input): Promise<PolicyCredentialAdmissionV3>;
|
|
880
|
+
interface AdmitPolicyCredentialV4Input extends Omit<BuildPolicyCredentialPresentationV4Input, "challenge"> {
|
|
881
|
+
readonly policyRootCid: string;
|
|
882
|
+
readonly enforcementRootCid: string;
|
|
883
|
+
readonly expectedNodeAudience: string;
|
|
884
|
+
readonly expectedEnforcerDid: string;
|
|
885
|
+
readonly nodeOrigin: string;
|
|
886
|
+
/** Path to the embedded Node policy runtime. Defaults to `/policy/v3`. */
|
|
887
|
+
readonly policyRuntimePath?: string;
|
|
888
|
+
readonly fetch?: typeof fetch;
|
|
889
|
+
readonly signal?: AbortSignal;
|
|
890
|
+
}
|
|
891
|
+
interface PolicyCredentialAdmissionV4 {
|
|
892
|
+
readonly challenge: PolicyChallengeV3;
|
|
893
|
+
readonly presentation: PolicyCredentialPresentationV4;
|
|
894
|
+
readonly session: PolicySessionUcanV1;
|
|
895
|
+
/** The ordinary delegation has been activated using Node's generic `/delegate`. */
|
|
896
|
+
readonly delegationImported: true;
|
|
897
|
+
}
|
|
898
|
+
/** Accountless admission. The request deliberately has no account custody fields. */
|
|
899
|
+
declare function admitPolicyCredentialV4(input: AdmitPolicyCredentialV4Input): Promise<PolicyCredentialAdmissionV4>;
|
|
780
900
|
|
|
781
|
-
export { type
|
|
901
|
+
export { type RegisterPolicyV3Receipt as $, ATTESTED_ENFORCER_BINDING_V2_SCHEMA as A, type BuildPolicyCredentialPresentationV3Input as B, CONTENT_SOURCE_V1_DOMAIN as C, type PolicyCredentialAdmissionV3 as D, ED25519_JCS_SIGNATURE_SUITE as E, type PolicyCredentialAdmissionV4 as F, type PolicyCredentialPresentationV3 as G, type PolicyCredentialPresentationV4 as H, type PolicyCredentialRequirementV1 as I, type JsonObject as J, type PolicyRootStatusV3 as K, LAST_V2_CREATE_AT as L, MAX_LEGACY_ENVELOPE_EXPIRES_AT as M, NATIVE_PROJECTION_V1_DOMAIN as N, type PolicyRootV3 as O, type PolicyEngineRecord as P, type PolicySessionUcanFactV1 as Q, type PolicySessionUcanV1 as R, type SignedObjectSigner as S, type PolicyStatus as T, type UnsignedPolicyEngineRecord as U, ROOT_REVOCATION_V1_DOMAIN as V, ROOT_REVOCATION_V1_SCHEMA as W, ROOT_STATUS_CHECKPOINT_V1_SCHEMA as X, ROOT_STATUS_RENEWAL_V1_DOMAIN as Y, ROOT_STATUS_V1_DOMAIN as Z, type RegisterPolicyV3Input as _, type Policy as a, signCompactUcanRootAuthorization as a$, type SignCompactUcanAuthorizationInput as a0, type SignCompactUcanRootAuthorizationInput as a1, SignatureMaterialError as a2, type SignatureSuite as a3, SignatureVerificationError as a4, SignedObjectCanonicalizationError as a5, SignedObjectDigestError as a6, type SignedObjectErrorCode as a7, SignedObjectIdError as a8, type SignedObjectKind as a9, canonicalizeUnifiedPolicyCapability as aA, compactAttenuationContains as aB, contentSourceDigestHex as aC, createAndSignPolicy as aD, createAndSignPolicyEngineRecord as aE, createAndSignPolicyStatus as aF, createAndSignSignedObject as aG, createCompactPolicyDescendant as aH, createCompactPolicyInvocation as aI, deriveSignedObjectMaterial as aJ, getPolicyRootStatusV3 as aK, issuedCredentialEnvelopeFromVerified as aL, mintPolicySessionV3 as aM, normalizeUnifiedPolicyCapability as aN, parseCompactUcanAuthorization as aO, parsePolicySessionUcan as aP, policyCidFromCanonicalBytes as aQ, policyDigestHex as aR, policyIdForDigestHex as aS, policyV2DigestHex as aT, projectUnifiedPolicyCapabilities as aU, projectUnifiedPolicyCapability as aV, registerPolicyV3 as aW, renewPolicyRootStatusV3 as aX, requestPolicyChallengeV3 as aY, revokePolicyRootV3 as aZ, signCompactUcanAuthorization as a_, type SignedObjectMaterial as aa, SignedObjectProfileError as ab, SignedObjectSchemaError as ac, type SignedObjectSignature as ad, type SignedObjectVerificationResult as ae, type SignedPolicyObject as af, SigningKeyBindingError as ag, type UnifiedContentSource as ah, type UnifiedEncryptionCapability as ai, type UnifiedKvCapability as aj, type UnifiedNativeCapability as ak, type UnifiedPolicyCapability as al, type UnifiedPolicyV1 as am, type UnifiedPolicyV2 as an, type UnifiedResourceSelector as ao, type UnsignedPolicy as ap, type UnsignedPolicyCredentialPresentationV4 as aq, type UnsignedPolicyObject as ar, type UnsignedPolicyStatus as as, type UnsignedUnifiedPolicyV2 as at, UnsupportedSignatureSuiteError as au, admitPolicyCredentialV3 as av, admitPolicyCredentialV4 as aw, buildPolicyCredentialPresentationV3 as ax, buildPolicyCredentialPresentationV4 as ay, canonicalizeSignedObjectUnsigned as az, type AdmitPolicyCredentialV3Input as b, signPolicyCredentialPresentationV4 as b0, signedObjectIdFor as b1, toSignedObjectError as b2, unifiedNativeProjectionHashHex as b3, unifiedPolicyCapabilityContains as b4, unifiedPolicyCapabilityDigestHex as b5, unifiedPolicyCapabilityFromNative as b6, validatePolicyCredentialRequirementV1 as b7, validatePolicyEngineRecordSigned as b8, validatePolicyEngineRecordSignedShape as b9, type CredentialClaimDescriptor as bA, type CredentialEndpointId as bB, type CredentialInputDescriptor as bC, type CredentialProgressEvent as bD, type CredentialStepDescriptor as bE, type CredentialStepType as bF, type CredentialUxState as bG, HOLDER_BINDING_DOMAIN as bH, type IssuerVerificationKey as bI, validatePolicyEngineRecordUnsigned as ba, validatePolicySigned as bb, validatePolicySignedShape as bc, validatePolicyStatusSigned as bd, validatePolicyStatusSignedShape as be, validatePolicyStatusUnsigned as bf, validatePolicyUnsigned as bg, validateUnifiedPolicyV2 as bh, verifyPolicy as bi, verifyPolicyEngineRecord as bj, verifyPolicyRootRevocationV3 as bk, verifyPolicyRootStatusCheckpointV3 as bl, verifyPolicyStatus as bm, verifySignedObject as bn, type CredentialHolderBinding as bo, type CredentialFlowDescriptor as bp, type CredentialRequirement as bq, type StoredCredentialRecord as br, type VerifiedCredential as bs, type CredentialStorageReceipt as bt, type IssuedCredentialEnvelope as bu, type CredentialIssuerMetadata as bv, CREDENTIAL_ACQUISITION_PROTOCOL as bw, CREDENTIAL_CONTRACT_VERSION as bx, CREDENTIAL_FORMAT as by, CREDENTIAL_STEP_REGISTRY_VERSION as bz, type AdmitPolicyCredentialV4Input as c, type AttestedEnforcerBindingV2 as d, type BuildPolicyCredentialPresentationV4Input as e, type CompactPolicyInvocationInput as f, type CompactUcanAuthorizationV1 as g, EIP191_JCS_SIGNATURE_SUITE as h, LAST_V2_READ_AT as i, POLICY_CAPABILITY_V1_DOMAIN as j, POLICY_CAPABILITY_V1_SCHEMA as k, POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE as l, POLICY_ENFORCEMENT_DELEGATION_V2_SCHEMA as m, POLICY_ENGINE_RECORD_SCHEMA as n, POLICY_PRESENTATION_V3_DOMAIN as o, POLICY_PRESENTATION_V3_SCHEMA as p, POLICY_PRESENTATION_V4_DOMAIN as q, POLICY_PRESENTATION_V4_SCHEMA as r, POLICY_SCHEMA as s, POLICY_SESSION_UCAN_V1_PROFILE as t, POLICY_STATUS_SCHEMA as u, POLICY_V1_DOMAIN as v, POLICY_V1_SCHEMA as w, POLICY_V2_DOMAIN as x, POLICY_V2_SCHEMA as y, type PolicyChallengeV3 as z };
|