@tinycloud/sdk-core 3.0.0-beta.11 → 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 +47 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +47 -2
- package/dist/index.js.map +1 -1
- package/dist/policy/index.cjs +2 -1
- package/dist/policy/index.cjs.map +1 -1
- package/dist/policy/index.js +2 -1
- package/dist/policy/index.js.map +1 -1
- package/package.json +2 -2
package/dist/policy/index.js
CHANGED
|
@@ -4043,6 +4043,7 @@ var CredentialError = class extends Error {
|
|
|
4043
4043
|
|
|
4044
4044
|
// src/credentials/requirement.ts
|
|
4045
4045
|
var ID = /^[a-z0-9][a-z0-9._-]{0,127}(?:\/v1)?$/;
|
|
4046
|
+
var CLAIM_NAME = /^[a-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
4046
4047
|
function validateCredentialRequirement(value) {
|
|
4047
4048
|
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential requirement is invalid");
|
|
4048
4049
|
const raw = value;
|
|
@@ -4056,7 +4057,7 @@ function validateCredentialRequirement(value) {
|
|
|
4056
4057
|
if (typeof raw.claims !== "object" || raw.claims === null || Array.isArray(raw.claims)) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential claims are invalid");
|
|
4057
4058
|
const claims = {};
|
|
4058
4059
|
for (const [key, value2] of Object.entries(raw.claims).sort(([a], [b]) => a.localeCompare(b))) {
|
|
4059
|
-
if (!
|
|
4060
|
+
if (!CLAIM_NAME.test(key) || typeof value2 !== "string" || value2.length === 0 || value2.length > 4096) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential claim is invalid");
|
|
4060
4061
|
claims[key] = value2;
|
|
4061
4062
|
}
|
|
4062
4063
|
if (raw.maxAgeSeconds !== void 0 && (!Number.isSafeInteger(raw.maxAgeSeconds) || raw.maxAgeSeconds < 1)) throw new CredentialError("UNSUPPORTED_PROFILE", "Credential freshness is invalid");
|