@atbash/sdk 0.10.0-dev.0 → 0.10.1-dev.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.mjs CHANGED
@@ -2899,6 +2899,9 @@ function chainForNetwork(network) {
2899
2899
  }
2900
2900
 
2901
2901
  // src-ts/encrypted-toolcall.ts
2902
+ function columnAad(toolCallId, column) {
2903
+ return `${toolCallId}:${column}`;
2904
+ }
2902
2905
  function normalizeActionForHash(action) {
2903
2906
  return native.normalizeActionForHash(action);
2904
2907
  }
@@ -42940,6 +42943,44 @@ function encryptedLength(plaintextByteLength) {
42940
42943
  return native.encryptedLength(plaintextByteLength);
42941
42944
  }
42942
42945
 
42946
+ // src-ts/crypto/envelope.ts
42947
+ var PREFIX = "atb1";
42948
+ var SEPARATOR = ".";
42949
+ function toBase64(bytes) {
42950
+ let binary = "";
42951
+ for (const b of bytes) binary += String.fromCharCode(b);
42952
+ return btoa(binary);
42953
+ }
42954
+ function fromBase64(text) {
42955
+ const binary = atob(text);
42956
+ const out = new Uint8Array(binary.length);
42957
+ for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i);
42958
+ return out;
42959
+ }
42960
+ function packEnvelope(payload, keyFingerprint = "", claimHash = "") {
42961
+ return [PREFIX, keyFingerprint, claimHash, toBase64(payload)].join(SEPARATOR);
42962
+ }
42963
+ function fieldWidthOk(value, hexChars) {
42964
+ return value.length === 0 ? true : value.length === hexChars && /^[0-9a-f]+$/.test(value);
42965
+ }
42966
+ function isEnvelope(value) {
42967
+ if (typeof value !== "string" || !value.startsWith(PREFIX + SEPARATOR)) return false;
42968
+ const parts = value.split(SEPARATOR);
42969
+ return parts.length >= 4 && fieldWidthOk(parts[1], 16) && fieldWidthOk(parts[2], 64);
42970
+ }
42971
+ function parseEnvelope(value) {
42972
+ if (!isEnvelope(value)) return null;
42973
+ const [, keyFingerprint, claimHash, ...rest] = value.split(SEPARATOR);
42974
+ try {
42975
+ return { keyFingerprint, claimHash, payload: fromBase64(rest.join(SEPARATOR)) };
42976
+ } catch {
42977
+ return null;
42978
+ }
42979
+ }
42980
+ function keyFingerprintOf(pubKeyHex) {
42981
+ return pubKeyHex.trim().replace(/^0x/i, "").toLowerCase().slice(0, 16);
42982
+ }
42983
+
42943
42984
  // src-ts/index.ts
42944
42985
  function isValidPrivateKey(hex) {
42945
42986
  return native.isValidPrivateKey(hex);
@@ -43012,6 +43053,7 @@ export {
43012
43053
  claimHashHex,
43013
43054
  classifyMemoryRead,
43014
43055
  classifyMemoryWrite,
43056
+ columnAad,
43015
43057
  commitMemoryVersion,
43016
43058
  containsEvasionCharacters,
43017
43059
  containsSecret,
@@ -43039,7 +43081,9 @@ export {
43039
43081
  getMemoryHistory,
43040
43082
  getRollbackHistory,
43041
43083
  guardMemoryWrite,
43084
+ isEnvelope,
43042
43085
  isValidPrivateKey,
43086
+ keyFingerprintOf,
43043
43087
  loadAgent,
43044
43088
  loadAgentFromFile,
43045
43089
  loadUserConfig,
@@ -43047,6 +43091,8 @@ export {
43047
43091
  normalizeForMatching,
43048
43092
  normalizeStatus,
43049
43093
  normalizeVerdict,
43094
+ packEnvelope,
43095
+ parseEnvelope,
43050
43096
  pubkeyToHex,
43051
43097
  recordCall,
43052
43098
  recordDuration,