@tinycloud/sdk-core 3.0.0-beta.1 → 3.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{credential-admission-C_cO1QqB.d.cts → credential-admission-BVUC6kdw.d.cts} +67 -2
- package/dist/{credential-admission-cvHe-HUC.d.ts → credential-admission-BgvwOTIV.d.ts} +67 -2
- package/dist/delegations/index.cjs +11 -2
- package/dist/delegations/index.cjs.map +1 -1
- package/dist/delegations/index.js +11 -2
- package/dist/delegations/index.js.map +1 -1
- package/dist/index.cjs +178 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +178 -3
- package/dist/index.js.map +1 -1
- package/dist/policy/index.cjs +166 -3
- 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 +166 -3
- package/dist/policy/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -445,6 +445,12 @@ interface UnifiedPolicyV1 {
|
|
|
445
445
|
readonly value: string;
|
|
446
446
|
};
|
|
447
447
|
}
|
|
448
|
+
type PolicySessionUcanFactV1 = Readonly<Record<string, unknown>> & {
|
|
449
|
+
/** Present only on accountless PolicyCredentialPresentation/v4 admissions. */
|
|
450
|
+
readonly credentialIdAuditDigestHex?: string;
|
|
451
|
+
/** Present only on accountless PolicyCredentialPresentation/v4 admissions. */
|
|
452
|
+
readonly presentationJtiAuditDigestHex?: string;
|
|
453
|
+
};
|
|
448
454
|
interface PolicySessionUcanV1 {
|
|
449
455
|
readonly authorization: string;
|
|
450
456
|
readonly cid: string;
|
|
@@ -455,7 +461,7 @@ interface PolicySessionUcanV1 {
|
|
|
455
461
|
readonly nbf: number;
|
|
456
462
|
readonly exp: number;
|
|
457
463
|
readonly nnc: string;
|
|
458
|
-
readonly fact:
|
|
464
|
+
readonly fact: PolicySessionUcanFactV1;
|
|
459
465
|
}
|
|
460
466
|
interface PolicyChallengeV3 {
|
|
461
467
|
readonly challengeId: string;
|
|
@@ -472,6 +478,7 @@ declare function requestPolicyChallengeV3(input: {
|
|
|
472
478
|
readonly recipientDid: string;
|
|
473
479
|
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
474
480
|
readonly fetch?: typeof fetch;
|
|
481
|
+
readonly signal?: AbortSignal;
|
|
475
482
|
}): Promise<PolicyChallengeV3>;
|
|
476
483
|
declare function mintPolicySessionV3(input: {
|
|
477
484
|
readonly nodeOrigin: string;
|
|
@@ -485,6 +492,7 @@ declare function mintPolicySessionV3(input: {
|
|
|
485
492
|
readonly presentation: Readonly<Record<string, unknown>>;
|
|
486
493
|
readonly challenge?: PolicyChallengeV3;
|
|
487
494
|
readonly fetch?: typeof fetch;
|
|
495
|
+
readonly signal?: AbortSignal;
|
|
488
496
|
}): Promise<PolicySessionUcanV1>;
|
|
489
497
|
interface PolicyRootStatusV3 {
|
|
490
498
|
readonly rootCid: string;
|
|
@@ -682,6 +690,8 @@ declare const POLICY_V2_DOMAIN = "xyz.tinycloud.policy/policy/v2\0";
|
|
|
682
690
|
declare const POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE: "TinyCloudPolicyCredentialRequirement";
|
|
683
691
|
declare const POLICY_PRESENTATION_V3_SCHEMA: "xyz.tinycloud.policy/presentation/v3";
|
|
684
692
|
declare const POLICY_PRESENTATION_V3_DOMAIN = "xyz.tinycloud.policy/Presentation/v3\0";
|
|
693
|
+
declare const POLICY_PRESENTATION_V4_SCHEMA: "xyz.tinycloud.policy/presentation/v4";
|
|
694
|
+
declare const POLICY_PRESENTATION_V4_DOMAIN = "xyz.tinycloud.policy/Presentation/v4\0";
|
|
685
695
|
interface PolicyCredentialRequirementV1 {
|
|
686
696
|
readonly type: typeof POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE;
|
|
687
697
|
readonly version: 1;
|
|
@@ -736,6 +746,29 @@ interface PolicyCredentialPresentationV3 {
|
|
|
736
746
|
readonly value: string;
|
|
737
747
|
};
|
|
738
748
|
}
|
|
749
|
+
interface UnsignedPolicyCredentialPresentationV4 {
|
|
750
|
+
readonly schema: typeof POLICY_PRESENTATION_V4_SCHEMA;
|
|
751
|
+
readonly jti: string;
|
|
752
|
+
readonly challengeId: string;
|
|
753
|
+
readonly nonce: string;
|
|
754
|
+
readonly policyCid: string;
|
|
755
|
+
readonly nodeAudience: string;
|
|
756
|
+
readonly holderDid: string;
|
|
757
|
+
readonly subjectDid: string;
|
|
758
|
+
readonly credentialDigest: string;
|
|
759
|
+
readonly requirementDigest: string;
|
|
760
|
+
readonly descriptorDigest: string;
|
|
761
|
+
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
762
|
+
readonly issuedAt: string;
|
|
763
|
+
readonly expiresAt: string;
|
|
764
|
+
}
|
|
765
|
+
interface PolicyCredentialPresentationV4 extends UnsignedPolicyCredentialPresentationV4 {
|
|
766
|
+
readonly signature: {
|
|
767
|
+
readonly suite: "Ed25519";
|
|
768
|
+
readonly signerDid: string;
|
|
769
|
+
readonly value: string;
|
|
770
|
+
};
|
|
771
|
+
}
|
|
739
772
|
declare function validatePolicyCredentialRequirementV1(value: unknown): PolicyCredentialRequirementV1;
|
|
740
773
|
declare function policyV2DigestHex(input: UnsignedUnifiedPolicyV2): string;
|
|
741
774
|
/**
|
|
@@ -744,6 +777,21 @@ declare function policyV2DigestHex(input: UnsignedUnifiedPolicyV2): string;
|
|
|
744
777
|
* Node remains the authoritative signature verifier at admission.
|
|
745
778
|
*/
|
|
746
779
|
declare function validateUnifiedPolicyV2(value: unknown, expectedPolicyCid?: string): UnifiedPolicyV2;
|
|
780
|
+
declare function issuedCredentialEnvelopeFromVerified(verified: VerifiedCredential): IssuedCredentialEnvelope;
|
|
781
|
+
/** Sign the exact accountless v4 wire value. No account custody fields exist. */
|
|
782
|
+
declare function signPolicyCredentialPresentationV4(value: UnsignedPolicyCredentialPresentationV4, sign: (digest: Uint8Array) => Promise<Uint8Array>): Promise<PolicyCredentialPresentationV4>;
|
|
783
|
+
interface BuildPolicyCredentialPresentationV4Input {
|
|
784
|
+
readonly policy: UnifiedPolicyV2;
|
|
785
|
+
readonly policyCid: string;
|
|
786
|
+
readonly challenge: PolicyChallengeV3;
|
|
787
|
+
readonly requirement: CredentialRequirement;
|
|
788
|
+
readonly credential: VerifiedCredential;
|
|
789
|
+
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
790
|
+
readonly sign: (digest: Uint8Array) => Promise<Uint8Array>;
|
|
791
|
+
readonly now?: Date;
|
|
792
|
+
readonly jti?: string;
|
|
793
|
+
}
|
|
794
|
+
declare function buildPolicyCredentialPresentationV4(input: BuildPolicyCredentialPresentationV4Input): Promise<PolicyCredentialPresentationV4>;
|
|
747
795
|
interface BuildPolicyCredentialPresentationV3Input {
|
|
748
796
|
readonly policy: UnifiedPolicyV2;
|
|
749
797
|
readonly policyCid: string;
|
|
@@ -766,6 +814,7 @@ interface AdmitPolicyCredentialV3Input extends Omit<BuildPolicyCredentialPresent
|
|
|
766
814
|
/** Recipient-owned `credentials` space covered by the account authorization. */
|
|
767
815
|
readonly credentialSpaceId: string;
|
|
768
816
|
readonly fetch?: typeof fetch;
|
|
817
|
+
readonly signal?: AbortSignal;
|
|
769
818
|
}
|
|
770
819
|
interface PolicyCredentialAdmissionV3 {
|
|
771
820
|
readonly challenge: PolicyChallengeV3;
|
|
@@ -777,5 +826,21 @@ interface PolicyCredentialAdmissionV3 {
|
|
|
777
826
|
* Raw credential material appears only in the TLS POST body.
|
|
778
827
|
*/
|
|
779
828
|
declare function admitPolicyCredentialV3(input: AdmitPolicyCredentialV3Input): Promise<PolicyCredentialAdmissionV3>;
|
|
829
|
+
interface AdmitPolicyCredentialV4Input extends Omit<BuildPolicyCredentialPresentationV4Input, "challenge"> {
|
|
830
|
+
readonly policyRootCid: string;
|
|
831
|
+
readonly enforcementRootCid: string;
|
|
832
|
+
readonly expectedNodeAudience: string;
|
|
833
|
+
readonly expectedEnforcerDid: string;
|
|
834
|
+
readonly nodeOrigin: string;
|
|
835
|
+
readonly fetch?: typeof fetch;
|
|
836
|
+
readonly signal?: AbortSignal;
|
|
837
|
+
}
|
|
838
|
+
interface PolicyCredentialAdmissionV4 {
|
|
839
|
+
readonly challenge: PolicyChallengeV3;
|
|
840
|
+
readonly presentation: PolicyCredentialPresentationV4;
|
|
841
|
+
readonly session: PolicySessionUcanV1;
|
|
842
|
+
}
|
|
843
|
+
/** Accountless admission. The request deliberately has no account custody fields. */
|
|
844
|
+
declare function admitPolicyCredentialV4(input: AdmitPolicyCredentialV4Input): Promise<PolicyCredentialAdmissionV4>;
|
|
780
845
|
|
|
781
|
-
export { type
|
|
846
|
+
export { type SignatureSuite as $, ATTESTED_ENFORCER_BINDING_V2_SCHEMA as A, type BuildPolicyCredentialPresentationV3Input as B, CONTENT_SOURCE_V1_DOMAIN as C, type PolicyCredentialAdmissionV4 as D, ED25519_JCS_SIGNATURE_SUITE as E, type PolicyCredentialPresentationV3 as F, type PolicyCredentialPresentationV4 as G, type PolicyCredentialRequirementV1 as H, type PolicyRootStatusV3 as I, type JsonObject as J, type PolicySessionUcanFactV1 as K, LAST_V2_CREATE_AT as L, MAX_LEGACY_ENVELOPE_EXPIRES_AT as M, NATIVE_PROJECTION_V1_DOMAIN as N, type PolicySessionUcanV1 as O, type PolicyEngineRecord as P, type PolicyStatus as Q, ROOT_REVOCATION_V1_DOMAIN as R, type SignedObjectSigner as S, ROOT_REVOCATION_V1_SCHEMA as T, type UnsignedPolicyEngineRecord as U, ROOT_STATUS_CHECKPOINT_V1_SCHEMA as V, ROOT_STATUS_RENEWAL_V1_DOMAIN as W, ROOT_STATUS_V1_DOMAIN as X, type SignCompactUcanAuthorizationInput as Y, type SignCompactUcanRootAuthorizationInput as Z, SignatureMaterialError as _, type Policy as a, unifiedPolicyCapabilityContains as a$, SignatureVerificationError as a0, SignedObjectCanonicalizationError as a1, SignedObjectDigestError as a2, type SignedObjectErrorCode as a3, SignedObjectIdError as a4, type SignedObjectKind as a5, type SignedObjectMaterial as a6, SignedObjectProfileError as a7, SignedObjectSchemaError as a8, type SignedObjectSignature as a9, createAndSignPolicyEngineRecord as aA, createAndSignPolicyStatus as aB, createAndSignSignedObject as aC, createCompactPolicyDescendant as aD, createCompactPolicyInvocation as aE, deriveSignedObjectMaterial as aF, getPolicyRootStatusV3 as aG, issuedCredentialEnvelopeFromVerified as aH, mintPolicySessionV3 as aI, normalizeUnifiedPolicyCapability as aJ, parseCompactUcanAuthorization as aK, parsePolicySessionUcan as aL, policyCidFromCanonicalBytes as aM, policyDigestHex as aN, policyIdForDigestHex as aO, policyV2DigestHex as aP, projectUnifiedPolicyCapabilities as aQ, projectUnifiedPolicyCapability as aR, renewPolicyRootStatusV3 as aS, requestPolicyChallengeV3 as aT, revokePolicyRootV3 as aU, signCompactUcanAuthorization as aV, signCompactUcanRootAuthorization as aW, signPolicyCredentialPresentationV4 as aX, signedObjectIdFor as aY, toSignedObjectError as aZ, unifiedNativeProjectionHashHex as a_, type SignedObjectVerificationResult as aa, type SignedPolicyObject as ab, SigningKeyBindingError as ac, type UnifiedContentSource as ad, type UnifiedEncryptionCapability as ae, type UnifiedKvCapability as af, type UnifiedNativeCapability as ag, type UnifiedPolicyCapability as ah, type UnifiedPolicyV1 as ai, type UnifiedPolicyV2 as aj, type UnifiedResourceSelector as ak, type UnsignedPolicy as al, type UnsignedPolicyCredentialPresentationV4 as am, type UnsignedPolicyObject as an, type UnsignedPolicyStatus as ao, type UnsignedUnifiedPolicyV2 as ap, UnsupportedSignatureSuiteError as aq, admitPolicyCredentialV3 as ar, admitPolicyCredentialV4 as as, buildPolicyCredentialPresentationV3 as at, buildPolicyCredentialPresentationV4 as au, canonicalizeSignedObjectUnsigned as av, canonicalizeUnifiedPolicyCapability as aw, compactAttenuationContains as ax, contentSourceDigestHex as ay, createAndSignPolicy as az, type AdmitPolicyCredentialV3Input as b, unifiedPolicyCapabilityDigestHex as b0, unifiedPolicyCapabilityFromNative as b1, validatePolicyCredentialRequirementV1 as b2, validatePolicyEngineRecordSigned as b3, validatePolicyEngineRecordSignedShape as b4, validatePolicyEngineRecordUnsigned as b5, validatePolicySigned as b6, validatePolicySignedShape as b7, validatePolicyStatusSigned as b8, validatePolicyStatusSignedShape as b9, type CredentialStepType as bA, type CredentialUxState as bB, HOLDER_BINDING_DOMAIN as bC, type IssuerVerificationKey as bD, validatePolicyStatusUnsigned as ba, validatePolicyUnsigned as bb, validateUnifiedPolicyV2 as bc, verifyPolicy as bd, verifyPolicyEngineRecord as be, verifyPolicyRootRevocationV3 as bf, verifyPolicyRootStatusCheckpointV3 as bg, verifyPolicyStatus as bh, verifySignedObject as bi, type CredentialHolderBinding as bj, type CredentialFlowDescriptor as bk, type CredentialRequirement as bl, type StoredCredentialRecord as bm, type VerifiedCredential as bn, type CredentialStorageReceipt as bo, type IssuedCredentialEnvelope as bp, type CredentialIssuerMetadata as bq, CREDENTIAL_ACQUISITION_PROTOCOL as br, CREDENTIAL_CONTRACT_VERSION as bs, CREDENTIAL_FORMAT as bt, CREDENTIAL_STEP_REGISTRY_VERSION as bu, type CredentialClaimDescriptor as bv, type CredentialEndpointId as bw, type CredentialInputDescriptor as bx, type CredentialProgressEvent as by, type CredentialStepDescriptor as bz, type AdmitPolicyCredentialV4Input as c, type BuildPolicyCredentialPresentationV4Input as d, type CompactPolicyInvocationInput as e, type CompactUcanAuthorizationV1 as f, EIP191_JCS_SIGNATURE_SUITE as g, LAST_V2_READ_AT as h, POLICY_CAPABILITY_V1_DOMAIN as i, POLICY_CAPABILITY_V1_SCHEMA as j, POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE as k, POLICY_ENFORCEMENT_DELEGATION_V2_SCHEMA as l, POLICY_ENGINE_RECORD_SCHEMA as m, POLICY_PRESENTATION_V3_DOMAIN as n, POLICY_PRESENTATION_V3_SCHEMA as o, POLICY_PRESENTATION_V4_DOMAIN as p, POLICY_PRESENTATION_V4_SCHEMA as q, POLICY_SCHEMA as r, POLICY_SESSION_UCAN_V1_PROFILE as s, POLICY_STATUS_SCHEMA as t, POLICY_V1_DOMAIN as u, POLICY_V1_SCHEMA as v, POLICY_V2_DOMAIN as w, POLICY_V2_SCHEMA as x, type PolicyChallengeV3 as y, type PolicyCredentialAdmissionV3 as z };
|
|
@@ -445,6 +445,12 @@ interface UnifiedPolicyV1 {
|
|
|
445
445
|
readonly value: string;
|
|
446
446
|
};
|
|
447
447
|
}
|
|
448
|
+
type PolicySessionUcanFactV1 = Readonly<Record<string, unknown>> & {
|
|
449
|
+
/** Present only on accountless PolicyCredentialPresentation/v4 admissions. */
|
|
450
|
+
readonly credentialIdAuditDigestHex?: string;
|
|
451
|
+
/** Present only on accountless PolicyCredentialPresentation/v4 admissions. */
|
|
452
|
+
readonly presentationJtiAuditDigestHex?: string;
|
|
453
|
+
};
|
|
448
454
|
interface PolicySessionUcanV1 {
|
|
449
455
|
readonly authorization: string;
|
|
450
456
|
readonly cid: string;
|
|
@@ -455,7 +461,7 @@ interface PolicySessionUcanV1 {
|
|
|
455
461
|
readonly nbf: number;
|
|
456
462
|
readonly exp: number;
|
|
457
463
|
readonly nnc: string;
|
|
458
|
-
readonly fact:
|
|
464
|
+
readonly fact: PolicySessionUcanFactV1;
|
|
459
465
|
}
|
|
460
466
|
interface PolicyChallengeV3 {
|
|
461
467
|
readonly challengeId: string;
|
|
@@ -472,6 +478,7 @@ declare function requestPolicyChallengeV3(input: {
|
|
|
472
478
|
readonly recipientDid: string;
|
|
473
479
|
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
474
480
|
readonly fetch?: typeof fetch;
|
|
481
|
+
readonly signal?: AbortSignal;
|
|
475
482
|
}): Promise<PolicyChallengeV3>;
|
|
476
483
|
declare function mintPolicySessionV3(input: {
|
|
477
484
|
readonly nodeOrigin: string;
|
|
@@ -485,6 +492,7 @@ declare function mintPolicySessionV3(input: {
|
|
|
485
492
|
readonly presentation: Readonly<Record<string, unknown>>;
|
|
486
493
|
readonly challenge?: PolicyChallengeV3;
|
|
487
494
|
readonly fetch?: typeof fetch;
|
|
495
|
+
readonly signal?: AbortSignal;
|
|
488
496
|
}): Promise<PolicySessionUcanV1>;
|
|
489
497
|
interface PolicyRootStatusV3 {
|
|
490
498
|
readonly rootCid: string;
|
|
@@ -682,6 +690,8 @@ declare const POLICY_V2_DOMAIN = "xyz.tinycloud.policy/policy/v2\0";
|
|
|
682
690
|
declare const POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE: "TinyCloudPolicyCredentialRequirement";
|
|
683
691
|
declare const POLICY_PRESENTATION_V3_SCHEMA: "xyz.tinycloud.policy/presentation/v3";
|
|
684
692
|
declare const POLICY_PRESENTATION_V3_DOMAIN = "xyz.tinycloud.policy/Presentation/v3\0";
|
|
693
|
+
declare const POLICY_PRESENTATION_V4_SCHEMA: "xyz.tinycloud.policy/presentation/v4";
|
|
694
|
+
declare const POLICY_PRESENTATION_V4_DOMAIN = "xyz.tinycloud.policy/Presentation/v4\0";
|
|
685
695
|
interface PolicyCredentialRequirementV1 {
|
|
686
696
|
readonly type: typeof POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE;
|
|
687
697
|
readonly version: 1;
|
|
@@ -736,6 +746,29 @@ interface PolicyCredentialPresentationV3 {
|
|
|
736
746
|
readonly value: string;
|
|
737
747
|
};
|
|
738
748
|
}
|
|
749
|
+
interface UnsignedPolicyCredentialPresentationV4 {
|
|
750
|
+
readonly schema: typeof POLICY_PRESENTATION_V4_SCHEMA;
|
|
751
|
+
readonly jti: string;
|
|
752
|
+
readonly challengeId: string;
|
|
753
|
+
readonly nonce: string;
|
|
754
|
+
readonly policyCid: string;
|
|
755
|
+
readonly nodeAudience: string;
|
|
756
|
+
readonly holderDid: string;
|
|
757
|
+
readonly subjectDid: string;
|
|
758
|
+
readonly credentialDigest: string;
|
|
759
|
+
readonly requirementDigest: string;
|
|
760
|
+
readonly descriptorDigest: string;
|
|
761
|
+
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
762
|
+
readonly issuedAt: string;
|
|
763
|
+
readonly expiresAt: string;
|
|
764
|
+
}
|
|
765
|
+
interface PolicyCredentialPresentationV4 extends UnsignedPolicyCredentialPresentationV4 {
|
|
766
|
+
readonly signature: {
|
|
767
|
+
readonly suite: "Ed25519";
|
|
768
|
+
readonly signerDid: string;
|
|
769
|
+
readonly value: string;
|
|
770
|
+
};
|
|
771
|
+
}
|
|
739
772
|
declare function validatePolicyCredentialRequirementV1(value: unknown): PolicyCredentialRequirementV1;
|
|
740
773
|
declare function policyV2DigestHex(input: UnsignedUnifiedPolicyV2): string;
|
|
741
774
|
/**
|
|
@@ -744,6 +777,21 @@ declare function policyV2DigestHex(input: UnsignedUnifiedPolicyV2): string;
|
|
|
744
777
|
* Node remains the authoritative signature verifier at admission.
|
|
745
778
|
*/
|
|
746
779
|
declare function validateUnifiedPolicyV2(value: unknown, expectedPolicyCid?: string): UnifiedPolicyV2;
|
|
780
|
+
declare function issuedCredentialEnvelopeFromVerified(verified: VerifiedCredential): IssuedCredentialEnvelope;
|
|
781
|
+
/** Sign the exact accountless v4 wire value. No account custody fields exist. */
|
|
782
|
+
declare function signPolicyCredentialPresentationV4(value: UnsignedPolicyCredentialPresentationV4, sign: (digest: Uint8Array) => Promise<Uint8Array>): Promise<PolicyCredentialPresentationV4>;
|
|
783
|
+
interface BuildPolicyCredentialPresentationV4Input {
|
|
784
|
+
readonly policy: UnifiedPolicyV2;
|
|
785
|
+
readonly policyCid: string;
|
|
786
|
+
readonly challenge: PolicyChallengeV3;
|
|
787
|
+
readonly requirement: CredentialRequirement;
|
|
788
|
+
readonly credential: VerifiedCredential;
|
|
789
|
+
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
790
|
+
readonly sign: (digest: Uint8Array) => Promise<Uint8Array>;
|
|
791
|
+
readonly now?: Date;
|
|
792
|
+
readonly jti?: string;
|
|
793
|
+
}
|
|
794
|
+
declare function buildPolicyCredentialPresentationV4(input: BuildPolicyCredentialPresentationV4Input): Promise<PolicyCredentialPresentationV4>;
|
|
747
795
|
interface BuildPolicyCredentialPresentationV3Input {
|
|
748
796
|
readonly policy: UnifiedPolicyV2;
|
|
749
797
|
readonly policyCid: string;
|
|
@@ -766,6 +814,7 @@ interface AdmitPolicyCredentialV3Input extends Omit<BuildPolicyCredentialPresent
|
|
|
766
814
|
/** Recipient-owned `credentials` space covered by the account authorization. */
|
|
767
815
|
readonly credentialSpaceId: string;
|
|
768
816
|
readonly fetch?: typeof fetch;
|
|
817
|
+
readonly signal?: AbortSignal;
|
|
769
818
|
}
|
|
770
819
|
interface PolicyCredentialAdmissionV3 {
|
|
771
820
|
readonly challenge: PolicyChallengeV3;
|
|
@@ -777,5 +826,21 @@ interface PolicyCredentialAdmissionV3 {
|
|
|
777
826
|
* Raw credential material appears only in the TLS POST body.
|
|
778
827
|
*/
|
|
779
828
|
declare function admitPolicyCredentialV3(input: AdmitPolicyCredentialV3Input): Promise<PolicyCredentialAdmissionV3>;
|
|
829
|
+
interface AdmitPolicyCredentialV4Input extends Omit<BuildPolicyCredentialPresentationV4Input, "challenge"> {
|
|
830
|
+
readonly policyRootCid: string;
|
|
831
|
+
readonly enforcementRootCid: string;
|
|
832
|
+
readonly expectedNodeAudience: string;
|
|
833
|
+
readonly expectedEnforcerDid: string;
|
|
834
|
+
readonly nodeOrigin: string;
|
|
835
|
+
readonly fetch?: typeof fetch;
|
|
836
|
+
readonly signal?: AbortSignal;
|
|
837
|
+
}
|
|
838
|
+
interface PolicyCredentialAdmissionV4 {
|
|
839
|
+
readonly challenge: PolicyChallengeV3;
|
|
840
|
+
readonly presentation: PolicyCredentialPresentationV4;
|
|
841
|
+
readonly session: PolicySessionUcanV1;
|
|
842
|
+
}
|
|
843
|
+
/** Accountless admission. The request deliberately has no account custody fields. */
|
|
844
|
+
declare function admitPolicyCredentialV4(input: AdmitPolicyCredentialV4Input): Promise<PolicyCredentialAdmissionV4>;
|
|
780
845
|
|
|
781
|
-
export { type
|
|
846
|
+
export { type SignatureSuite as $, ATTESTED_ENFORCER_BINDING_V2_SCHEMA as A, type BuildPolicyCredentialPresentationV3Input as B, CONTENT_SOURCE_V1_DOMAIN as C, type PolicyCredentialAdmissionV4 as D, ED25519_JCS_SIGNATURE_SUITE as E, type PolicyCredentialPresentationV3 as F, type PolicyCredentialPresentationV4 as G, type PolicyCredentialRequirementV1 as H, type PolicyRootStatusV3 as I, type JsonObject as J, type PolicySessionUcanFactV1 as K, LAST_V2_CREATE_AT as L, MAX_LEGACY_ENVELOPE_EXPIRES_AT as M, NATIVE_PROJECTION_V1_DOMAIN as N, type PolicySessionUcanV1 as O, type PolicyEngineRecord as P, type PolicyStatus as Q, ROOT_REVOCATION_V1_DOMAIN as R, type SignedObjectSigner as S, ROOT_REVOCATION_V1_SCHEMA as T, type UnsignedPolicyEngineRecord as U, ROOT_STATUS_CHECKPOINT_V1_SCHEMA as V, ROOT_STATUS_RENEWAL_V1_DOMAIN as W, ROOT_STATUS_V1_DOMAIN as X, type SignCompactUcanAuthorizationInput as Y, type SignCompactUcanRootAuthorizationInput as Z, SignatureMaterialError as _, type Policy as a, unifiedPolicyCapabilityContains as a$, SignatureVerificationError as a0, SignedObjectCanonicalizationError as a1, SignedObjectDigestError as a2, type SignedObjectErrorCode as a3, SignedObjectIdError as a4, type SignedObjectKind as a5, type SignedObjectMaterial as a6, SignedObjectProfileError as a7, SignedObjectSchemaError as a8, type SignedObjectSignature as a9, createAndSignPolicyEngineRecord as aA, createAndSignPolicyStatus as aB, createAndSignSignedObject as aC, createCompactPolicyDescendant as aD, createCompactPolicyInvocation as aE, deriveSignedObjectMaterial as aF, getPolicyRootStatusV3 as aG, issuedCredentialEnvelopeFromVerified as aH, mintPolicySessionV3 as aI, normalizeUnifiedPolicyCapability as aJ, parseCompactUcanAuthorization as aK, parsePolicySessionUcan as aL, policyCidFromCanonicalBytes as aM, policyDigestHex as aN, policyIdForDigestHex as aO, policyV2DigestHex as aP, projectUnifiedPolicyCapabilities as aQ, projectUnifiedPolicyCapability as aR, renewPolicyRootStatusV3 as aS, requestPolicyChallengeV3 as aT, revokePolicyRootV3 as aU, signCompactUcanAuthorization as aV, signCompactUcanRootAuthorization as aW, signPolicyCredentialPresentationV4 as aX, signedObjectIdFor as aY, toSignedObjectError as aZ, unifiedNativeProjectionHashHex as a_, type SignedObjectVerificationResult as aa, type SignedPolicyObject as ab, SigningKeyBindingError as ac, type UnifiedContentSource as ad, type UnifiedEncryptionCapability as ae, type UnifiedKvCapability as af, type UnifiedNativeCapability as ag, type UnifiedPolicyCapability as ah, type UnifiedPolicyV1 as ai, type UnifiedPolicyV2 as aj, type UnifiedResourceSelector as ak, type UnsignedPolicy as al, type UnsignedPolicyCredentialPresentationV4 as am, type UnsignedPolicyObject as an, type UnsignedPolicyStatus as ao, type UnsignedUnifiedPolicyV2 as ap, UnsupportedSignatureSuiteError as aq, admitPolicyCredentialV3 as ar, admitPolicyCredentialV4 as as, buildPolicyCredentialPresentationV3 as at, buildPolicyCredentialPresentationV4 as au, canonicalizeSignedObjectUnsigned as av, canonicalizeUnifiedPolicyCapability as aw, compactAttenuationContains as ax, contentSourceDigestHex as ay, createAndSignPolicy as az, type AdmitPolicyCredentialV3Input as b, unifiedPolicyCapabilityDigestHex as b0, unifiedPolicyCapabilityFromNative as b1, validatePolicyCredentialRequirementV1 as b2, validatePolicyEngineRecordSigned as b3, validatePolicyEngineRecordSignedShape as b4, validatePolicyEngineRecordUnsigned as b5, validatePolicySigned as b6, validatePolicySignedShape as b7, validatePolicyStatusSigned as b8, validatePolicyStatusSignedShape as b9, type CredentialStepType as bA, type CredentialUxState as bB, HOLDER_BINDING_DOMAIN as bC, type IssuerVerificationKey as bD, validatePolicyStatusUnsigned as ba, validatePolicyUnsigned as bb, validateUnifiedPolicyV2 as bc, verifyPolicy as bd, verifyPolicyEngineRecord as be, verifyPolicyRootRevocationV3 as bf, verifyPolicyRootStatusCheckpointV3 as bg, verifyPolicyStatus as bh, verifySignedObject as bi, type CredentialHolderBinding as bj, type CredentialFlowDescriptor as bk, type CredentialRequirement as bl, type StoredCredentialRecord as bm, type VerifiedCredential as bn, type CredentialStorageReceipt as bo, type IssuedCredentialEnvelope as bp, type CredentialIssuerMetadata as bq, CREDENTIAL_ACQUISITION_PROTOCOL as br, CREDENTIAL_CONTRACT_VERSION as bs, CREDENTIAL_FORMAT as bt, CREDENTIAL_STEP_REGISTRY_VERSION as bu, type CredentialClaimDescriptor as bv, type CredentialEndpointId as bw, type CredentialInputDescriptor as bx, type CredentialProgressEvent as by, type CredentialStepDescriptor as bz, type AdmitPolicyCredentialV4Input as c, type BuildPolicyCredentialPresentationV4Input as d, type CompactPolicyInvocationInput as e, type CompactUcanAuthorizationV1 as f, EIP191_JCS_SIGNATURE_SUITE as g, LAST_V2_READ_AT as h, POLICY_CAPABILITY_V1_DOMAIN as i, POLICY_CAPABILITY_V1_SCHEMA as j, POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE as k, POLICY_ENFORCEMENT_DELEGATION_V2_SCHEMA as l, POLICY_ENGINE_RECORD_SCHEMA as m, POLICY_PRESENTATION_V3_DOMAIN as n, POLICY_PRESENTATION_V3_SCHEMA as o, POLICY_PRESENTATION_V4_DOMAIN as p, POLICY_PRESENTATION_V4_SCHEMA as q, POLICY_SCHEMA as r, POLICY_SESSION_UCAN_V1_PROFILE as s, POLICY_STATUS_SCHEMA as t, POLICY_V1_DOMAIN as u, POLICY_V1_SCHEMA as v, POLICY_V2_DOMAIN as w, POLICY_V2_SCHEMA as x, type PolicyChallengeV3 as y, type PolicyCredentialAdmissionV3 as z };
|
|
@@ -4007,6 +4007,11 @@ var POLICY_SESSION_FACT_KEYS = [
|
|
|
4007
4007
|
"issuanceAuditDigestHex",
|
|
4008
4008
|
"remainingRedelegationDepth"
|
|
4009
4009
|
];
|
|
4010
|
+
var POLICY_SESSION_V4_AUDIT_FACT_KEYS = [
|
|
4011
|
+
"credentialIdAuditDigestHex",
|
|
4012
|
+
"presentationJtiAuditDigestHex"
|
|
4013
|
+
];
|
|
4014
|
+
var LOWER_SHA256_HEX = /^[0-9a-f]{64}$/;
|
|
4010
4015
|
var CompactHeaderSchema = import_zod4.z.object({
|
|
4011
4016
|
alg: import_zod4.z.literal("EdDSA"),
|
|
4012
4017
|
jwk: import_zod4.z.object({ alg: import_zod4.z.literal("EdDSA"), crv: import_zod4.z.literal("Ed25519"), kty: import_zod4.z.literal("OKP"), x: import_zod4.z.string().min(1) }).strict(),
|
|
@@ -4148,9 +4153,13 @@ function parsePolicySessionUcan(authorization, expectedProofs) {
|
|
|
4148
4153
|
if (expectedProofs !== void 0 && (parsed.payload.prf[0] !== expectedProofs[0] || parsed.payload.prf[1] !== expectedProofs[1]))
|
|
4149
4154
|
throw new Error("policy session UCAN ordered proofs do not match");
|
|
4150
4155
|
const factKeys = Object.keys(fact);
|
|
4151
|
-
|
|
4156
|
+
const hasLegacyFactShape = factKeys.length === POLICY_SESSION_FACT_KEYS.length && factKeys.every((key) => POLICY_SESSION_FACT_KEYS.includes(key)) && POLICY_SESSION_FACT_KEYS.every((key) => key in fact);
|
|
4157
|
+
const hasV4AuditFactShape = factKeys.length === POLICY_SESSION_FACT_KEYS.length + POLICY_SESSION_V4_AUDIT_FACT_KEYS.length && factKeys.every((key) => POLICY_SESSION_FACT_KEYS.includes(key) || POLICY_SESSION_V4_AUDIT_FACT_KEYS.includes(key)) && POLICY_SESSION_FACT_KEYS.every((key) => key in fact) && POLICY_SESSION_V4_AUDIT_FACT_KEYS.every((key) => key in fact);
|
|
4158
|
+
if (!hasLegacyFactShape && !hasV4AuditFactShape)
|
|
4152
4159
|
throw new Error("policy session UCAN fact is incomplete");
|
|
4153
|
-
if (
|
|
4160
|
+
if (hasV4AuditFactShape && (!LOWER_SHA256_HEX.test(fact.credentialIdAuditDigestHex) || !LOWER_SHA256_HEX.test(fact.presentationJtiAuditDigestHex)))
|
|
4161
|
+
throw new Error("policy session UCAN v4 audit facts are invalid");
|
|
4162
|
+
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)
|
|
4154
4163
|
throw new Error("policy session UCAN fact is invalid");
|
|
4155
4164
|
return {
|
|
4156
4165
|
authorization,
|