@tinycloud/sdk-core 3.1.0-beta.1 → 3.1.0-beta.3
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/delegations/index.cjs.map +1 -1
- package/dist/delegations/index.js.map +1 -1
- package/dist/index.cjs +51 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -5
- package/dist/index.d.ts +12 -5
- package/dist/index.js +56 -24
- package/dist/index.js.map +1 -1
- package/dist/policy/index.cjs +9 -6
- package/dist/policy/index.cjs.map +1 -1
- package/dist/policy/index.js +9 -6
- package/dist/policy/index.js.map +1 -1
- package/package.json +2 -2
package/dist/policy/index.cjs
CHANGED
|
@@ -3499,6 +3499,9 @@ async function renewPolicyRootStatusV3(input) {
|
|
|
3499
3499
|
if (!response.ok) throw new Error(`policy root renewal rejected (${response.status})`);
|
|
3500
3500
|
return object(await response.json(), "policy root renewal");
|
|
3501
3501
|
}
|
|
3502
|
+
function rfc3339Seconds(value) {
|
|
3503
|
+
return new Date(Math.floor(value.getTime() / 1e3) * 1e3).toISOString().replace(/\.000Z$/, "Z");
|
|
3504
|
+
}
|
|
3502
3505
|
async function revokePolicyRootV3(input) {
|
|
3503
3506
|
if (input.reason.length === 0) throw new Error("policy root revocation reason is required");
|
|
3504
3507
|
const unsigned = {
|
|
@@ -3507,7 +3510,7 @@ async function revokePolicyRootV3(input) {
|
|
|
3507
3510
|
targetRole: input.targetRole,
|
|
3508
3511
|
ownerDid: input.ownerDid,
|
|
3509
3512
|
nodeAudience: input.nodeAudience,
|
|
3510
|
-
revokedAt: (input.now ?? /* @__PURE__ */ new Date())
|
|
3513
|
+
revokedAt: rfc3339Seconds(input.now ?? /* @__PURE__ */ new Date()),
|
|
3511
3514
|
reason: input.reason,
|
|
3512
3515
|
issuerDid: input.issuerDid
|
|
3513
3516
|
};
|
|
@@ -4329,7 +4332,7 @@ function date(value, label) {
|
|
|
4329
4332
|
if (!Number.isFinite(Date.parse(text))) throw new Error(`${label} is invalid`);
|
|
4330
4333
|
return text;
|
|
4331
4334
|
}
|
|
4332
|
-
function
|
|
4335
|
+
function rfc3339Seconds2(value) {
|
|
4333
4336
|
return new Date(Math.floor(value.getTime() / 1e3) * 1e3).toISOString().replace(/\.000Z$/, "Z");
|
|
4334
4337
|
}
|
|
4335
4338
|
function validateUnifiedPolicyV2(value, expectedPolicyCid) {
|
|
@@ -4494,8 +4497,8 @@ async function buildPolicyCredentialPresentationV4(input) {
|
|
|
4494
4497
|
requirementDigest,
|
|
4495
4498
|
descriptorDigest: input.credential.descriptorDigest,
|
|
4496
4499
|
requestedCapabilities: Object.freeze(requestedCapabilities),
|
|
4497
|
-
issuedAt:
|
|
4498
|
-
expiresAt:
|
|
4500
|
+
issuedAt: rfc3339Seconds2(now),
|
|
4501
|
+
expiresAt: rfc3339Seconds2(new Date(expiresAtMs))
|
|
4499
4502
|
}), input.sign);
|
|
4500
4503
|
}
|
|
4501
4504
|
async function buildPolicyCredentialPresentationV3(input) {
|
|
@@ -4549,8 +4552,8 @@ async function buildPolicyCredentialPresentationV3(input) {
|
|
|
4549
4552
|
requirementDigest,
|
|
4550
4553
|
descriptorDigest: input.credential.descriptorDigest,
|
|
4551
4554
|
requestedCapabilities: Object.freeze(requestedCapabilities),
|
|
4552
|
-
issuedAt:
|
|
4553
|
-
expiresAt:
|
|
4555
|
+
issuedAt: rfc3339Seconds2(now),
|
|
4556
|
+
expiresAt: rfc3339Seconds2(new Date(expiresAtMs))
|
|
4554
4557
|
});
|
|
4555
4558
|
const digest2 = (0, import_sha2562.sha256)(
|
|
4556
4559
|
new TextEncoder().encode(
|