@nextera.one/axis-server-sdk 0.7.1 → 0.9.1
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/README.md +2 -1
- package/dist/index.d.mts +56 -14
- package/dist/index.d.ts +56 -14
- package/dist/index.js +54 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1944,48 +1944,15 @@ var INTENT_REQUIREMENTS = {
|
|
|
1944
1944
|
"admin.*": ["admin"]
|
|
1945
1945
|
};
|
|
1946
1946
|
|
|
1947
|
-
// src/
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
for (const key of requiredStrings) {
|
|
1957
|
-
if (typeof frame[key] !== "string" || frame[key].length < 6) {
|
|
1958
|
-
return false;
|
|
1959
|
-
}
|
|
1960
|
-
}
|
|
1961
|
-
if (typeof frame.ts !== "number" || !Number.isFinite(frame.ts)) {
|
|
1962
|
-
return false;
|
|
1963
|
-
}
|
|
1964
|
-
if (frame.aud !== void 0 && (typeof frame.aud !== "string" || frame.aud.length === 0)) {
|
|
1965
|
-
return false;
|
|
1966
|
-
}
|
|
1967
|
-
if (!frame.sig || typeof frame.sig !== "object") {
|
|
1968
|
-
return false;
|
|
1969
|
-
}
|
|
1970
|
-
if (frame.sig.alg !== "EdDSA") {
|
|
1971
|
-
return false;
|
|
1972
|
-
}
|
|
1973
|
-
if (typeof frame.sig.kid !== "string" || frame.sig.kid.length < 8) {
|
|
1974
|
-
return false;
|
|
1975
|
-
}
|
|
1976
|
-
if (typeof frame.sig.value !== "string" || frame.sig.value.length < 32) {
|
|
1977
|
-
return false;
|
|
1978
|
-
}
|
|
1979
|
-
if (typeof frame.body !== "object" || frame.body === null) {
|
|
1980
|
-
return false;
|
|
1981
|
-
}
|
|
1982
|
-
return true;
|
|
1983
|
-
}
|
|
1984
|
-
function isTimestampValid(ts, skewSeconds = 120) {
|
|
1985
|
-
const now = Math.floor(Date.now() / 1e3);
|
|
1986
|
-
const diff = Math.abs(now - ts);
|
|
1987
|
-
return diff <= skewSeconds;
|
|
1988
|
-
}
|
|
1947
|
+
// src/risk/index.ts
|
|
1948
|
+
var RiskDecision = /* @__PURE__ */ ((RiskDecision2) => {
|
|
1949
|
+
RiskDecision2["ALLOW"] = "ALLOW";
|
|
1950
|
+
RiskDecision2["THROTTLE"] = "THROTTLE";
|
|
1951
|
+
RiskDecision2["STEP_UP"] = "STEP_UP";
|
|
1952
|
+
RiskDecision2["WITNESS"] = "WITNESS";
|
|
1953
|
+
RiskDecision2["DENY"] = "DENY";
|
|
1954
|
+
return RiskDecision2;
|
|
1955
|
+
})(RiskDecision || {});
|
|
1989
1956
|
|
|
1990
1957
|
// src/core/opcodes.ts
|
|
1991
1958
|
var AXIS_OPCODES = /* @__PURE__ */ new Set([
|
|
@@ -2106,6 +2073,49 @@ function resolveTimeout(intent) {
|
|
|
2106
2073
|
}
|
|
2107
2074
|
return DEFAULT_TIMEOUT;
|
|
2108
2075
|
}
|
|
2076
|
+
|
|
2077
|
+
// src/core/frame-validator.ts
|
|
2078
|
+
function validateFrameShape(frame) {
|
|
2079
|
+
if (!frame || typeof frame !== "object") {
|
|
2080
|
+
return false;
|
|
2081
|
+
}
|
|
2082
|
+
if (frame.v !== 1) {
|
|
2083
|
+
return false;
|
|
2084
|
+
}
|
|
2085
|
+
const requiredStrings = ["pid", "nonce", "actorId", "opcode"];
|
|
2086
|
+
for (const key of requiredStrings) {
|
|
2087
|
+
if (typeof frame[key] !== "string" || frame[key].length < 6) {
|
|
2088
|
+
return false;
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
if (typeof frame.ts !== "number" || !Number.isFinite(frame.ts)) {
|
|
2092
|
+
return false;
|
|
2093
|
+
}
|
|
2094
|
+
if (frame.aud !== void 0 && (typeof frame.aud !== "string" || frame.aud.length === 0)) {
|
|
2095
|
+
return false;
|
|
2096
|
+
}
|
|
2097
|
+
if (!frame.sig || typeof frame.sig !== "object") {
|
|
2098
|
+
return false;
|
|
2099
|
+
}
|
|
2100
|
+
if (frame.sig.alg !== "EdDSA") {
|
|
2101
|
+
return false;
|
|
2102
|
+
}
|
|
2103
|
+
if (typeof frame.sig.kid !== "string" || frame.sig.kid.length < 8) {
|
|
2104
|
+
return false;
|
|
2105
|
+
}
|
|
2106
|
+
if (typeof frame.sig.value !== "string" || frame.sig.value.length < 32) {
|
|
2107
|
+
return false;
|
|
2108
|
+
}
|
|
2109
|
+
if (typeof frame.body !== "object" || frame.body === null) {
|
|
2110
|
+
return false;
|
|
2111
|
+
}
|
|
2112
|
+
return true;
|
|
2113
|
+
}
|
|
2114
|
+
function isTimestampValid(ts, skewSeconds = 120) {
|
|
2115
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
2116
|
+
const diff = Math.abs(now - ts);
|
|
2117
|
+
return diff <= skewSeconds;
|
|
2118
|
+
}
|
|
2109
2119
|
export {
|
|
2110
2120
|
ATS1_HDR,
|
|
2111
2121
|
ATS1_SCHEMA,
|
|
@@ -2161,6 +2171,7 @@ export {
|
|
|
2161
2171
|
PROOF_NONE,
|
|
2162
2172
|
PROOF_WITNESS,
|
|
2163
2173
|
ProofType,
|
|
2174
|
+
RiskDecision,
|
|
2164
2175
|
Schema2002_PasskeyLoginOptionsRes,
|
|
2165
2176
|
Schema2011_PasskeyLoginVerifyReq,
|
|
2166
2177
|
Schema2012_PasskeyLoginVerifyRes,
|