@tinycloud/sdk-core 3.0.0-beta.18 → 3.0.0-beta.19

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.
@@ -718,17 +718,28 @@ interface CompactPolicyInvocationInput {
718
718
  }
719
719
  /** Sign a fresh one-parent ordinary invocation; S0 itself is never a bearer. */
720
720
  declare function createCompactPolicyInvocation(input: CompactPolicyInvocationInput): CompactUcanAuthorizationV1;
721
- declare function createCompactPolicyDescendant(input: {
721
+ interface CompactPolicyDescendantInput {
722
722
  readonly parentAuthorization: string;
723
723
  readonly parentCid: string;
724
724
  readonly issuerDid: string;
725
725
  readonly audienceDid: string;
726
726
  readonly attenuation: Readonly<Record<string, Readonly<Record<string, readonly unknown[]>>>>;
727
- readonly privateKey: Uint8Array;
727
+ /** Start of the window; defaults to one second after the parent's start. */
728
728
  readonly now?: number;
729
+ /** Defaults to the longest window the parent allows: one second inside it. */
729
730
  readonly expiresAt?: number;
730
731
  readonly nonce?: string;
732
+ }
733
+ declare function createCompactPolicyDescendant(input: CompactPolicyDescendantInput & {
734
+ readonly privateKey: Uint8Array;
731
735
  }): CompactUcanAuthorizationV1;
736
+ /**
737
+ * The same descendant, signed by a caller-owned key that may be
738
+ * non-extractable. The result is verified against the issuer DID.
739
+ */
740
+ declare function signCompactPolicyDescendant(input: CompactPolicyDescendantInput & {
741
+ readonly sign: (bytes: Uint8Array) => Promise<Uint8Array>;
742
+ }): Promise<CompactUcanAuthorizationV1>;
732
743
  /** Byte-independent semantic containment shared by S0, descendants and mint requests. */
733
744
  declare function compactAttenuationContains(parent: Readonly<Record<string, Readonly<Record<string, readonly unknown[]>>>>, child: Readonly<Record<string, Readonly<Record<string, readonly unknown[]>>>>): boolean;
734
745
  declare function parseCompactUcanAuthorization(input: string, expectedCid?: string): CompactUcanAuthorizationV1;
@@ -864,6 +875,8 @@ interface AdmitPolicyCredentialV3Input extends Omit<BuildPolicyCredentialPresent
864
875
  readonly accountAuthorizationCid: string;
865
876
  /** Recipient-owned `credentials` space covered by the account authorization. */
866
877
  readonly credentialSpaceId: string;
878
+ /** See {@link AdmitPolicyCredentialV4Input.requestedExpiresAt}. */
879
+ readonly requestedExpiresAt?: string | null;
867
880
  readonly fetch?: typeof fetch;
868
881
  readonly signal?: AbortSignal;
869
882
  }
@@ -885,6 +898,13 @@ interface AdmitPolicyCredentialV4Input extends Omit<BuildPolicyCredentialPresent
885
898
  readonly nodeOrigin: string;
886
899
  /** Path to the embedded Node policy runtime. Defaults to `/policy/v3`. */
887
900
  readonly policyRuntimePath?: string;
901
+ /**
902
+ * How long the minted session should last. Defaults to the policy's own
903
+ * expiry, the longest the Node will grant; it caps the session at the
904
+ * policy, its roots and any account authorization. `null` asks for the
905
+ * legacy 60-second session.
906
+ */
907
+ readonly requestedExpiresAt?: string | null;
888
908
  readonly fetch?: typeof fetch;
889
909
  readonly signal?: AbortSignal;
890
910
  }
@@ -898,4 +918,4 @@ interface PolicyCredentialAdmissionV4 {
898
918
  /** Accountless admission. The request deliberately has no account custody fields. */
899
919
  declare function admitPolicyCredentialV4(input: AdmitPolicyCredentialV4Input): Promise<PolicyCredentialAdmissionV4>;
900
920
 
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 };
921
+ export { type RegisterPolicyV3Input as $, ATTESTED_ENFORCER_BINDING_V2_SCHEMA as A, type BuildPolicyCredentialPresentationV3Input as B, CONTENT_SOURCE_V1_DOMAIN as C, type PolicyChallengeV3 as D, ED25519_JCS_SIGNATURE_SUITE as E, type PolicyCredentialAdmissionV3 as F, type PolicyCredentialAdmissionV4 as G, type PolicyCredentialPresentationV3 as H, type PolicyCredentialPresentationV4 as I, type JsonObject as J, type PolicyCredentialRequirementV1 as K, LAST_V2_CREATE_AT as L, MAX_LEGACY_ENVELOPE_EXPIRES_AT as M, NATIVE_PROJECTION_V1_DOMAIN as N, type PolicyRootStatusV3 as O, type PolicyEngineRecord as P, type PolicyRootV3 as Q, type PolicySessionUcanFactV1 as R, type SignedObjectSigner as S, type PolicySessionUcanV1 as T, type UnsignedPolicyEngineRecord as U, type PolicyStatus as V, ROOT_REVOCATION_V1_DOMAIN as W, ROOT_REVOCATION_V1_SCHEMA as X, ROOT_STATUS_CHECKPOINT_V1_SCHEMA as Y, ROOT_STATUS_RENEWAL_V1_DOMAIN as Z, ROOT_STATUS_V1_DOMAIN as _, type Policy as a, signCompactPolicyDescendant as a$, type RegisterPolicyV3Receipt as a0, type SignCompactUcanAuthorizationInput as a1, type SignCompactUcanRootAuthorizationInput as a2, SignatureMaterialError as a3, type SignatureSuite as a4, SignatureVerificationError as a5, SignedObjectCanonicalizationError as a6, SignedObjectDigestError as a7, type SignedObjectErrorCode as a8, SignedObjectIdError as a9, canonicalizeSignedObjectUnsigned as aA, canonicalizeUnifiedPolicyCapability as aB, compactAttenuationContains as aC, contentSourceDigestHex as aD, createAndSignPolicy as aE, createAndSignPolicyEngineRecord as aF, createAndSignPolicyStatus as aG, createAndSignSignedObject as aH, createCompactPolicyDescendant as aI, createCompactPolicyInvocation as aJ, deriveSignedObjectMaterial as aK, getPolicyRootStatusV3 as aL, issuedCredentialEnvelopeFromVerified as aM, mintPolicySessionV3 as aN, normalizeUnifiedPolicyCapability as aO, parseCompactUcanAuthorization as aP, parsePolicySessionUcan as aQ, policyCidFromCanonicalBytes as aR, policyDigestHex as aS, policyIdForDigestHex as aT, policyV2DigestHex as aU, projectUnifiedPolicyCapabilities as aV, projectUnifiedPolicyCapability as aW, registerPolicyV3 as aX, renewPolicyRootStatusV3 as aY, requestPolicyChallengeV3 as aZ, revokePolicyRootV3 as a_, type SignedObjectKind as aa, type SignedObjectMaterial as ab, SignedObjectProfileError as ac, SignedObjectSchemaError as ad, type SignedObjectSignature as ae, type SignedObjectVerificationResult as af, type SignedPolicyObject as ag, SigningKeyBindingError as ah, type UnifiedContentSource as ai, type UnifiedEncryptionCapability as aj, type UnifiedKvCapability as ak, type UnifiedNativeCapability as al, type UnifiedPolicyCapability as am, type UnifiedPolicyV1 as an, type UnifiedPolicyV2 as ao, type UnifiedResourceSelector as ap, type UnsignedPolicy as aq, type UnsignedPolicyCredentialPresentationV4 as ar, type UnsignedPolicyObject as as, type UnsignedPolicyStatus as at, type UnsignedUnifiedPolicyV2 as au, UnsupportedSignatureSuiteError as av, admitPolicyCredentialV3 as aw, admitPolicyCredentialV4 as ax, buildPolicyCredentialPresentationV3 as ay, buildPolicyCredentialPresentationV4 as az, type AdmitPolicyCredentialV3Input as b, signCompactUcanAuthorization as b0, signCompactUcanRootAuthorization as b1, signPolicyCredentialPresentationV4 as b2, signedObjectIdFor as b3, toSignedObjectError as b4, unifiedNativeProjectionHashHex as b5, unifiedPolicyCapabilityContains as b6, unifiedPolicyCapabilityDigestHex as b7, unifiedPolicyCapabilityFromNative as b8, validatePolicyCredentialRequirementV1 as b9, CREDENTIAL_FORMAT as bA, CREDENTIAL_STEP_REGISTRY_VERSION as bB, type CredentialClaimDescriptor as bC, type CredentialEndpointId as bD, type CredentialInputDescriptor as bE, type CredentialProgressEvent as bF, type CredentialStepDescriptor as bG, type CredentialStepType as bH, type CredentialUxState as bI, HOLDER_BINDING_DOMAIN as bJ, type IssuerVerificationKey as bK, validatePolicyEngineRecordSigned as ba, validatePolicyEngineRecordSignedShape as bb, validatePolicyEngineRecordUnsigned as bc, validatePolicySigned as bd, validatePolicySignedShape as be, validatePolicyStatusSigned as bf, validatePolicyStatusSignedShape as bg, validatePolicyStatusUnsigned as bh, validatePolicyUnsigned as bi, validateUnifiedPolicyV2 as bj, verifyPolicy as bk, verifyPolicyEngineRecord as bl, verifyPolicyRootRevocationV3 as bm, verifyPolicyRootStatusCheckpointV3 as bn, verifyPolicyStatus as bo, verifySignedObject as bp, type CredentialHolderBinding as bq, type CredentialFlowDescriptor as br, type CredentialRequirement as bs, type StoredCredentialRecord as bt, type VerifiedCredential as bu, type CredentialStorageReceipt as bv, type IssuedCredentialEnvelope as bw, type CredentialIssuerMetadata as bx, CREDENTIAL_ACQUISITION_PROTOCOL as by, CREDENTIAL_CONTRACT_VERSION as bz, type AdmitPolicyCredentialV4Input as c, type AttestedEnforcerBindingV2 as d, type BuildPolicyCredentialPresentationV4Input as e, type CompactPolicyDescendantInput as f, type CompactPolicyInvocationInput as g, type CompactUcanAuthorizationV1 as h, EIP191_JCS_SIGNATURE_SUITE as i, LAST_V2_READ_AT as j, POLICY_CAPABILITY_V1_DOMAIN as k, POLICY_CAPABILITY_V1_SCHEMA as l, POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE as m, POLICY_ENFORCEMENT_DELEGATION_V2_SCHEMA as n, POLICY_ENGINE_RECORD_SCHEMA as o, POLICY_PRESENTATION_V3_DOMAIN as p, POLICY_PRESENTATION_V3_SCHEMA as q, POLICY_PRESENTATION_V4_DOMAIN as r, POLICY_PRESENTATION_V4_SCHEMA as s, POLICY_SCHEMA as t, POLICY_SESSION_UCAN_V1_PROFILE as u, POLICY_STATUS_SCHEMA as v, POLICY_V1_DOMAIN as w, POLICY_V1_SCHEMA as x, POLICY_V2_DOMAIN as y, POLICY_V2_SCHEMA as z };
@@ -718,17 +718,28 @@ interface CompactPolicyInvocationInput {
718
718
  }
719
719
  /** Sign a fresh one-parent ordinary invocation; S0 itself is never a bearer. */
720
720
  declare function createCompactPolicyInvocation(input: CompactPolicyInvocationInput): CompactUcanAuthorizationV1;
721
- declare function createCompactPolicyDescendant(input: {
721
+ interface CompactPolicyDescendantInput {
722
722
  readonly parentAuthorization: string;
723
723
  readonly parentCid: string;
724
724
  readonly issuerDid: string;
725
725
  readonly audienceDid: string;
726
726
  readonly attenuation: Readonly<Record<string, Readonly<Record<string, readonly unknown[]>>>>;
727
- readonly privateKey: Uint8Array;
727
+ /** Start of the window; defaults to one second after the parent's start. */
728
728
  readonly now?: number;
729
+ /** Defaults to the longest window the parent allows: one second inside it. */
729
730
  readonly expiresAt?: number;
730
731
  readonly nonce?: string;
732
+ }
733
+ declare function createCompactPolicyDescendant(input: CompactPolicyDescendantInput & {
734
+ readonly privateKey: Uint8Array;
731
735
  }): CompactUcanAuthorizationV1;
736
+ /**
737
+ * The same descendant, signed by a caller-owned key that may be
738
+ * non-extractable. The result is verified against the issuer DID.
739
+ */
740
+ declare function signCompactPolicyDescendant(input: CompactPolicyDescendantInput & {
741
+ readonly sign: (bytes: Uint8Array) => Promise<Uint8Array>;
742
+ }): Promise<CompactUcanAuthorizationV1>;
732
743
  /** Byte-independent semantic containment shared by S0, descendants and mint requests. */
733
744
  declare function compactAttenuationContains(parent: Readonly<Record<string, Readonly<Record<string, readonly unknown[]>>>>, child: Readonly<Record<string, Readonly<Record<string, readonly unknown[]>>>>): boolean;
734
745
  declare function parseCompactUcanAuthorization(input: string, expectedCid?: string): CompactUcanAuthorizationV1;
@@ -864,6 +875,8 @@ interface AdmitPolicyCredentialV3Input extends Omit<BuildPolicyCredentialPresent
864
875
  readonly accountAuthorizationCid: string;
865
876
  /** Recipient-owned `credentials` space covered by the account authorization. */
866
877
  readonly credentialSpaceId: string;
878
+ /** See {@link AdmitPolicyCredentialV4Input.requestedExpiresAt}. */
879
+ readonly requestedExpiresAt?: string | null;
867
880
  readonly fetch?: typeof fetch;
868
881
  readonly signal?: AbortSignal;
869
882
  }
@@ -885,6 +898,13 @@ interface AdmitPolicyCredentialV4Input extends Omit<BuildPolicyCredentialPresent
885
898
  readonly nodeOrigin: string;
886
899
  /** Path to the embedded Node policy runtime. Defaults to `/policy/v3`. */
887
900
  readonly policyRuntimePath?: string;
901
+ /**
902
+ * How long the minted session should last. Defaults to the policy's own
903
+ * expiry, the longest the Node will grant; it caps the session at the
904
+ * policy, its roots and any account authorization. `null` asks for the
905
+ * legacy 60-second session.
906
+ */
907
+ readonly requestedExpiresAt?: string | null;
888
908
  readonly fetch?: typeof fetch;
889
909
  readonly signal?: AbortSignal;
890
910
  }
@@ -898,4 +918,4 @@ interface PolicyCredentialAdmissionV4 {
898
918
  /** Accountless admission. The request deliberately has no account custody fields. */
899
919
  declare function admitPolicyCredentialV4(input: AdmitPolicyCredentialV4Input): Promise<PolicyCredentialAdmissionV4>;
900
920
 
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 };
921
+ export { type RegisterPolicyV3Input as $, ATTESTED_ENFORCER_BINDING_V2_SCHEMA as A, type BuildPolicyCredentialPresentationV3Input as B, CONTENT_SOURCE_V1_DOMAIN as C, type PolicyChallengeV3 as D, ED25519_JCS_SIGNATURE_SUITE as E, type PolicyCredentialAdmissionV3 as F, type PolicyCredentialAdmissionV4 as G, type PolicyCredentialPresentationV3 as H, type PolicyCredentialPresentationV4 as I, type JsonObject as J, type PolicyCredentialRequirementV1 as K, LAST_V2_CREATE_AT as L, MAX_LEGACY_ENVELOPE_EXPIRES_AT as M, NATIVE_PROJECTION_V1_DOMAIN as N, type PolicyRootStatusV3 as O, type PolicyEngineRecord as P, type PolicyRootV3 as Q, type PolicySessionUcanFactV1 as R, type SignedObjectSigner as S, type PolicySessionUcanV1 as T, type UnsignedPolicyEngineRecord as U, type PolicyStatus as V, ROOT_REVOCATION_V1_DOMAIN as W, ROOT_REVOCATION_V1_SCHEMA as X, ROOT_STATUS_CHECKPOINT_V1_SCHEMA as Y, ROOT_STATUS_RENEWAL_V1_DOMAIN as Z, ROOT_STATUS_V1_DOMAIN as _, type Policy as a, signCompactPolicyDescendant as a$, type RegisterPolicyV3Receipt as a0, type SignCompactUcanAuthorizationInput as a1, type SignCompactUcanRootAuthorizationInput as a2, SignatureMaterialError as a3, type SignatureSuite as a4, SignatureVerificationError as a5, SignedObjectCanonicalizationError as a6, SignedObjectDigestError as a7, type SignedObjectErrorCode as a8, SignedObjectIdError as a9, canonicalizeSignedObjectUnsigned as aA, canonicalizeUnifiedPolicyCapability as aB, compactAttenuationContains as aC, contentSourceDigestHex as aD, createAndSignPolicy as aE, createAndSignPolicyEngineRecord as aF, createAndSignPolicyStatus as aG, createAndSignSignedObject as aH, createCompactPolicyDescendant as aI, createCompactPolicyInvocation as aJ, deriveSignedObjectMaterial as aK, getPolicyRootStatusV3 as aL, issuedCredentialEnvelopeFromVerified as aM, mintPolicySessionV3 as aN, normalizeUnifiedPolicyCapability as aO, parseCompactUcanAuthorization as aP, parsePolicySessionUcan as aQ, policyCidFromCanonicalBytes as aR, policyDigestHex as aS, policyIdForDigestHex as aT, policyV2DigestHex as aU, projectUnifiedPolicyCapabilities as aV, projectUnifiedPolicyCapability as aW, registerPolicyV3 as aX, renewPolicyRootStatusV3 as aY, requestPolicyChallengeV3 as aZ, revokePolicyRootV3 as a_, type SignedObjectKind as aa, type SignedObjectMaterial as ab, SignedObjectProfileError as ac, SignedObjectSchemaError as ad, type SignedObjectSignature as ae, type SignedObjectVerificationResult as af, type SignedPolicyObject as ag, SigningKeyBindingError as ah, type UnifiedContentSource as ai, type UnifiedEncryptionCapability as aj, type UnifiedKvCapability as ak, type UnifiedNativeCapability as al, type UnifiedPolicyCapability as am, type UnifiedPolicyV1 as an, type UnifiedPolicyV2 as ao, type UnifiedResourceSelector as ap, type UnsignedPolicy as aq, type UnsignedPolicyCredentialPresentationV4 as ar, type UnsignedPolicyObject as as, type UnsignedPolicyStatus as at, type UnsignedUnifiedPolicyV2 as au, UnsupportedSignatureSuiteError as av, admitPolicyCredentialV3 as aw, admitPolicyCredentialV4 as ax, buildPolicyCredentialPresentationV3 as ay, buildPolicyCredentialPresentationV4 as az, type AdmitPolicyCredentialV3Input as b, signCompactUcanAuthorization as b0, signCompactUcanRootAuthorization as b1, signPolicyCredentialPresentationV4 as b2, signedObjectIdFor as b3, toSignedObjectError as b4, unifiedNativeProjectionHashHex as b5, unifiedPolicyCapabilityContains as b6, unifiedPolicyCapabilityDigestHex as b7, unifiedPolicyCapabilityFromNative as b8, validatePolicyCredentialRequirementV1 as b9, CREDENTIAL_FORMAT as bA, CREDENTIAL_STEP_REGISTRY_VERSION as bB, type CredentialClaimDescriptor as bC, type CredentialEndpointId as bD, type CredentialInputDescriptor as bE, type CredentialProgressEvent as bF, type CredentialStepDescriptor as bG, type CredentialStepType as bH, type CredentialUxState as bI, HOLDER_BINDING_DOMAIN as bJ, type IssuerVerificationKey as bK, validatePolicyEngineRecordSigned as ba, validatePolicyEngineRecordSignedShape as bb, validatePolicyEngineRecordUnsigned as bc, validatePolicySigned as bd, validatePolicySignedShape as be, validatePolicyStatusSigned as bf, validatePolicyStatusSignedShape as bg, validatePolicyStatusUnsigned as bh, validatePolicyUnsigned as bi, validateUnifiedPolicyV2 as bj, verifyPolicy as bk, verifyPolicyEngineRecord as bl, verifyPolicyRootRevocationV3 as bm, verifyPolicyRootStatusCheckpointV3 as bn, verifyPolicyStatus as bo, verifySignedObject as bp, type CredentialHolderBinding as bq, type CredentialFlowDescriptor as br, type CredentialRequirement as bs, type StoredCredentialRecord as bt, type VerifiedCredential as bu, type CredentialStorageReceipt as bv, type IssuedCredentialEnvelope as bw, type CredentialIssuerMetadata as bx, CREDENTIAL_ACQUISITION_PROTOCOL as by, CREDENTIAL_CONTRACT_VERSION as bz, type AdmitPolicyCredentialV4Input as c, type AttestedEnforcerBindingV2 as d, type BuildPolicyCredentialPresentationV4Input as e, type CompactPolicyDescendantInput as f, type CompactPolicyInvocationInput as g, type CompactUcanAuthorizationV1 as h, EIP191_JCS_SIGNATURE_SUITE as i, LAST_V2_READ_AT as j, POLICY_CAPABILITY_V1_DOMAIN as k, POLICY_CAPABILITY_V1_SCHEMA as l, POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE as m, POLICY_ENFORCEMENT_DELEGATION_V2_SCHEMA as n, POLICY_ENGINE_RECORD_SCHEMA as o, POLICY_PRESENTATION_V3_DOMAIN as p, POLICY_PRESENTATION_V3_SCHEMA as q, POLICY_PRESENTATION_V4_DOMAIN as r, POLICY_PRESENTATION_V4_SCHEMA as s, POLICY_SCHEMA as t, POLICY_SESSION_UCAN_V1_PROFILE as u, POLICY_STATUS_SCHEMA as v, POLICY_V1_DOMAIN as w, POLICY_V1_SCHEMA as x, POLICY_V2_DOMAIN as y, POLICY_V2_SCHEMA as z };
@@ -4005,6 +4005,7 @@ var CompactPayloadSchema = import_zod4.z.object({
4005
4005
  nnc: import_zod4.z.string().min(1),
4006
4006
  prf: import_zod4.z.array(import_zod4.z.string().min(1))
4007
4007
  }).strict();
4008
+ var MAX_POLICY_ROOT_SECONDS = 31 * 24 * 60 * 60;
4008
4009
  function createCompactPolicyInvocation(input) {
4009
4010
  const session = parsePolicySessionUcan(input.sessionAuthorization);
4010
4011
  if (session.cid !== input.sessionCid || session.aud !== input.recipientDid)
@@ -4036,7 +4037,7 @@ function createCompactPolicyInvocation(input) {
4036
4037
  const signature = import_ed255192.ed25519.sign(signingInput, input.privateKey);
4037
4038
  return parseCompactUcanAuthorization(`${protectedSegment}.${payloadSegment}.${encodeBase64Url(signature)}`);
4038
4039
  }
4039
- function createCompactPolicyDescendant(input) {
4040
+ function compactPolicyDescendantClaims(input) {
4040
4041
  const parent = parseCompactUcanAuthorization(input.parentAuthorization, input.parentCid);
4041
4042
  if (parent.payload.aud !== input.issuerDid) throw new Error("policy descendant issuer is not the parent audience");
4042
4043
  const parentFact = parent.payload.fct[0];
@@ -4044,23 +4045,33 @@ function createCompactPolicyDescendant(input) {
4044
4045
  if (!Number.isInteger(depth) || depth <= 0) throw new Error("policy descendant depth is exhausted");
4045
4046
  if (!compactAttenuationContains(parent.payload.att, input.attenuation))
4046
4047
  throw new Error("policy descendant exceeds the parent attenuation");
4048
+ const now = Math.max(input.now ?? parent.payload.nbf + 1, parent.payload.nbf + 1);
4049
+ const exp = Math.min(input.expiresAt ?? parent.payload.exp - 1, parent.payload.exp - 1);
4050
+ if (exp <= now) throw new Error("policy parent has no strictly narrower validity window");
4051
+ return {
4052
+ parentCid: parent.cid,
4053
+ fact: { ...parentFact, remainingRedelegationDepth: depth - 1 },
4054
+ notBefore: now,
4055
+ expiresAt: exp,
4056
+ nonce: input.nonce ?? encodeBase64Url(crypto.getRandomValues(new Uint8Array(16)))
4057
+ };
4058
+ }
4059
+ function createCompactPolicyDescendant(input) {
4060
+ const claims = compactPolicyDescendantClaims(input);
4047
4061
  const principal = input.issuerDid.split("#", 1)[0];
4048
4062
  const didMaterial = base58btc.decode(principal.slice("did:key:".length));
4049
4063
  const publicKey = import_ed255192.ed25519.getPublicKey(input.privateKey);
4050
4064
  if (didMaterial.length !== 34 || !equalBytes2(publicKey, didMaterial.slice(2))) throw new Error("policy descendant signer does not bind issuer DID");
4051
- const now = Math.max(input.now ?? Math.floor(Date.now() / 1e3), parent.payload.nbf + 1);
4052
- const exp = Math.min(input.expiresAt ?? now + 60, now + 60, parent.payload.exp - 1);
4053
- if (exp <= now) throw new Error("policy parent has no strictly narrower validity window");
4054
4065
  const header = { alg: "EdDSA", jwk: { alg: "EdDSA", crv: "Ed25519", kty: "OKP", x: encodeBase64Url(publicKey) }, typ: "JWT", ucv: "0.10.0" };
4055
4066
  const payload = {
4056
4067
  att: input.attenuation,
4057
4068
  aud: input.audienceDid,
4058
- exp,
4059
- fct: [{ ...parentFact, remainingRedelegationDepth: depth - 1 }],
4069
+ exp: claims.expiresAt,
4070
+ fct: [claims.fact],
4060
4071
  iss: input.issuerDid.includes("#") ? input.issuerDid : `${principal}#${principal.slice("did:key:".length)}`,
4061
- nbf: now,
4062
- nnc: input.nonce ?? encodeBase64Url(crypto.getRandomValues(new Uint8Array(16))),
4063
- prf: [parent.cid]
4072
+ nbf: claims.notBefore,
4073
+ nnc: claims.nonce,
4074
+ prf: [claims.parentCid]
4064
4075
  };
4065
4076
  const protectedSegment = encodeBase64Url(new TextEncoder().encode(jcsCanonicalize(header)));
4066
4077
  const payloadSegment = encodeBase64Url(new TextEncoder().encode(jcsCanonicalize(payload)));
@@ -4136,7 +4147,7 @@ function parsePolicySessionUcan(authorization, expectedProofs) {
4136
4147
  throw new Error("policy session UCAN fact is incomplete");
4137
4148
  if (hasV4AuditFactShape && (!LOWER_SHA256_HEX.test(fact.credentialIdAuditDigestHex) || !LOWER_SHA256_HEX.test(fact.presentationJtiAuditDigestHex)))
4138
4149
  throw new Error("policy session UCAN v4 audit facts are invalid");
4139
- if (fact.profile !== POLICY_SESSION_UCAN_V1_PROFILE || typeof fact.remainingRedelegationDepth !== "number" || !Number.isInteger(fact.remainingRedelegationDepth) || fact.remainingRedelegationDepth < 0 || fact.remainingRedelegationDepth > 8 || parsed.payload.exp - parsed.payload.nbf > 60 || parsed.payload.iss.split("#", 1)[0] !== fact.nodeAudience || parsed.payload.aud !== fact.recipientDid)
4150
+ if (fact.profile !== POLICY_SESSION_UCAN_V1_PROFILE || typeof fact.remainingRedelegationDepth !== "number" || !Number.isInteger(fact.remainingRedelegationDepth) || fact.remainingRedelegationDepth < 0 || fact.remainingRedelegationDepth > 8 || parsed.payload.exp - parsed.payload.nbf > MAX_POLICY_ROOT_SECONDS || parsed.payload.iss.split("#", 1)[0] !== fact.nodeAudience || parsed.payload.aud !== fact.recipientDid)
4140
4151
  throw new Error("policy session UCAN fact is invalid");
4141
4152
  return {
4142
4153
  authorization,