@tinycloud/sdk-core 3.0.0-beta.10 → 3.0.0-beta.12
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/index.cjs +49 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +49 -2
- package/dist/index.js.map +1 -1
- package/dist/policy/index.cjs +3 -1
- package/dist/policy/index.cjs.map +1 -1
- package/dist/policy/index.js +3 -1
- package/dist/policy/index.js.map +1 -1
- package/package.json +2 -2
package/dist/policy/index.cjs
CHANGED
|
@@ -4156,6 +4156,7 @@ var RECOVERABLE = /* @__PURE__ */ new Set([
|
|
|
4156
4156
|
"ISSUER_UNREADY",
|
|
4157
4157
|
"OFFLINE",
|
|
4158
4158
|
"POPUP_BLOCKED",
|
|
4159
|
+
"PROOF_REJECTED",
|
|
4159
4160
|
"REQUEST_EXPIRED",
|
|
4160
4161
|
"SIGNATURE_REJECTED",
|
|
4161
4162
|
"UNSUPPORTED_PROFILE",
|
|
@@ -4174,6 +4175,7 @@ var CredentialError = class extends Error {
|
|
|
4174
4175
|
|
|
4175
4176
|
// src/credentials/requirement.ts
|
|
4176
4177
|
var ID = /^[a-z0-9][a-z0-9._-]{0,127}(?:\/v1)?$/;
|
|
4178
|
+
var CLAIM_NAME = /^[a-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
4177
4179
|
function validateCredentialRequirement(value) {
|
|
4178
4180
|
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential requirement is invalid");
|
|
4179
4181
|
const raw = value;
|
|
@@ -4187,7 +4189,7 @@ function validateCredentialRequirement(value) {
|
|
|
4187
4189
|
if (typeof raw.claims !== "object" || raw.claims === null || Array.isArray(raw.claims)) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential claims are invalid");
|
|
4188
4190
|
const claims = {};
|
|
4189
4191
|
for (const [key, value2] of Object.entries(raw.claims).sort(([a], [b]) => a.localeCompare(b))) {
|
|
4190
|
-
if (!
|
|
4192
|
+
if (!CLAIM_NAME.test(key) || typeof value2 !== "string" || value2.length === 0 || value2.length > 4096) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential claim is invalid");
|
|
4191
4193
|
claims[key] = value2;
|
|
4192
4194
|
}
|
|
4193
4195
|
if (raw.maxAgeSeconds !== void 0 && (!Number.isSafeInteger(raw.maxAgeSeconds) || raw.maxAgeSeconds < 1)) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential freshness is invalid");
|