@tinycloud/sdk-core 2.11.0 → 2.11.1-beta.0
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/{unified-BlXXf3l7.d.cts → credential-admission-C_cO1QqB.d.cts} +353 -1
- package/dist/{unified-HWqC-h7O.d.ts → credential-admission-cvHe-HUC.d.ts} +353 -1
- package/dist/delegations/index.cjs +10 -10
- package/dist/delegations/index.cjs.map +1 -1
- package/dist/delegations/index.d.cts +2 -2
- package/dist/delegations/index.d.ts +2 -2
- package/dist/delegations/index.js +10 -10
- package/dist/delegations/index.js.map +1 -1
- package/dist/index.cjs +534 -167
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -242
- package/dist/index.d.ts +6 -242
- package/dist/index.js +536 -169
- package/dist/index.js.map +1 -1
- package/dist/policy/index.cjs +420 -14
- 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 +420 -14
- package/dist/policy/index.js.map +1 -1
- package/dist/{recipient-types.schema-CieclU3Z.d.cts → recipient-types.schema-G8NEKRoo.d.cts} +8 -8
- package/dist/{recipient-types.schema-CieclU3Z.d.ts → recipient-types.schema-G8NEKRoo.d.ts} +8 -8
- package/package.json +1 -1
package/dist/policy/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PolicyEngineRecord, S as SignedObjectSigner, a as Policy, U as UnsignedPolicyEngineRecord } from '../
|
|
2
|
-
export { A as ATTESTED_ENFORCER_BINDING_V2_SCHEMA, C as CONTENT_SOURCE_V1_DOMAIN,
|
|
1
|
+
import { P as PolicyEngineRecord, S as SignedObjectSigner, a as Policy, U as UnsignedPolicyEngineRecord } from '../credential-admission-C_cO1QqB.cjs';
|
|
2
|
+
export { A as ATTESTED_ENFORCER_BINDING_V2_SCHEMA, b as AdmitPolicyCredentialV3Input, B as BuildPolicyCredentialPresentationV3Input, C as CONTENT_SOURCE_V1_DOMAIN, c as CompactPolicyInvocationInput, d as CompactUcanAuthorizationV1, E as ED25519_JCS_SIGNATURE_SUITE, e as EIP191_JCS_SIGNATURE_SUITE, J as JsonObject, L as LAST_V2_CREATE_AT, f as LAST_V2_READ_AT, M as MAX_LEGACY_ENVELOPE_EXPIRES_AT, N as NATIVE_PROJECTION_V1_DOMAIN, g as POLICY_CAPABILITY_V1_DOMAIN, h as POLICY_CAPABILITY_V1_SCHEMA, i as POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE, j as POLICY_ENFORCEMENT_DELEGATION_V2_SCHEMA, k as POLICY_ENGINE_RECORD_SCHEMA, l as POLICY_PRESENTATION_V3_DOMAIN, m as POLICY_PRESENTATION_V3_SCHEMA, n as POLICY_SCHEMA, o as POLICY_SESSION_UCAN_V1_PROFILE, p as POLICY_STATUS_SCHEMA, q as POLICY_V1_DOMAIN, r as POLICY_V1_SCHEMA, s as POLICY_V2_DOMAIN, t as POLICY_V2_SCHEMA, u as PolicyChallengeV3, v as PolicyCredentialAdmissionV3, w as PolicyCredentialPresentationV3, x as PolicyCredentialRequirementV1, y as PolicyRootStatusV3, z as PolicySessionUcanV1, D as PolicyStatus, R as ROOT_REVOCATION_V1_DOMAIN, F as ROOT_REVOCATION_V1_SCHEMA, G as ROOT_STATUS_CHECKPOINT_V1_SCHEMA, H as ROOT_STATUS_RENEWAL_V1_DOMAIN, I as ROOT_STATUS_V1_DOMAIN, K as SignCompactUcanAuthorizationInput, O as SignCompactUcanRootAuthorizationInput, Q as SignatureMaterialError, T as SignatureSuite, V as SignatureVerificationError, W as SignedObjectCanonicalizationError, X as SignedObjectDigestError, Y as SignedObjectErrorCode, Z as SignedObjectIdError, _ as SignedObjectKind, $ as SignedObjectMaterial, a0 as SignedObjectProfileError, a1 as SignedObjectSchemaError, a2 as SignedObjectSignature, a3 as SignedObjectVerificationResult, a4 as SignedPolicyObject, a5 as SigningKeyBindingError, a6 as UnifiedContentSource, a7 as UnifiedEncryptionCapability, a8 as UnifiedKvCapability, a9 as UnifiedNativeCapability, aa as UnifiedPolicyCapability, ab as UnifiedPolicyV1, ac as UnifiedPolicyV2, ad as UnifiedResourceSelector, ae as UnsignedPolicy, af as UnsignedPolicyObject, ag as UnsignedPolicyStatus, ah as UnsignedUnifiedPolicyV2, ai as UnsupportedSignatureSuiteError, aj as admitPolicyCredentialV3, ak as buildPolicyCredentialPresentationV3, al as canonicalizeSignedObjectUnsigned, am as canonicalizeUnifiedPolicyCapability, an as compactAttenuationContains, ao as contentSourceDigestHex, ap as createAndSignPolicy, aq as createAndSignPolicyEngineRecord, ar as createAndSignPolicyStatus, as as createAndSignSignedObject, at as createCompactPolicyDescendant, au as createCompactPolicyInvocation, av as deriveSignedObjectMaterial, aw as getPolicyRootStatusV3, ax as mintPolicySessionV3, ay as normalizeUnifiedPolicyCapability, az as parseCompactUcanAuthorization, aA as parsePolicySessionUcan, aB as policyCidFromCanonicalBytes, aC as policyDigestHex, aD as policyIdForDigestHex, aE as policyV2DigestHex, aF as projectUnifiedPolicyCapabilities, aG as projectUnifiedPolicyCapability, aH as renewPolicyRootStatusV3, aI as requestPolicyChallengeV3, aJ as revokePolicyRootV3, aK as signCompactUcanAuthorization, aL as signCompactUcanRootAuthorization, aM as signedObjectIdFor, aN as toSignedObjectError, aO as unifiedNativeProjectionHashHex, aP as unifiedPolicyCapabilityContains, aQ as unifiedPolicyCapabilityDigestHex, aR as unifiedPolicyCapabilityFromNative, aS as validatePolicyCredentialRequirementV1, aT as validatePolicyEngineRecordSigned, aU as validatePolicyEngineRecordSignedShape, aV as validatePolicyEngineRecordUnsigned, aW as validatePolicySigned, aX as validatePolicySignedShape, aY as validatePolicyStatusSigned, aZ as validatePolicyStatusSignedShape, a_ as validatePolicyStatusUnsigned, a$ as validatePolicyUnsigned, b0 as validateUnifiedPolicyV2, b1 as verifyPolicy, b2 as verifyPolicyEngineRecord, b3 as verifyPolicyRootRevocationV3, b4 as verifyPolicyRootStatusCheckpointV3, b5 as verifyPolicyStatus, b6 as verifySignedObject } from '../credential-admission-C_cO1QqB.cjs';
|
|
3
3
|
import { J as JsonObject, P as PolicyCapabilityError } from '../capability-BjzXwtNw.cjs';
|
|
4
4
|
export { a as JsonValue, b as PolicyCapability, c as PolicyCapabilityErrorCode, d as canonicalizePolicyCapability, j as jcsCanonicalize, n as normalizeJson, e as normalizePolicyCapability, p as policyCapabilityContains, f as policyCapabilityDigestHex, s as serializeJcsJson } from '../capability-BjzXwtNw.cjs';
|
|
5
5
|
import 'zod';
|
package/dist/policy/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PolicyEngineRecord, S as SignedObjectSigner, a as Policy, U as UnsignedPolicyEngineRecord } from '../
|
|
2
|
-
export { A as ATTESTED_ENFORCER_BINDING_V2_SCHEMA, C as CONTENT_SOURCE_V1_DOMAIN,
|
|
1
|
+
import { P as PolicyEngineRecord, S as SignedObjectSigner, a as Policy, U as UnsignedPolicyEngineRecord } from '../credential-admission-cvHe-HUC.js';
|
|
2
|
+
export { A as ATTESTED_ENFORCER_BINDING_V2_SCHEMA, b as AdmitPolicyCredentialV3Input, B as BuildPolicyCredentialPresentationV3Input, C as CONTENT_SOURCE_V1_DOMAIN, c as CompactPolicyInvocationInput, d as CompactUcanAuthorizationV1, E as ED25519_JCS_SIGNATURE_SUITE, e as EIP191_JCS_SIGNATURE_SUITE, J as JsonObject, L as LAST_V2_CREATE_AT, f as LAST_V2_READ_AT, M as MAX_LEGACY_ENVELOPE_EXPIRES_AT, N as NATIVE_PROJECTION_V1_DOMAIN, g as POLICY_CAPABILITY_V1_DOMAIN, h as POLICY_CAPABILITY_V1_SCHEMA, i as POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE, j as POLICY_ENFORCEMENT_DELEGATION_V2_SCHEMA, k as POLICY_ENGINE_RECORD_SCHEMA, l as POLICY_PRESENTATION_V3_DOMAIN, m as POLICY_PRESENTATION_V3_SCHEMA, n as POLICY_SCHEMA, o as POLICY_SESSION_UCAN_V1_PROFILE, p as POLICY_STATUS_SCHEMA, q as POLICY_V1_DOMAIN, r as POLICY_V1_SCHEMA, s as POLICY_V2_DOMAIN, t as POLICY_V2_SCHEMA, u as PolicyChallengeV3, v as PolicyCredentialAdmissionV3, w as PolicyCredentialPresentationV3, x as PolicyCredentialRequirementV1, y as PolicyRootStatusV3, z as PolicySessionUcanV1, D as PolicyStatus, R as ROOT_REVOCATION_V1_DOMAIN, F as ROOT_REVOCATION_V1_SCHEMA, G as ROOT_STATUS_CHECKPOINT_V1_SCHEMA, H as ROOT_STATUS_RENEWAL_V1_DOMAIN, I as ROOT_STATUS_V1_DOMAIN, K as SignCompactUcanAuthorizationInput, O as SignCompactUcanRootAuthorizationInput, Q as SignatureMaterialError, T as SignatureSuite, V as SignatureVerificationError, W as SignedObjectCanonicalizationError, X as SignedObjectDigestError, Y as SignedObjectErrorCode, Z as SignedObjectIdError, _ as SignedObjectKind, $ as SignedObjectMaterial, a0 as SignedObjectProfileError, a1 as SignedObjectSchemaError, a2 as SignedObjectSignature, a3 as SignedObjectVerificationResult, a4 as SignedPolicyObject, a5 as SigningKeyBindingError, a6 as UnifiedContentSource, a7 as UnifiedEncryptionCapability, a8 as UnifiedKvCapability, a9 as UnifiedNativeCapability, aa as UnifiedPolicyCapability, ab as UnifiedPolicyV1, ac as UnifiedPolicyV2, ad as UnifiedResourceSelector, ae as UnsignedPolicy, af as UnsignedPolicyObject, ag as UnsignedPolicyStatus, ah as UnsignedUnifiedPolicyV2, ai as UnsupportedSignatureSuiteError, aj as admitPolicyCredentialV3, ak as buildPolicyCredentialPresentationV3, al as canonicalizeSignedObjectUnsigned, am as canonicalizeUnifiedPolicyCapability, an as compactAttenuationContains, ao as contentSourceDigestHex, ap as createAndSignPolicy, aq as createAndSignPolicyEngineRecord, ar as createAndSignPolicyStatus, as as createAndSignSignedObject, at as createCompactPolicyDescendant, au as createCompactPolicyInvocation, av as deriveSignedObjectMaterial, aw as getPolicyRootStatusV3, ax as mintPolicySessionV3, ay as normalizeUnifiedPolicyCapability, az as parseCompactUcanAuthorization, aA as parsePolicySessionUcan, aB as policyCidFromCanonicalBytes, aC as policyDigestHex, aD as policyIdForDigestHex, aE as policyV2DigestHex, aF as projectUnifiedPolicyCapabilities, aG as projectUnifiedPolicyCapability, aH as renewPolicyRootStatusV3, aI as requestPolicyChallengeV3, aJ as revokePolicyRootV3, aK as signCompactUcanAuthorization, aL as signCompactUcanRootAuthorization, aM as signedObjectIdFor, aN as toSignedObjectError, aO as unifiedNativeProjectionHashHex, aP as unifiedPolicyCapabilityContains, aQ as unifiedPolicyCapabilityDigestHex, aR as unifiedPolicyCapabilityFromNative, aS as validatePolicyCredentialRequirementV1, aT as validatePolicyEngineRecordSigned, aU as validatePolicyEngineRecordSignedShape, aV as validatePolicyEngineRecordUnsigned, aW as validatePolicySigned, aX as validatePolicySignedShape, aY as validatePolicyStatusSigned, aZ as validatePolicyStatusSignedShape, a_ as validatePolicyStatusUnsigned, a$ as validatePolicyUnsigned, b0 as validateUnifiedPolicyV2, b1 as verifyPolicy, b2 as verifyPolicyEngineRecord, b3 as verifyPolicyRootRevocationV3, b4 as verifyPolicyRootStatusCheckpointV3, b5 as verifyPolicyStatus, b6 as verifySignedObject } from '../credential-admission-cvHe-HUC.js';
|
|
3
3
|
import { J as JsonObject, P as PolicyCapabilityError } from '../capability-BjzXwtNw.js';
|
|
4
4
|
export { a as JsonValue, b as PolicyCapability, c as PolicyCapabilityErrorCode, d as canonicalizePolicyCapability, j as jcsCanonicalize, n as normalizeJson, e as normalizePolicyCapability, p as policyCapabilityContains, f as policyCapabilityDigestHex, s as serializeJcsJson } from '../capability-BjzXwtNw.js';
|
|
5
5
|
import 'zod';
|
package/dist/policy/index.js
CHANGED
|
@@ -2664,13 +2664,13 @@ function base64UrlDecode(value) {
|
|
|
2664
2664
|
return decoded;
|
|
2665
2665
|
}
|
|
2666
2666
|
function hexToBytes(value) {
|
|
2667
|
-
const
|
|
2668
|
-
if (
|
|
2667
|
+
const hex3 = value.slice(2);
|
|
2668
|
+
if (hex3.length % 2 !== 0 || !/^[0-9a-fA-F]*$/.test(hex3)) {
|
|
2669
2669
|
throw new SignatureMaterialError("hex signature must have even length");
|
|
2670
2670
|
}
|
|
2671
|
-
const output = new Uint8Array(
|
|
2671
|
+
const output = new Uint8Array(hex3.length / 2);
|
|
2672
2672
|
for (let index = 0; index < output.length; index++) {
|
|
2673
|
-
output[index] = Number.parseInt(
|
|
2673
|
+
output[index] = Number.parseInt(hex3.slice(index * 2, index * 2 + 2), 16);
|
|
2674
2674
|
}
|
|
2675
2675
|
return output;
|
|
2676
2676
|
}
|
|
@@ -3426,11 +3426,15 @@ function nonEmptyString(value, label) {
|
|
|
3426
3426
|
return value;
|
|
3427
3427
|
}
|
|
3428
3428
|
function parseKvResource(resource) {
|
|
3429
|
-
const
|
|
3430
|
-
|
|
3429
|
+
const marker = resource.indexOf("/kv/");
|
|
3430
|
+
const encodedSpace = marker < 1 ? "" : resource.slice(0, marker);
|
|
3431
|
+
const legacy = encodedSpace.startsWith("tinycloud://");
|
|
3432
|
+
const space = legacy ? encodedSpace.slice("tinycloud://".length) : encodedSpace;
|
|
3433
|
+
const path = marker < 1 ? "" : resource.slice(marker + 4);
|
|
3434
|
+
if (marker < 1 || (legacy ? /[:/?#%]/.test(space) : !encodedSpace.startsWith("tinycloud:") || /[/?#%]/.test(encodedSpace)) || path.startsWith("/") || path.endsWith("/") || path.includes("//") || path.split("/").some((part) => part === "." || part === ".." || part.length === 0)) {
|
|
3431
3435
|
throw new Error("KV resource is not canonical");
|
|
3432
3436
|
}
|
|
3433
|
-
return { space
|
|
3437
|
+
return { space, path };
|
|
3434
3438
|
}
|
|
3435
3439
|
function parseEncryptionResource(resource) {
|
|
3436
3440
|
if (!resource.startsWith("urn:tinycloud:encryption:")) throw new Error("encryption capability is invalid");
|
|
@@ -3575,7 +3579,7 @@ function unifiedPolicyCapabilityFromNative(input) {
|
|
|
3575
3579
|
throw new Error("native capability is not supported");
|
|
3576
3580
|
const caveat = object(value.caveat, "native.caveat");
|
|
3577
3581
|
exactKeys(caveat, ["type", "kind", "value"], "native selector caveat");
|
|
3578
|
-
if (caveat.type !== "xyz.tinycloud.resource/selector" || caveat.kind !== "exact" && caveat.kind !== "prefix" || caveat.value !== `tinycloud://${value.space}/kv/${value.path}`)
|
|
3582
|
+
if (caveat.type !== "xyz.tinycloud.resource/selector" || caveat.kind !== "exact" && caveat.kind !== "prefix" || caveat.value !== `${value.space.startsWith("tinycloud:") ? value.space : `tinycloud://${value.space}`}/kv/${value.path}`)
|
|
3579
3583
|
throw new Error("native selector caveat does not match capability");
|
|
3580
3584
|
return normalizeUnifiedPolicyCapability({
|
|
3581
3585
|
kind: "kv",
|
|
@@ -3634,9 +3638,7 @@ var CompactPayloadSchema = z.object({
|
|
|
3634
3638
|
nnc: z.string().min(1),
|
|
3635
3639
|
prf: z.array(z.string().min(1))
|
|
3636
3640
|
}).strict();
|
|
3637
|
-
async function
|
|
3638
|
-
if (input.notBefore >= input.expiresAt || input.expiresAt - input.notBefore > 60)
|
|
3639
|
-
throw new Error("compact invocation lifetime must be between one and 60 seconds");
|
|
3641
|
+
async function signCompactUcan(input) {
|
|
3640
3642
|
const principal = input.issuerDid.split("#", 1)[0];
|
|
3641
3643
|
const didMaterial = principal.startsWith("did:key:") ? base58btc.decode(principal.slice("did:key:".length)) : new Uint8Array();
|
|
3642
3644
|
if (didMaterial.length !== 34 || didMaterial[0] !== 237 || didMaterial[1] !== 1)
|
|
@@ -3658,6 +3660,16 @@ async function signCompactUcanAuthorization(input) {
|
|
|
3658
3660
|
if (signature.length !== 64) throw new Error("compact Authorization signature must be Ed25519");
|
|
3659
3661
|
return parseCompactUcanAuthorization(`${protectedSegment}.${payloadSegment}.${encodeBase64Url(signature)}`);
|
|
3660
3662
|
}
|
|
3663
|
+
async function signCompactUcanAuthorization(input) {
|
|
3664
|
+
if (input.notBefore >= input.expiresAt || input.expiresAt - input.notBefore > 60)
|
|
3665
|
+
throw new Error("compact invocation lifetime must be between one and 60 seconds");
|
|
3666
|
+
return signCompactUcan(input);
|
|
3667
|
+
}
|
|
3668
|
+
async function signCompactUcanRootAuthorization(input) {
|
|
3669
|
+
if (input.notBefore >= input.expiresAt || input.expiresAt - input.notBefore > 31 * 24 * 60 * 60)
|
|
3670
|
+
throw new Error("compact policy root lifetime must be between one second and 31 days");
|
|
3671
|
+
return signCompactUcan({ ...input, proofs: [] });
|
|
3672
|
+
}
|
|
3661
3673
|
function createCompactPolicyInvocation(input) {
|
|
3662
3674
|
const session = parsePolicySessionUcan(input.sessionAuthorization);
|
|
3663
3675
|
if (session.cid !== input.sessionCid || session.aud !== input.recipientDid)
|
|
@@ -3804,14 +3816,14 @@ function decodeBase64Url(value) {
|
|
|
3804
3816
|
if (!/^[A-Za-z0-9_-]+$/.test(value) || value.length % 4 === 1)
|
|
3805
3817
|
throw new Error("value is not canonical base64url");
|
|
3806
3818
|
const normalized = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
3807
|
-
const binary = typeof
|
|
3819
|
+
const binary = typeof atob === "function" ? atob(normalized.padEnd(Math.ceil(normalized.length / 4) * 4, "=")) : Buffer.from(normalized, "base64").toString("binary");
|
|
3808
3820
|
const bytes = Uint8Array.from(binary, (character) => character.charCodeAt(0));
|
|
3809
|
-
const encoded = typeof
|
|
3821
|
+
const encoded = typeof btoa === "function" ? btoa(String.fromCharCode(...bytes)).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_") : Buffer.from(bytes).toString("base64url");
|
|
3810
3822
|
if (encoded !== value) throw new Error("value is not canonical base64url");
|
|
3811
3823
|
return bytes;
|
|
3812
3824
|
}
|
|
3813
3825
|
function encodeBase64Url(value) {
|
|
3814
|
-
return typeof
|
|
3826
|
+
return typeof btoa === "function" ? btoa(String.fromCharCode(...value)).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_") : Buffer.from(value).toString("base64url");
|
|
3815
3827
|
}
|
|
3816
3828
|
function equalBytes(left, right) {
|
|
3817
3829
|
return left.length === right.length && left.every((byte, index) => byte === right[index]);
|
|
@@ -3835,6 +3847,389 @@ function base32Lower(bytes) {
|
|
|
3835
3847
|
if (bits > 0) output += alphabet2[buffer << 5 - bits & 31];
|
|
3836
3848
|
return output;
|
|
3837
3849
|
}
|
|
3850
|
+
|
|
3851
|
+
// src/policy/credential-admission.ts
|
|
3852
|
+
import { ed25519 as ed255193 } from "@noble/curves/ed25519";
|
|
3853
|
+
import { sha256 as sha2565 } from "@noble/hashes/sha256";
|
|
3854
|
+
|
|
3855
|
+
// src/credentials/digest.ts
|
|
3856
|
+
function encodeBase64Url2(bytes) {
|
|
3857
|
+
if (typeof btoa === "function") {
|
|
3858
|
+
let binary = "";
|
|
3859
|
+
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
3860
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
3861
|
+
}
|
|
3862
|
+
return Buffer.from(bytes).toString("base64url");
|
|
3863
|
+
}
|
|
3864
|
+
async function sha256Base64Url(value) {
|
|
3865
|
+
const bytes = typeof value === "string" ? new TextEncoder().encode(value) : value;
|
|
3866
|
+
return encodeBase64Url2(new Uint8Array(await crypto.subtle.digest("SHA-256", bytes)));
|
|
3867
|
+
}
|
|
3868
|
+
async function canonicalDigest(value) {
|
|
3869
|
+
return sha256Base64Url(jcsCanonicalize(value));
|
|
3870
|
+
}
|
|
3871
|
+
function isDigest(value) {
|
|
3872
|
+
return typeof value === "string" && /^[A-Za-z0-9_-]{43}$/.test(value);
|
|
3873
|
+
}
|
|
3874
|
+
|
|
3875
|
+
// src/credentials/errors.ts
|
|
3876
|
+
var RECOVERABLE = /* @__PURE__ */ new Set([
|
|
3877
|
+
"CANCELED",
|
|
3878
|
+
"ISSUER_UNREADY",
|
|
3879
|
+
"OFFLINE",
|
|
3880
|
+
"POPUP_BLOCKED",
|
|
3881
|
+
"REQUEST_EXPIRED",
|
|
3882
|
+
"SIGNATURE_REJECTED",
|
|
3883
|
+
"UNSUPPORTED_PROFILE",
|
|
3884
|
+
"UNSUPPORTED_VERSION",
|
|
3885
|
+
"VERIFIED_NOT_SAVED"
|
|
3886
|
+
]);
|
|
3887
|
+
var CredentialError = class extends Error {
|
|
3888
|
+
constructor(code2, message, details = {}) {
|
|
3889
|
+
super(message);
|
|
3890
|
+
this.code = code2;
|
|
3891
|
+
this.details = details;
|
|
3892
|
+
this.name = "CredentialError";
|
|
3893
|
+
this.recoverable = RECOVERABLE.has(code2);
|
|
3894
|
+
}
|
|
3895
|
+
};
|
|
3896
|
+
|
|
3897
|
+
// src/credentials/requirement.ts
|
|
3898
|
+
var ID = /^[a-z0-9][a-z0-9._-]{0,127}(?:\/v1)?$/;
|
|
3899
|
+
function validateCredentialRequirement(value) {
|
|
3900
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential requirement is invalid");
|
|
3901
|
+
const raw = value;
|
|
3902
|
+
if (Object.keys(raw).some((key) => !["type", "version", "profile", "credentialType", "claims", "maxAgeSeconds"].includes(key)) || raw.type !== "TinyCloudCredentialRequirement" || raw.version !== 1) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential requirement version is unsupported");
|
|
3903
|
+
const pair = (candidate, label) => {
|
|
3904
|
+
if (typeof candidate !== "object" || candidate === null || Array.isArray(candidate)) throw new CredentialError("UNSUPPORTED_PROFILE", `${label} is invalid`);
|
|
3905
|
+
const item = candidate;
|
|
3906
|
+
if (Object.keys(item).length !== 2 || typeof item.id !== "string" || !ID.test(item.id) || item.version !== 1) throw new CredentialError("UNSUPPORTED_PROFILE", `${label} version is unsupported`);
|
|
3907
|
+
return { id: item.id, version: 1 };
|
|
3908
|
+
};
|
|
3909
|
+
if (typeof raw.claims !== "object" || raw.claims === null || Array.isArray(raw.claims)) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential claims are invalid");
|
|
3910
|
+
const claims = {};
|
|
3911
|
+
for (const [key, value2] of Object.entries(raw.claims).sort(([a], [b]) => a.localeCompare(b))) {
|
|
3912
|
+
if (!ID.test(key) || typeof value2 !== "string" || value2.length === 0 || value2.length > 4096) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential claim is invalid");
|
|
3913
|
+
claims[key] = value2;
|
|
3914
|
+
}
|
|
3915
|
+
if (raw.maxAgeSeconds !== void 0 && (!Number.isSafeInteger(raw.maxAgeSeconds) || raw.maxAgeSeconds < 1)) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential freshness is invalid");
|
|
3916
|
+
return Object.freeze({ type: "TinyCloudCredentialRequirement", version: 1, profile: pair(raw.profile, "profile"), credentialType: pair(raw.credentialType, "credentialType"), claims: Object.freeze(claims), ...raw.maxAgeSeconds === void 0 ? {} : { maxAgeSeconds: raw.maxAgeSeconds } });
|
|
3917
|
+
}
|
|
3918
|
+
async function credentialRequirementDigest(requirement) {
|
|
3919
|
+
return canonicalDigest(validateCredentialRequirement(requirement));
|
|
3920
|
+
}
|
|
3921
|
+
|
|
3922
|
+
// src/policy/credential-admission.ts
|
|
3923
|
+
var POLICY_V2_SCHEMA = "xyz.tinycloud.policy/policy/v2";
|
|
3924
|
+
var POLICY_V2_DOMAIN = "xyz.tinycloud.policy/policy/v2\0";
|
|
3925
|
+
var POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE = "TinyCloudPolicyCredentialRequirement";
|
|
3926
|
+
var POLICY_PRESENTATION_V3_SCHEMA = "xyz.tinycloud.policy/presentation/v3";
|
|
3927
|
+
var POLICY_PRESENTATION_V3_DOMAIN = "xyz.tinycloud.policy/Presentation/v3\0";
|
|
3928
|
+
function record(value, label) {
|
|
3929
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
3930
|
+
throw new Error(`${label} must be an object`);
|
|
3931
|
+
}
|
|
3932
|
+
return value;
|
|
3933
|
+
}
|
|
3934
|
+
function exactKeys2(value, keys, label) {
|
|
3935
|
+
const expected = [...keys].sort();
|
|
3936
|
+
const actual = Object.keys(value).sort();
|
|
3937
|
+
if (actual.length !== expected.length || actual.some((key, index) => key !== expected[index])) {
|
|
3938
|
+
throw new Error(`${label} contains an unknown or missing field`);
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3941
|
+
function nonEmpty(value, label) {
|
|
3942
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
3943
|
+
throw new Error(`${label} must be a non-empty string`);
|
|
3944
|
+
}
|
|
3945
|
+
return value;
|
|
3946
|
+
}
|
|
3947
|
+
function policyNodeOrigin(value) {
|
|
3948
|
+
let url;
|
|
3949
|
+
try {
|
|
3950
|
+
url = new URL(value);
|
|
3951
|
+
} catch {
|
|
3952
|
+
throw new Error("policy node origin is invalid");
|
|
3953
|
+
}
|
|
3954
|
+
if (url.protocol !== "https:" || url.username !== "" || url.password !== "" || url.pathname !== "/" || url.search !== "" || url.hash !== "") {
|
|
3955
|
+
throw new Error("policy node origin is invalid");
|
|
3956
|
+
}
|
|
3957
|
+
return url.origin;
|
|
3958
|
+
}
|
|
3959
|
+
function versionPair(value, label) {
|
|
3960
|
+
const item = record(value, label);
|
|
3961
|
+
exactKeys2(item, ["id", "version"], label);
|
|
3962
|
+
if (item.version !== 1) throw new Error(`${label} version is unsupported`);
|
|
3963
|
+
return Object.freeze({ id: nonEmpty(item.id, `${label}.id`), version: 1 });
|
|
3964
|
+
}
|
|
3965
|
+
function validatePolicyCredentialRequirementV1(value) {
|
|
3966
|
+
const item = record(value, "policy credential requirement");
|
|
3967
|
+
exactKeys2(
|
|
3968
|
+
item,
|
|
3969
|
+
[
|
|
3970
|
+
"type",
|
|
3971
|
+
"version",
|
|
3972
|
+
"requirementDigest",
|
|
3973
|
+
"descriptorDigest",
|
|
3974
|
+
"issuerDid",
|
|
3975
|
+
"issuerKid",
|
|
3976
|
+
"profile",
|
|
3977
|
+
"credentialType"
|
|
3978
|
+
],
|
|
3979
|
+
"policy credential requirement"
|
|
3980
|
+
);
|
|
3981
|
+
if (item.type !== POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE || item.version !== 1 || !isDigest(item.requirementDigest) || !isDigest(item.descriptorDigest)) {
|
|
3982
|
+
throw new Error("policy credential requirement is invalid");
|
|
3983
|
+
}
|
|
3984
|
+
return Object.freeze({
|
|
3985
|
+
type: POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE,
|
|
3986
|
+
version: 1,
|
|
3987
|
+
requirementDigest: item.requirementDigest,
|
|
3988
|
+
descriptorDigest: item.descriptorDigest,
|
|
3989
|
+
issuerDid: nonEmpty(item.issuerDid, "policy credential issuer"),
|
|
3990
|
+
issuerKid: nonEmpty(item.issuerKid, "policy credential issuer key"),
|
|
3991
|
+
profile: versionPair(item.profile, "policy credential profile"),
|
|
3992
|
+
credentialType: versionPair(
|
|
3993
|
+
item.credentialType,
|
|
3994
|
+
"policy credential type"
|
|
3995
|
+
)
|
|
3996
|
+
});
|
|
3997
|
+
}
|
|
3998
|
+
function hex2(bytes) {
|
|
3999
|
+
return [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
4000
|
+
}
|
|
4001
|
+
function policyV2DigestHex(input) {
|
|
4002
|
+
const canonicalPolicy = {
|
|
4003
|
+
...input,
|
|
4004
|
+
credentialRequirement: validatePolicyCredentialRequirementV1(
|
|
4005
|
+
input.credentialRequirement
|
|
4006
|
+
),
|
|
4007
|
+
capabilityCeiling: input.capabilityCeiling.map(
|
|
4008
|
+
normalizeUnifiedPolicyCapability
|
|
4009
|
+
)
|
|
4010
|
+
};
|
|
4011
|
+
return hex2(
|
|
4012
|
+
sha2565(
|
|
4013
|
+
new TextEncoder().encode(
|
|
4014
|
+
POLICY_V2_DOMAIN + jcsCanonicalize(canonicalPolicy)
|
|
4015
|
+
)
|
|
4016
|
+
)
|
|
4017
|
+
);
|
|
4018
|
+
}
|
|
4019
|
+
function date(value, label) {
|
|
4020
|
+
const text = nonEmpty(value, label);
|
|
4021
|
+
if (!Number.isFinite(Date.parse(text))) throw new Error(`${label} is invalid`);
|
|
4022
|
+
return text;
|
|
4023
|
+
}
|
|
4024
|
+
function rfc3339Seconds(value) {
|
|
4025
|
+
return new Date(Math.floor(value.getTime() / 1e3) * 1e3).toISOString().replace(/\.000Z$/, "Z");
|
|
4026
|
+
}
|
|
4027
|
+
function validateUnifiedPolicyV2(value, expectedPolicyCid) {
|
|
4028
|
+
const item = record(value, "Policy/v2");
|
|
4029
|
+
const allowed = [
|
|
4030
|
+
"schema",
|
|
4031
|
+
"policyId",
|
|
4032
|
+
"ownerDid",
|
|
4033
|
+
"createdAt",
|
|
4034
|
+
"contentSource",
|
|
4035
|
+
"capabilityCeiling",
|
|
4036
|
+
"credentialRequirement",
|
|
4037
|
+
"signature",
|
|
4038
|
+
...item.expiresAt === void 0 ? [] : ["expiresAt"]
|
|
4039
|
+
];
|
|
4040
|
+
exactKeys2(item, allowed, "Policy/v2");
|
|
4041
|
+
if (item.schema !== POLICY_V2_SCHEMA || !Array.isArray(item.capabilityCeiling)) {
|
|
4042
|
+
throw new Error("Policy/v2 is invalid");
|
|
4043
|
+
}
|
|
4044
|
+
const ownerDid = nonEmpty(item.ownerDid, "Policy/v2 ownerDid");
|
|
4045
|
+
const signature = record(item.signature, "Policy/v2 signature");
|
|
4046
|
+
exactKeys2(signature, ["suite", "signerDid", "value"], "Policy/v2 signature");
|
|
4047
|
+
if (signature.suite !== "Ed25519" || signature.signerDid !== ownerDid || typeof signature.value !== "string" || signature.value.length === 0) {
|
|
4048
|
+
throw new Error("Policy/v2 signature binding is invalid");
|
|
4049
|
+
}
|
|
4050
|
+
const policy = Object.freeze({
|
|
4051
|
+
schema: POLICY_V2_SCHEMA,
|
|
4052
|
+
policyId: nonEmpty(item.policyId, "Policy/v2 policyId"),
|
|
4053
|
+
ownerDid,
|
|
4054
|
+
createdAt: date(item.createdAt, "Policy/v2 createdAt"),
|
|
4055
|
+
...item.expiresAt === void 0 ? {} : { expiresAt: date(item.expiresAt, "Policy/v2 expiresAt") },
|
|
4056
|
+
contentSource: item.contentSource,
|
|
4057
|
+
capabilityCeiling: Object.freeze(
|
|
4058
|
+
item.capabilityCeiling.map(normalizeUnifiedPolicyCapability)
|
|
4059
|
+
),
|
|
4060
|
+
credentialRequirement: validatePolicyCredentialRequirementV1(
|
|
4061
|
+
item.credentialRequirement
|
|
4062
|
+
),
|
|
4063
|
+
signature: Object.freeze({
|
|
4064
|
+
suite: "Ed25519",
|
|
4065
|
+
signerDid: ownerDid,
|
|
4066
|
+
value: signature.value
|
|
4067
|
+
})
|
|
4068
|
+
});
|
|
4069
|
+
const unsigned = { ...policy };
|
|
4070
|
+
delete unsigned.policyId;
|
|
4071
|
+
delete unsigned.signature;
|
|
4072
|
+
const digestHex = policyV2DigestHex(unsigned);
|
|
4073
|
+
if (policy.policyId !== policyIdForDigestHex(digestHex)) {
|
|
4074
|
+
throw new Error("Policy/v2 policyId binding is invalid");
|
|
4075
|
+
}
|
|
4076
|
+
if (expectedPolicyCid !== void 0) {
|
|
4077
|
+
const cid = policyCidFromCanonicalBytes(
|
|
4078
|
+
new TextEncoder().encode(jcsCanonicalize(policy))
|
|
4079
|
+
);
|
|
4080
|
+
if (cid !== expectedPolicyCid) throw new Error("Policy/v2 CID binding is invalid");
|
|
4081
|
+
}
|
|
4082
|
+
return policy;
|
|
4083
|
+
}
|
|
4084
|
+
function didKeyBytes(did) {
|
|
4085
|
+
const principal = did.split("#", 1)[0];
|
|
4086
|
+
if (!principal.startsWith("did:key:")) throw new Error("holder DID must be did:key");
|
|
4087
|
+
const material = base58btc.decode(principal.slice("did:key:".length));
|
|
4088
|
+
if (material.length !== 34 || material[0] !== 237 || material[1] !== 1) {
|
|
4089
|
+
throw new Error("holder DID must contain an Ed25519 key");
|
|
4090
|
+
}
|
|
4091
|
+
return material.slice(2);
|
|
4092
|
+
}
|
|
4093
|
+
function envelopeFromVerified(verified) {
|
|
4094
|
+
const {
|
|
4095
|
+
verifiedAt: _verifiedAt,
|
|
4096
|
+
credentialDigest: _credentialDigest,
|
|
4097
|
+
statusCheckedAt: _statusCheckedAt,
|
|
4098
|
+
...envelope
|
|
4099
|
+
} = verified;
|
|
4100
|
+
return envelope;
|
|
4101
|
+
}
|
|
4102
|
+
async function buildPolicyCredentialPresentationV3(input) {
|
|
4103
|
+
const policy = validateUnifiedPolicyV2(input.policy, input.policyCid);
|
|
4104
|
+
const requirement = validateCredentialRequirement(input.requirement);
|
|
4105
|
+
const commitment = policy.credentialRequirement;
|
|
4106
|
+
const requirementDigest = await credentialRequirementDigest(requirement);
|
|
4107
|
+
const credentialDigest = await sha256Base64Url(input.credential.credential);
|
|
4108
|
+
if (requirementDigest !== commitment.requirementDigest || input.credential.descriptorDigest !== commitment.descriptorDigest || input.credential.credentialDigest !== credentialDigest || input.credential.issuerDid !== commitment.issuerDid || input.credential.issuerKid !== commitment.issuerKid || jcsCanonicalize(input.credential.profile) !== jcsCanonicalize(commitment.profile) || jcsCanonicalize(input.credential.credentialType) !== jcsCanonicalize(commitment.credentialType)) {
|
|
4109
|
+
throw new Error("credential does not match the signed Policy/v2 requirement");
|
|
4110
|
+
}
|
|
4111
|
+
const requestedCapabilities = input.requestedCapabilities.map(
|
|
4112
|
+
normalizeUnifiedPolicyCapability
|
|
4113
|
+
);
|
|
4114
|
+
if (requestedCapabilities.length === 0 || requestedCapabilities.some(
|
|
4115
|
+
(requested) => !policy.capabilityCeiling.some(
|
|
4116
|
+
(authority) => unifiedPolicyCapabilityContains(authority, requested)
|
|
4117
|
+
)
|
|
4118
|
+
)) {
|
|
4119
|
+
throw new Error("requested capabilities exceed the signed Policy/v2 ceiling");
|
|
4120
|
+
}
|
|
4121
|
+
const challenge = input.challenge;
|
|
4122
|
+
const holderDid = input.credential.holderDid;
|
|
4123
|
+
if (challenge.policyCid !== input.policyCid || challenge.recipientDid !== holderDid || input.credential.subjectDid !== holderDid || typeof challenge.nodeAudience !== "string" || challenge.nodeAudience.length === 0 || typeof challenge.expiresAt !== "string" || !Number.isFinite(Date.parse(challenge.expiresAt))) {
|
|
4124
|
+
throw new Error("policy challenge binding is invalid");
|
|
4125
|
+
}
|
|
4126
|
+
didKeyBytes(holderDid);
|
|
4127
|
+
const now = input.now ?? /* @__PURE__ */ new Date();
|
|
4128
|
+
const challengeExpiry = Date.parse(challenge.expiresAt);
|
|
4129
|
+
const credentialExpiry = Date.parse(input.credential.expiresAt);
|
|
4130
|
+
const expiresAtMs = Math.min(
|
|
4131
|
+
now.getTime() + 6e4,
|
|
4132
|
+
challengeExpiry,
|
|
4133
|
+
credentialExpiry
|
|
4134
|
+
);
|
|
4135
|
+
if (expiresAtMs <= now.getTime()) throw new Error("policy challenge is expired");
|
|
4136
|
+
const unsigned = Object.freeze({
|
|
4137
|
+
schema: POLICY_PRESENTATION_V3_SCHEMA,
|
|
4138
|
+
jti: input.jti ?? encodeBase64Url2(crypto.getRandomValues(new Uint8Array(16))),
|
|
4139
|
+
challengeId: challenge.challengeId,
|
|
4140
|
+
nonce: challenge.nonce,
|
|
4141
|
+
policyCid: input.policyCid,
|
|
4142
|
+
nodeAudience: challenge.nodeAudience,
|
|
4143
|
+
holderDid,
|
|
4144
|
+
subjectDid: input.credential.subjectDid,
|
|
4145
|
+
credentialSpaceOwnerDid: nonEmpty(
|
|
4146
|
+
input.credentialSpaceOwnerDid,
|
|
4147
|
+
"credential space owner DID"
|
|
4148
|
+
),
|
|
4149
|
+
credentialDigest,
|
|
4150
|
+
requirementDigest,
|
|
4151
|
+
descriptorDigest: input.credential.descriptorDigest,
|
|
4152
|
+
requestedCapabilities: Object.freeze(requestedCapabilities),
|
|
4153
|
+
issuedAt: rfc3339Seconds(now),
|
|
4154
|
+
expiresAt: rfc3339Seconds(new Date(expiresAtMs))
|
|
4155
|
+
});
|
|
4156
|
+
const digest2 = sha2565(
|
|
4157
|
+
new TextEncoder().encode(
|
|
4158
|
+
POLICY_PRESENTATION_V3_DOMAIN + jcsCanonicalize(unsigned)
|
|
4159
|
+
)
|
|
4160
|
+
);
|
|
4161
|
+
const signature = await input.sign(digest2);
|
|
4162
|
+
if (signature.length !== 64 || !ed255193.verify(signature, digest2, didKeyBytes(holderDid))) {
|
|
4163
|
+
throw new Error("policy presentation signature is invalid");
|
|
4164
|
+
}
|
|
4165
|
+
return Object.freeze({
|
|
4166
|
+
...unsigned,
|
|
4167
|
+
signature: Object.freeze({
|
|
4168
|
+
suite: "Ed25519",
|
|
4169
|
+
signerDid: holderDid,
|
|
4170
|
+
value: encodeBase64Url2(signature)
|
|
4171
|
+
})
|
|
4172
|
+
});
|
|
4173
|
+
}
|
|
4174
|
+
async function admitPolicyCredentialV3(input) {
|
|
4175
|
+
const policy = validateUnifiedPolicyV2(input.policy, input.policyCid);
|
|
4176
|
+
const nodeOrigin = policyNodeOrigin(input.nodeOrigin);
|
|
4177
|
+
const accountAuthorizationCid = nonEmpty(
|
|
4178
|
+
input.accountAuthorizationCid,
|
|
4179
|
+
"account authorization CID"
|
|
4180
|
+
);
|
|
4181
|
+
const credentialSpaceId = nonEmpty(
|
|
4182
|
+
input.credentialSpaceId,
|
|
4183
|
+
"credential space ID"
|
|
4184
|
+
);
|
|
4185
|
+
const fetchFn = input.fetch ?? globalThis.fetch.bind(globalThis);
|
|
4186
|
+
const challenge = await requestPolicyChallengeV3({
|
|
4187
|
+
nodeOrigin,
|
|
4188
|
+
policyCid: input.policyCid,
|
|
4189
|
+
recipientDid: input.credential.holderDid,
|
|
4190
|
+
requestedCapabilities: input.requestedCapabilities,
|
|
4191
|
+
fetch: fetchFn
|
|
4192
|
+
});
|
|
4193
|
+
const presentation = await buildPolicyCredentialPresentationV3({
|
|
4194
|
+
...input,
|
|
4195
|
+
policy,
|
|
4196
|
+
challenge
|
|
4197
|
+
});
|
|
4198
|
+
const response = await fetchFn(
|
|
4199
|
+
new URL("/share/v3/policy/delegations", nodeOrigin),
|
|
4200
|
+
{
|
|
4201
|
+
method: "POST",
|
|
4202
|
+
redirect: "error",
|
|
4203
|
+
headers: { accept: "application/json", "content-type": "application/json" },
|
|
4204
|
+
body: JSON.stringify({
|
|
4205
|
+
policyCid: input.policyCid,
|
|
4206
|
+
challengeId: challenge.challengeId,
|
|
4207
|
+
nonce: challenge.nonce,
|
|
4208
|
+
requirement: validateCredentialRequirement(input.requirement),
|
|
4209
|
+
credential: envelopeFromVerified(input.credential),
|
|
4210
|
+
accountAuthorizationCid,
|
|
4211
|
+
credentialSpaceId,
|
|
4212
|
+
presentation
|
|
4213
|
+
})
|
|
4214
|
+
}
|
|
4215
|
+
);
|
|
4216
|
+
if (!response.ok) throw new Error(`policy delegation rejected (${response.status})`);
|
|
4217
|
+
const value = record(await response.json(), "policy delegation");
|
|
4218
|
+
if (value.admitted !== true || typeof value.sessionCid !== "string" || typeof value.authorization !== "string") {
|
|
4219
|
+
throw new Error("policy delegation response is invalid");
|
|
4220
|
+
}
|
|
4221
|
+
const session = parsePolicySessionUcan(value.authorization, [
|
|
4222
|
+
input.policyRootCid,
|
|
4223
|
+
input.enforcementRootCid
|
|
4224
|
+
]);
|
|
4225
|
+
const expectedAttenuation = compactAttenuationForPolicyCapabilities(
|
|
4226
|
+
input.requestedCapabilities
|
|
4227
|
+
);
|
|
4228
|
+
if (session.cid !== value.sessionCid || session.aud !== input.credential.holderDid || session.fact.policyCid !== input.policyCid || session.fact.recipientDid !== input.credential.holderDid || session.fact.policyDelegationCid !== input.policyRootCid || session.fact.enforcementDelegationCid !== input.enforcementRootCid || jcsCanonicalize(session.att) !== jcsCanonicalize(expectedAttenuation)) {
|
|
4229
|
+
throw new Error("policy delegation signed binding is invalid");
|
|
4230
|
+
}
|
|
4231
|
+
return Object.freeze({ challenge, presentation, session });
|
|
4232
|
+
}
|
|
3838
4233
|
export {
|
|
3839
4234
|
ATTESTED_ENFORCER_BINDING_V2_SCHEMA,
|
|
3840
4235
|
CONTENT_SOURCE_V1_DOMAIN,
|
|
@@ -3847,13 +4242,18 @@ export {
|
|
|
3847
4242
|
OWNER_NODE_ENDPOINT_SCHEMA,
|
|
3848
4243
|
POLICY_CAPABILITY_V1_DOMAIN,
|
|
3849
4244
|
POLICY_CAPABILITY_V1_SCHEMA,
|
|
4245
|
+
POLICY_CREDENTIAL_REQUIREMENT_V1_TYPE,
|
|
3850
4246
|
POLICY_ENFORCEMENT_DELEGATION_V2_SCHEMA,
|
|
3851
4247
|
POLICY_ENGINE_RECORD_SCHEMA,
|
|
4248
|
+
POLICY_PRESENTATION_V3_DOMAIN,
|
|
4249
|
+
POLICY_PRESENTATION_V3_SCHEMA,
|
|
3852
4250
|
POLICY_SCHEMA,
|
|
3853
4251
|
POLICY_SESSION_UCAN_V1_PROFILE,
|
|
3854
4252
|
POLICY_STATUS_SCHEMA,
|
|
3855
4253
|
POLICY_V1_DOMAIN,
|
|
3856
4254
|
POLICY_V1_SCHEMA,
|
|
4255
|
+
POLICY_V2_DOMAIN,
|
|
4256
|
+
POLICY_V2_SCHEMA,
|
|
3857
4257
|
POLICY_VERSION_V0,
|
|
3858
4258
|
PolicyAuthoringError,
|
|
3859
4259
|
PolicyCapabilityError,
|
|
@@ -3873,6 +4273,8 @@ export {
|
|
|
3873
4273
|
TRANSCRIPT_SHARE_BOOTSTRAP_SCHEMA,
|
|
3874
4274
|
UnsupportedSignatureSuiteError,
|
|
3875
4275
|
W3C_VC_CREDENTIAL_VERIFIER,
|
|
4276
|
+
admitPolicyCredentialV3,
|
|
4277
|
+
buildPolicyCredentialPresentationV3,
|
|
3876
4278
|
canonicalizePolicyCapability,
|
|
3877
4279
|
canonicalizeSignedObjectUnsigned,
|
|
3878
4280
|
canonicalizeUnifiedPolicyCapability,
|
|
@@ -3902,6 +4304,7 @@ export {
|
|
|
3902
4304
|
policyCidFromCanonicalBytes,
|
|
3903
4305
|
policyDigestHex,
|
|
3904
4306
|
policyIdForDigestHex,
|
|
4307
|
+
policyV2DigestHex,
|
|
3905
4308
|
projectUnifiedPolicyCapabilities,
|
|
3906
4309
|
projectUnifiedPolicyCapability,
|
|
3907
4310
|
renewPolicyRootStatusV3,
|
|
@@ -3909,12 +4312,14 @@ export {
|
|
|
3909
4312
|
revokePolicyRootV3,
|
|
3910
4313
|
serialize as serializeJcsJson,
|
|
3911
4314
|
signCompactUcanAuthorization,
|
|
4315
|
+
signCompactUcanRootAuthorization,
|
|
3912
4316
|
signedObjectIdFor,
|
|
3913
4317
|
toSignedObjectError,
|
|
3914
4318
|
unifiedNativeProjectionHashHex,
|
|
3915
4319
|
unifiedPolicyCapabilityContains,
|
|
3916
4320
|
unifiedPolicyCapabilityDigestHex,
|
|
3917
4321
|
unifiedPolicyCapabilityFromNative,
|
|
4322
|
+
validatePolicyCredentialRequirementV1,
|
|
3918
4323
|
validatePolicyEngineRecordSigned,
|
|
3919
4324
|
validatePolicyEngineRecordSignedShape,
|
|
3920
4325
|
validatePolicyEngineRecordUnsigned,
|
|
@@ -3924,6 +4329,7 @@ export {
|
|
|
3924
4329
|
validatePolicyStatusSignedShape,
|
|
3925
4330
|
validatePolicyStatusUnsigned,
|
|
3926
4331
|
validatePolicyUnsigned,
|
|
4332
|
+
validateUnifiedPolicyV2,
|
|
3927
4333
|
verifyPolicy,
|
|
3928
4334
|
verifyPolicyEngineRecord,
|
|
3929
4335
|
verifyPolicyEngineRecordForRequester,
|