@helm-protocol/ttt-mcp 0.4.4 → 0.4.5

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.
@@ -21,6 +21,8 @@ __export(pot_record_v2_exports, {
21
21
  HOLDER_AUTH_ED25519: () => HOLDER_AUTH_ED25519,
22
22
  HOLDER_AUTH_SHARED_SECRET: () => HOLDER_AUTH_SHARED_SECRET,
23
23
  POT_V2_INTEGRITY_SHA256: () => POT_V2_INTEGRITY_SHA256,
24
+ POT_V2_ISSUER_SIGNATURE_SIZE: () => POT_V2_ISSUER_SIGNATURE_SIZE,
25
+ POT_V2_SIGNED_PREFIX_SIZE: () => POT_V2_SIGNED_PREFIX_SIZE,
24
26
  POT_V2_SIZE: () => POT_V2_SIZE,
25
27
  POT_V2_VERSION: () => POT_V2_VERSION,
26
28
  computeV2BindingInput: () => computeV2BindingInput,
@@ -35,6 +37,8 @@ var import_crypto = require("crypto");
35
37
  const POT_V2_SIZE = 180;
36
38
  const POT_V2_VERSION = 2;
37
39
  const POT_V2_INTEGRITY_SHA256 = 1;
40
+ const POT_V2_SIGNED_PREFIX_SIZE = 116;
41
+ const POT_V2_ISSUER_SIGNATURE_SIZE = 64;
38
42
  const HOLDER_AUTH_ED25519 = 1;
39
43
  const HOLDER_AUTH_SHARED_SECRET = 2;
40
44
  const OFF = {
@@ -72,7 +76,7 @@ function encodePotRecordV2(fields, issuerPrivateKey) {
72
76
  requireLength("ctx_id", fields.ctxId, 16);
73
77
  requireLength("nonce", fields.nonce, 16);
74
78
  requireLength("holder_auth_data", fields.holderAuthData, 32);
75
- const prefix = Buffer.alloc(116);
79
+ const prefix = Buffer.alloc(POT_V2_SIGNED_PREFIX_SIZE);
76
80
  prefix.writeUInt8(POT_V2_VERSION, OFF.VERSION);
77
81
  prefix.writeUInt8(fields.holderAuthType, OFF.HOLDER_AUTH_TYPE);
78
82
  prefix.writeUInt16BE(fields.algId, OFF.ALG_ID);
@@ -88,7 +92,9 @@ function encodePotRecordV2(fields, issuerPrivateKey) {
88
92
  }
89
93
  function decodePotRecordV2(record) {
90
94
  if (record.length !== POT_V2_SIZE) throw new Error(`expected 180 octets, got ${record.length}`);
91
- const signedPrefix = record.subarray(0, 116);
95
+ const signedPrefix = record.subarray(0, POT_V2_SIGNED_PREFIX_SIZE);
96
+ const issuerSig = record.subarray(POT_V2_SIGNED_PREFIX_SIZE, POT_V2_SIZE);
97
+ requireLength("issuer signature", issuerSig, POT_V2_ISSUER_SIGNATURE_SIZE);
92
98
  return {
93
99
  holderAuthType: record.readUInt8(OFF.HOLDER_AUTH_TYPE),
94
100
  algId: record.readUInt16BE(OFF.ALG_ID),
@@ -99,7 +105,7 @@ function decodePotRecordV2(record) {
99
105
  holderAuthData: Buffer.from(record.subarray(OFF.HOLDER_AUTH_DATA, OFF.HOLDER_AUTH_DATA + 32)),
100
106
  issuerKeyId: record.readUInt32BE(OFF.ISSUER_KEY_ID),
101
107
  integrityTag: Buffer.from(record.subarray(OFF.INTEGRITY_TAG, OFF.INTEGRITY_TAG + 32)),
102
- issuerSig: Buffer.from(record.subarray(OFF.ISSUER_SIG, POT_V2_SIZE)),
108
+ issuerSig: Buffer.from(issuerSig),
103
109
  signedPrefix: Buffer.from(signedPrefix)
104
110
  };
105
111
  }
@@ -163,6 +169,8 @@ function verifyPotRecordV2(record, issuerPublicKeyRaw, freshness) {
163
169
  HOLDER_AUTH_ED25519,
164
170
  HOLDER_AUTH_SHARED_SECRET,
165
171
  POT_V2_INTEGRITY_SHA256,
172
+ POT_V2_ISSUER_SIGNATURE_SIZE,
173
+ POT_V2_SIGNED_PREFIX_SIZE,
166
174
  POT_V2_SIZE,
167
175
  POT_V2_VERSION,
168
176
  computeV2BindingInput,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helm-protocol/ttt-mcp",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Proof-of-Time attestation — Ed25519-signed timestamps with multi-source corroboration and explicit error bounds. IETF draft-helmprotocol-tttps",
5
5
  "main": "dist/index.js",
6
6
  "bin": {