@nextera.one/axis-server-sdk 1.6.0 → 1.7.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/index.d.mts +159 -141
- package/dist/index.d.ts +159 -141
- package/dist/index.js +109 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -83
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4063,6 +4063,88 @@ AxisSensorChainService = __decorateClass([
|
|
|
4063
4063
|
Injectable7()
|
|
4064
4064
|
], AxisSensorChainService);
|
|
4065
4065
|
|
|
4066
|
+
// src/utils/axis-tlv-codec.ts
|
|
4067
|
+
function encodeAxisTlvDto(dtoClass, data) {
|
|
4068
|
+
const schema = extractDtoSchema(dtoClass);
|
|
4069
|
+
const items = schema.fields.flatMap((field) => {
|
|
4070
|
+
const value = data[field.name];
|
|
4071
|
+
if (value === void 0 || value === null) {
|
|
4072
|
+
if (field.required) {
|
|
4073
|
+
throw new Error(`Missing required TLV response field: ${field.name}`);
|
|
4074
|
+
}
|
|
4075
|
+
return [];
|
|
4076
|
+
}
|
|
4077
|
+
return [{ type: field.tag, value: encodeField(field, value) }];
|
|
4078
|
+
});
|
|
4079
|
+
return buildTLVs(items);
|
|
4080
|
+
}
|
|
4081
|
+
function encodeField(field, value) {
|
|
4082
|
+
switch (field.kind) {
|
|
4083
|
+
case "utf8":
|
|
4084
|
+
return Buffer.from(String(value), "utf8");
|
|
4085
|
+
case "u64":
|
|
4086
|
+
return encodeU64(value);
|
|
4087
|
+
case "bytes":
|
|
4088
|
+
case "bytes16":
|
|
4089
|
+
return toBuffer(value);
|
|
4090
|
+
case "bool":
|
|
4091
|
+
return Buffer.from([value ? 1 : 0]);
|
|
4092
|
+
case "obj":
|
|
4093
|
+
case "arr":
|
|
4094
|
+
return Buffer.from(JSON.stringify(value), "utf8");
|
|
4095
|
+
default:
|
|
4096
|
+
return toBuffer(value);
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
4099
|
+
function encodeU64(value) {
|
|
4100
|
+
const encoded = Buffer.alloc(8);
|
|
4101
|
+
encoded.writeBigUInt64BE(
|
|
4102
|
+
typeof value === "bigint" ? value : BigInt(value)
|
|
4103
|
+
);
|
|
4104
|
+
return encoded;
|
|
4105
|
+
}
|
|
4106
|
+
function toBuffer(value) {
|
|
4107
|
+
if (Buffer.isBuffer(value)) {
|
|
4108
|
+
return value;
|
|
4109
|
+
}
|
|
4110
|
+
if (value instanceof Uint8Array) {
|
|
4111
|
+
return Buffer.from(value);
|
|
4112
|
+
}
|
|
4113
|
+
if (typeof value === "string") {
|
|
4114
|
+
return Buffer.from(value, "utf8");
|
|
4115
|
+
}
|
|
4116
|
+
throw new Error(`Unsupported TLV bytes value: ${typeof value}`);
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
// src/loom/loom.types.ts
|
|
4120
|
+
function deriveAnchorReflection(softid, context = "openlogs", scope = "loom") {
|
|
4121
|
+
return `ar:${context}:${scope}:${softid}`;
|
|
4122
|
+
}
|
|
4123
|
+
function canonicalizeWrit(writ) {
|
|
4124
|
+
const ordered = {
|
|
4125
|
+
head: { tid: writ.head.tid, seq: writ.head.seq },
|
|
4126
|
+
body: {
|
|
4127
|
+
who: writ.body.who,
|
|
4128
|
+
act: writ.body.act,
|
|
4129
|
+
res: writ.body.res,
|
|
4130
|
+
law: writ.body.law
|
|
4131
|
+
},
|
|
4132
|
+
meta: { iat: writ.meta.iat, exp: writ.meta.exp, prev: writ.meta.prev }
|
|
4133
|
+
};
|
|
4134
|
+
return JSON.stringify(ordered);
|
|
4135
|
+
}
|
|
4136
|
+
function canonicalizeGrant(grant) {
|
|
4137
|
+
const ordered = {
|
|
4138
|
+
grant_id: grant.grant_id,
|
|
4139
|
+
issuer: grant.issuer,
|
|
4140
|
+
subject: grant.subject,
|
|
4141
|
+
grant_type: grant.grant_type,
|
|
4142
|
+
caps: grant.caps,
|
|
4143
|
+
meta: grant.meta
|
|
4144
|
+
};
|
|
4145
|
+
return JSON.stringify(ordered);
|
|
4146
|
+
}
|
|
4147
|
+
|
|
4066
4148
|
// src/cce/index.ts
|
|
4067
4149
|
var cce_exports = {};
|
|
4068
4150
|
__export(cce_exports, {
|
|
@@ -5110,12 +5192,22 @@ __export(engine_exports, {
|
|
|
5110
5192
|
PRE_DECODE_BOUNDARY: () => PRE_DECODE_BOUNDARY,
|
|
5111
5193
|
SensorDiscoveryService: () => SensorDiscoveryService,
|
|
5112
5194
|
SensorRegistry: () => SensorRegistry,
|
|
5195
|
+
buildQueueMessage: () => buildQueueMessage,
|
|
5196
|
+
buildUnsignedWitness: () => buildUnsignedWitness,
|
|
5197
|
+
canonicalizeObservation: () => canonicalizeObservation,
|
|
5113
5198
|
createObservation: () => createObservation,
|
|
5199
|
+
decodeQueueMessage: () => decodeQueueMessage,
|
|
5200
|
+
encodeQueueMessage: () => encodeQueueMessage,
|
|
5114
5201
|
endStage: () => endStage,
|
|
5115
5202
|
finalizeObservation: () => finalizeObservation,
|
|
5203
|
+
hashObservation: () => hashObservation,
|
|
5116
5204
|
observation: () => observation_exports,
|
|
5205
|
+
parseAutoClaimEntries: () => parseAutoClaimEntries,
|
|
5206
|
+
parseStreamEntries: () => parseStreamEntries,
|
|
5117
5207
|
recordSensor: () => recordSensor,
|
|
5118
|
-
|
|
5208
|
+
stableJsonStringify: () => stableJsonStringify,
|
|
5209
|
+
startStage: () => startStage,
|
|
5210
|
+
verifyResponse: () => verifyResponse
|
|
5119
5211
|
});
|
|
5120
5212
|
|
|
5121
5213
|
// src/engine/observation/index.ts
|
|
@@ -5145,35 +5237,6 @@ __export(loom_exports, {
|
|
|
5145
5237
|
deriveAnchorReflection: () => deriveAnchorReflection
|
|
5146
5238
|
});
|
|
5147
5239
|
|
|
5148
|
-
// src/loom/loom.types.ts
|
|
5149
|
-
function deriveAnchorReflection(softid, context = "openlogs", scope = "loom") {
|
|
5150
|
-
return `ar:${context}:${scope}:${softid}`;
|
|
5151
|
-
}
|
|
5152
|
-
function canonicalizeWrit(writ) {
|
|
5153
|
-
const ordered = {
|
|
5154
|
-
head: { tid: writ.head.tid, seq: writ.head.seq },
|
|
5155
|
-
body: {
|
|
5156
|
-
who: writ.body.who,
|
|
5157
|
-
act: writ.body.act,
|
|
5158
|
-
res: writ.body.res,
|
|
5159
|
-
law: writ.body.law
|
|
5160
|
-
},
|
|
5161
|
-
meta: { iat: writ.meta.iat, exp: writ.meta.exp, prev: writ.meta.prev }
|
|
5162
|
-
};
|
|
5163
|
-
return JSON.stringify(ordered);
|
|
5164
|
-
}
|
|
5165
|
-
function canonicalizeGrant(grant) {
|
|
5166
|
-
const ordered = {
|
|
5167
|
-
grant_id: grant.grant_id,
|
|
5168
|
-
issuer: grant.issuer,
|
|
5169
|
-
subject: grant.subject,
|
|
5170
|
-
grant_type: grant.grant_type,
|
|
5171
|
-
caps: grant.caps,
|
|
5172
|
-
meta: grant.meta
|
|
5173
|
-
};
|
|
5174
|
-
return JSON.stringify(ordered);
|
|
5175
|
-
}
|
|
5176
|
-
|
|
5177
5240
|
// src/schemas/index.ts
|
|
5178
5241
|
var schemas_exports = {};
|
|
5179
5242
|
__export(schemas_exports, {
|
|
@@ -7184,59 +7247,6 @@ var utils_exports = {};
|
|
|
7184
7247
|
__export(utils_exports, {
|
|
7185
7248
|
encodeAxisTlvDto: () => encodeAxisTlvDto
|
|
7186
7249
|
});
|
|
7187
|
-
|
|
7188
|
-
// src/utils/axis-tlv-codec.ts
|
|
7189
|
-
function encodeAxisTlvDto(dtoClass, data) {
|
|
7190
|
-
const schema = extractDtoSchema(dtoClass);
|
|
7191
|
-
const items = schema.fields.flatMap((field) => {
|
|
7192
|
-
const value = data[field.name];
|
|
7193
|
-
if (value === void 0 || value === null) {
|
|
7194
|
-
if (field.required) {
|
|
7195
|
-
throw new Error(`Missing required TLV response field: ${field.name}`);
|
|
7196
|
-
}
|
|
7197
|
-
return [];
|
|
7198
|
-
}
|
|
7199
|
-
return [{ type: field.tag, value: encodeField(field, value) }];
|
|
7200
|
-
});
|
|
7201
|
-
return buildTLVs(items);
|
|
7202
|
-
}
|
|
7203
|
-
function encodeField(field, value) {
|
|
7204
|
-
switch (field.kind) {
|
|
7205
|
-
case "utf8":
|
|
7206
|
-
return Buffer.from(String(value), "utf8");
|
|
7207
|
-
case "u64":
|
|
7208
|
-
return encodeU64(value);
|
|
7209
|
-
case "bytes":
|
|
7210
|
-
case "bytes16":
|
|
7211
|
-
return toBuffer(value);
|
|
7212
|
-
case "bool":
|
|
7213
|
-
return Buffer.from([value ? 1 : 0]);
|
|
7214
|
-
case "obj":
|
|
7215
|
-
case "arr":
|
|
7216
|
-
return Buffer.from(JSON.stringify(value), "utf8");
|
|
7217
|
-
default:
|
|
7218
|
-
return toBuffer(value);
|
|
7219
|
-
}
|
|
7220
|
-
}
|
|
7221
|
-
function encodeU64(value) {
|
|
7222
|
-
const encoded = Buffer.alloc(8);
|
|
7223
|
-
encoded.writeBigUInt64BE(
|
|
7224
|
-
typeof value === "bigint" ? value : BigInt(value)
|
|
7225
|
-
);
|
|
7226
|
-
return encoded;
|
|
7227
|
-
}
|
|
7228
|
-
function toBuffer(value) {
|
|
7229
|
-
if (Buffer.isBuffer(value)) {
|
|
7230
|
-
return value;
|
|
7231
|
-
}
|
|
7232
|
-
if (value instanceof Uint8Array) {
|
|
7233
|
-
return Buffer.from(value);
|
|
7234
|
-
}
|
|
7235
|
-
if (typeof value === "string") {
|
|
7236
|
-
return Buffer.from(value, "utf8");
|
|
7237
|
-
}
|
|
7238
|
-
throw new Error(`Unsupported TLV bytes value: ${typeof value}`);
|
|
7239
|
-
}
|
|
7240
7250
|
export {
|
|
7241
7251
|
ATS1_HDR,
|
|
7242
7252
|
ATS1_SCHEMA,
|
|
@@ -7326,6 +7336,7 @@ export {
|
|
|
7326
7336
|
RESPONSE_TAG_ID,
|
|
7327
7337
|
RESPONSE_TAG_UPDATED_AT,
|
|
7328
7338
|
RESPONSE_TAG_UPDATED_BY,
|
|
7339
|
+
verifyResponse as ResponseObserver,
|
|
7329
7340
|
RiskDecision,
|
|
7330
7341
|
SENSOR_METADATA_KEY,
|
|
7331
7342
|
Schema2002_PasskeyLoginOptionsRes,
|
|
@@ -7359,6 +7370,7 @@ export {
|
|
|
7359
7370
|
TLV_OFFSET,
|
|
7360
7371
|
TLV_OK,
|
|
7361
7372
|
TLV_PID,
|
|
7373
|
+
TLV_LOOM_PRESENCE_ID as TLV_PRESENCE_ID,
|
|
7362
7374
|
TLV_PREV_HASH,
|
|
7363
7375
|
TLV_PROOF_REF,
|
|
7364
7376
|
TLV_PROOF_TYPE,
|
|
@@ -7366,10 +7378,12 @@ export {
|
|
|
7366
7378
|
TLV_RECEIPT_HASH,
|
|
7367
7379
|
TLV_RID,
|
|
7368
7380
|
TLV_SHA256_CHUNK,
|
|
7381
|
+
TLV_LOOM_THREAD_HASH as TLV_THREAD_HASH,
|
|
7369
7382
|
TLV_TRACE_ID,
|
|
7370
7383
|
TLV_TS,
|
|
7371
7384
|
TLV_UPLOAD_ID,
|
|
7372
7385
|
TLV_VALIDATORS_KEY,
|
|
7386
|
+
TLV_LOOM_WRIT as TLV_WRIT,
|
|
7373
7387
|
TlvEnum,
|
|
7374
7388
|
TlvField,
|
|
7375
7389
|
TlvMinLen,
|
|
@@ -7392,7 +7406,9 @@ export {
|
|
|
7392
7406
|
canAccessResource,
|
|
7393
7407
|
canonicalJson,
|
|
7394
7408
|
canonicalJsonExcluding,
|
|
7409
|
+
canonicalizeGrant,
|
|
7395
7410
|
canonicalizeObservation,
|
|
7411
|
+
canonicalizeWrit,
|
|
7396
7412
|
cce_exports as cce,
|
|
7397
7413
|
classifyIntent,
|
|
7398
7414
|
computeReceiptHash,
|
|
@@ -7409,8 +7425,10 @@ export {
|
|
|
7409
7425
|
decodeTLVsList,
|
|
7410
7426
|
decodeVarint,
|
|
7411
7427
|
decorators_exports as decorators,
|
|
7428
|
+
deriveAnchorReflection,
|
|
7412
7429
|
encVarint,
|
|
7413
7430
|
encodeAxis1Frame,
|
|
7431
|
+
encodeAxisTlvDto,
|
|
7414
7432
|
encodeFrame,
|
|
7415
7433
|
encodeQueueMessage,
|
|
7416
7434
|
encodeTLVs,
|