@nextera.one/axis-server-sdk 1.5.0 → 1.6.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
@@ -405,6 +405,626 @@ var SensorDecisions = {
405
405
  }
406
406
  };
407
407
 
408
+ // src/cce/cce-derivation.service.ts
409
+ import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js";
410
+ import { hkdf } from "@noble/hashes/hkdf.js";
411
+ import { sha256 } from "@noble/hashes/sha2.js";
412
+
413
+ // src/cce/cce.types.ts
414
+ var CCE_PROTOCOL_VERSION = "cce-v1";
415
+ var CCE_DERIVATION = {
416
+ /** Request execution context */
417
+ REQUEST: "axis:cce:req:v1",
418
+ /** Response execution context */
419
+ RESPONSE: "axis:cce:resp:v1",
420
+ /** Witness binding context */
421
+ WITNESS: "axis:cce:witness:v1"
422
+ };
423
+ var CCE_AES_KEY_BYTES = 32;
424
+ var CCE_IV_BYTES = 12;
425
+ var CCE_TAG_BYTES = 16;
426
+ var CCE_NONCE_BYTES = 32;
427
+ var CCE_ERROR = {
428
+ // Envelope errors
429
+ INVALID_ENVELOPE: "CCE_INVALID_ENVELOPE",
430
+ UNSUPPORTED_VERSION: "CCE_UNSUPPORTED_VERSION",
431
+ MISSING_CAPSULE: "CCE_MISSING_CAPSULE",
432
+ MISSING_ENCRYPTED_KEY: "CCE_MISSING_ENCRYPTED_KEY",
433
+ // Signature errors
434
+ CLIENT_SIG_INVALID: "CCE_CLIENT_SIG_INVALID",
435
+ CLIENT_KEY_NOT_FOUND: "CCE_CLIENT_KEY_NOT_FOUND",
436
+ // Capsule errors
437
+ CAPSULE_SIG_INVALID: "CCE_CAPSULE_SIG_INVALID",
438
+ CAPSULE_EXPIRED: "CCE_CAPSULE_EXPIRED",
439
+ CAPSULE_NOT_YET_VALID: "CCE_CAPSULE_NOT_YET_VALID",
440
+ CAPSULE_REVOKED: "CCE_CAPSULE_REVOKED",
441
+ CAPSULE_CONSUMED: "CCE_CAPSULE_CONSUMED",
442
+ // Binding errors
443
+ AUDIENCE_MISMATCH: "CCE_AUDIENCE_MISMATCH",
444
+ INTENT_MISMATCH: "CCE_INTENT_MISMATCH",
445
+ TPS_WINDOW_EXPIRED: "CCE_TPS_WINDOW_EXPIRED",
446
+ TPS_WINDOW_FUTURE: "CCE_TPS_WINDOW_FUTURE",
447
+ // Replay / nonce errors
448
+ REPLAY_DETECTED: "CCE_REPLAY_DETECTED",
449
+ NONCE_REUSED: "CCE_NONCE_REUSED",
450
+ // Decryption errors
451
+ DECRYPTION_FAILED: "CCE_DECRYPTION_FAILED",
452
+ KEY_UNWRAP_FAILED: "CCE_KEY_UNWRAP_FAILED",
453
+ AEAD_TAG_MISMATCH: "CCE_AEAD_TAG_MISMATCH",
454
+ PAYLOAD_TOO_LARGE: "CCE_PAYLOAD_TOO_LARGE",
455
+ // Schema / validation errors
456
+ PAYLOAD_SCHEMA_INVALID: "CCE_PAYLOAD_SCHEMA_INVALID",
457
+ INTENT_SCHEMA_MISMATCH: "CCE_INTENT_SCHEMA_MISMATCH",
458
+ // Policy errors
459
+ POLICY_DENIED: "CCE_POLICY_DENIED",
460
+ CONSTRAINT_VIOLATED: "CCE_CONSTRAINT_VIOLATED",
461
+ // Handler errors
462
+ HANDLER_NOT_FOUND: "CCE_HANDLER_NOT_FOUND",
463
+ HANDLER_EXECUTION_FAILED: "CCE_HANDLER_EXECUTION_FAILED",
464
+ HANDLER_TIMEOUT: "CCE_HANDLER_TIMEOUT",
465
+ // Response errors
466
+ RESPONSE_ENCRYPTION_FAILED: "CCE_RESPONSE_ENCRYPTION_FAILED"
467
+ };
468
+ var CceError = class extends Error {
469
+ constructor(code, message, metadata) {
470
+ super(`[${code}] ${message}`);
471
+ this.code = code;
472
+ this.metadata = metadata;
473
+ this.name = "CceError";
474
+ }
475
+ /** Whether this error is safe to expose to the client */
476
+ get clientSafe() {
477
+ const internal = [
478
+ CCE_ERROR.DECRYPTION_FAILED,
479
+ CCE_ERROR.KEY_UNWRAP_FAILED,
480
+ CCE_ERROR.AEAD_TAG_MISMATCH,
481
+ CCE_ERROR.HANDLER_EXECUTION_FAILED,
482
+ CCE_ERROR.RESPONSE_ENCRYPTION_FAILED
483
+ ];
484
+ return !internal.includes(this.code);
485
+ }
486
+ /** Get client-safe representation */
487
+ toClientError() {
488
+ if (this.clientSafe) {
489
+ return { code: this.code, message: this.message };
490
+ }
491
+ return {
492
+ code: CCE_ERROR.DECRYPTION_FAILED,
493
+ message: "Request processing failed"
494
+ };
495
+ }
496
+ };
497
+
498
+ // src/cce/cce-derivation.service.ts
499
+ function buildSalt(capsuleId, capsuleNonce, requestNonce) {
500
+ const encoder = new TextEncoder();
501
+ const data = encoder.encode(
502
+ capsuleId + "|" + capsuleNonce + "|" + requestNonce
503
+ );
504
+ return sha256(data);
505
+ }
506
+ function buildInfo(contextPrefix, capsule, extraNonce) {
507
+ const encoder = new TextEncoder();
508
+ const parts = [
509
+ contextPrefix,
510
+ capsule.sub,
511
+ capsule.kid,
512
+ capsule.intent,
513
+ capsule.aud,
514
+ String(capsule.tps_from),
515
+ String(capsule.tps_to),
516
+ capsule.policy_hash ?? "",
517
+ capsule.ver
518
+ ];
519
+ if (extraNonce) {
520
+ parts.push(extraNonce);
521
+ }
522
+ return encoder.encode(parts.join("|"));
523
+ }
524
+ function deriveRequestExecutionKey(input) {
525
+ const ikm = hexToBytes(input.axisLocalSecret);
526
+ const salt = buildSalt(
527
+ input.capsule.capsule_id,
528
+ input.capsule.capsule_nonce,
529
+ input.requestNonce
530
+ );
531
+ const info = buildInfo(CCE_DERIVATION.REQUEST, input.capsule);
532
+ return hkdf(sha256, ikm, salt, info, CCE_AES_KEY_BYTES);
533
+ }
534
+ function deriveResponseExecutionKey(input) {
535
+ const ikm = hexToBytes(input.axisLocalSecret);
536
+ const encoder = new TextEncoder();
537
+ const saltData = encoder.encode(
538
+ input.capsule.capsule_id + "|" + input.capsule.capsule_nonce + "|" + input.requestNonce + "|" + input.responseNonce
539
+ );
540
+ const salt = sha256(saltData);
541
+ const info = buildInfo(
542
+ CCE_DERIVATION.RESPONSE,
543
+ input.capsule,
544
+ input.responseNonce
545
+ );
546
+ return hkdf(sha256, ikm, salt, info, CCE_AES_KEY_BYTES);
547
+ }
548
+ function deriveWitnessKey(input) {
549
+ const ikm = hexToBytes(input.axisLocalSecret);
550
+ const salt = buildSalt(
551
+ input.capsule.capsule_id,
552
+ input.capsule.capsule_nonce,
553
+ input.requestNonce
554
+ );
555
+ const info = buildInfo(CCE_DERIVATION.WITNESS, input.capsule);
556
+ return hkdf(sha256, ikm, salt, info, CCE_AES_KEY_BYTES);
557
+ }
558
+ function buildExecutionContext(input, requestId) {
559
+ const executionKey = deriveRequestExecutionKey(input);
560
+ const keyHash = bytesToHex(sha256(executionKey));
561
+ executionKey.fill(0);
562
+ return {
563
+ execution_key_hash: keyHash,
564
+ request_id: requestId,
565
+ capsule_id: input.capsule.capsule_id,
566
+ sub: input.capsule.sub,
567
+ kid: input.capsule.kid,
568
+ intent: input.capsule.intent,
569
+ aud: input.capsule.aud,
570
+ tps_from: input.capsule.tps_from,
571
+ tps_to: input.capsule.tps_to,
572
+ policy_hash: input.capsule.policy_hash,
573
+ derived_at: Math.floor(Date.now() / 1e3),
574
+ valid: true
575
+ };
576
+ }
577
+ function generateCceNonce() {
578
+ const bytes2 = new Uint8Array(CCE_NONCE_BYTES);
579
+ crypto.getRandomValues(bytes2);
580
+ return bytesToHex(bytes2);
581
+ }
582
+
583
+ // src/cce/cce-response.service.ts
584
+ import { bytesToHex as bytesToHex3 } from "@noble/hashes/utils.js";
585
+ import { randomBytes as randomBytes2 } from "crypto";
586
+
587
+ // src/cce/cce-crypto.ts
588
+ import { bytesToHex as bytesToHex2 } from "@noble/hashes/utils.js";
589
+ import { sha256 as sha2562 } from "@noble/hashes/sha2.js";
590
+ import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
591
+ function aesGcmEncrypt(key, plaintext, aad) {
592
+ if (key.length !== CCE_AES_KEY_BYTES) {
593
+ throw new Error(`AES key must be ${CCE_AES_KEY_BYTES} bytes`);
594
+ }
595
+ const iv = randomBytes(CCE_IV_BYTES);
596
+ const cipher = createCipheriv("aes-256-gcm", key, iv);
597
+ if (aad) {
598
+ cipher.setAAD(aad);
599
+ }
600
+ const encrypted = Buffer.concat([cipher.update(plaintext), cipher.final()]);
601
+ const tag = cipher.getAuthTag();
602
+ return {
603
+ iv: new Uint8Array(iv),
604
+ ciphertext: new Uint8Array(encrypted),
605
+ tag: new Uint8Array(tag)
606
+ };
607
+ }
608
+ function aesGcmDecrypt(key, iv, ciphertext, tag, aad) {
609
+ if (key.length !== CCE_AES_KEY_BYTES) {
610
+ throw new Error(`AES key must be ${CCE_AES_KEY_BYTES} bytes`);
611
+ }
612
+ if (iv.length !== CCE_IV_BYTES) {
613
+ throw new Error(`IV must be ${CCE_IV_BYTES} bytes`);
614
+ }
615
+ if (tag.length !== CCE_TAG_BYTES) {
616
+ throw new Error(`Tag must be ${CCE_TAG_BYTES} bytes`);
617
+ }
618
+ try {
619
+ const decipher = createDecipheriv("aes-256-gcm", key, iv);
620
+ decipher.setAuthTag(tag);
621
+ if (aad) {
622
+ decipher.setAAD(aad);
623
+ }
624
+ const decrypted = Buffer.concat([
625
+ decipher.update(ciphertext),
626
+ decipher.final()
627
+ ]);
628
+ return new Uint8Array(decrypted);
629
+ } catch {
630
+ return null;
631
+ }
632
+ }
633
+ function generateAesKey() {
634
+ return new Uint8Array(randomBytes(CCE_AES_KEY_BYTES));
635
+ }
636
+ function generateIv() {
637
+ return new Uint8Array(randomBytes(CCE_IV_BYTES));
638
+ }
639
+ function base64UrlEncode(bytes2) {
640
+ return Buffer.from(bytes2).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
641
+ }
642
+ function base64UrlDecode(input) {
643
+ const base64 = input.replace(/-/g, "+").replace(/_/g, "/");
644
+ const padding = "=".repeat((4 - base64.length % 4) % 4);
645
+ return new Uint8Array(Buffer.from(base64 + padding, "base64"));
646
+ }
647
+ function hashPayload(payload) {
648
+ return bytesToHex2(sha2562(payload));
649
+ }
650
+ var nodeAesGcmProvider = {
651
+ async decrypt(key, iv, ciphertext, tag, aad) {
652
+ return aesGcmDecrypt(key, iv, ciphertext, tag, aad);
653
+ }
654
+ };
655
+
656
+ // src/cce/cce-response.service.ts
657
+ async function buildCceResponse(options, clientKeyEncryptor, axisSigner) {
658
+ const { request, capsule, status, body, clientPublicKeyHex, witnessRef } = options;
659
+ const responseNonce = bytesToHex3(
660
+ new Uint8Array(randomBytes2(CCE_NONCE_BYTES))
661
+ );
662
+ const responseId = generateResponseId();
663
+ const aesKey = generateAesKey();
664
+ const aad = buildResponseAad(
665
+ request.request_id,
666
+ responseId,
667
+ request.correlation_id,
668
+ capsule.capsule_id,
669
+ responseNonce
670
+ );
671
+ const { iv, ciphertext, tag } = aesGcmEncrypt(aesKey, body, aad);
672
+ const encryptedKey = await clientKeyEncryptor.wrapKey(
673
+ aesKey,
674
+ request.client_kid,
675
+ clientPublicKeyHex
676
+ );
677
+ aesKey.fill(0);
678
+ const encryptedPayload = {
679
+ alg: "AES-256-GCM",
680
+ iv: base64UrlEncode(iv),
681
+ ciphertext: base64UrlEncode(ciphertext),
682
+ tag: base64UrlEncode(tag)
683
+ };
684
+ const algorithms = {
685
+ kem: encryptedKey.alg,
686
+ enc: "AES-256-GCM",
687
+ kdf: "HKDF-SHA256",
688
+ sig: "EdDSA"
689
+ };
690
+ const unsignedResponse = {
691
+ ver: CCE_PROTOCOL_VERSION,
692
+ response_id: responseId,
693
+ request_id: request.request_id,
694
+ correlation_id: request.correlation_id,
695
+ encrypted_key: encryptedKey,
696
+ encrypted_payload: encryptedPayload,
697
+ response_nonce: responseNonce,
698
+ algorithms,
699
+ status,
700
+ ...witnessRef ? { witness_ref: witnessRef } : {}
701
+ };
702
+ const signPayload = new TextEncoder().encode(canonicalize(unsignedResponse));
703
+ const axisSig = await axisSigner.sign(signPayload);
704
+ const envelope = {
705
+ ...unsignedResponse,
706
+ axis_sig: axisSig
707
+ };
708
+ return {
709
+ envelope,
710
+ responsePayloadHash: hashPayload(body)
711
+ };
712
+ }
713
+ function buildCceErrorResponse(requestId, correlationId, status, errorCode, message) {
714
+ return {
715
+ ver: CCE_PROTOCOL_VERSION,
716
+ request_id: requestId,
717
+ correlation_id: correlationId,
718
+ status,
719
+ error: { code: errorCode, message }
720
+ };
721
+ }
722
+ function generateResponseId() {
723
+ const bytes2 = randomBytes2(16);
724
+ return "resp_" + bytesToHex3(new Uint8Array(bytes2)).slice(0, 24);
725
+ }
726
+ function buildResponseAad(requestId, responseId, correlationId, capsuleId, responseNonce) {
727
+ const parts = [
728
+ requestId,
729
+ responseId,
730
+ correlationId,
731
+ capsuleId,
732
+ responseNonce
733
+ ];
734
+ return new TextEncoder().encode(parts.join("|"));
735
+ }
736
+ function canonicalize(obj) {
737
+ if (Array.isArray(obj)) {
738
+ return "[" + obj.map(canonicalize).join(",") + "]";
739
+ }
740
+ if (obj !== null && typeof obj === "object") {
741
+ const sorted = Object.keys(obj).sort().map(
742
+ (k) => JSON.stringify(k) + ":" + canonicalize(obj[k])
743
+ );
744
+ return "{" + sorted.join(",") + "}";
745
+ }
746
+ return JSON.stringify(obj);
747
+ }
748
+
749
+ // src/cce/cce-witness.observer.ts
750
+ import { bytesToHex as bytesToHex4 } from "@noble/hashes/utils.js";
751
+ import { hkdf as hkdf2 } from "@noble/hashes/hkdf.js";
752
+ import { sha256 as sha2563 } from "@noble/hashes/sha2.js";
753
+ var InMemoryCceWitnessStore = class {
754
+ constructor() {
755
+ this.records = [];
756
+ }
757
+ async record(witness) {
758
+ this.records.push(witness);
759
+ }
760
+ getByRequestId(requestId) {
761
+ return this.records.find((w) => w.request_id === requestId);
762
+ }
763
+ getByCapsuleId(capsuleId) {
764
+ return this.records.filter((w) => w.capsule_id === capsuleId);
765
+ }
766
+ };
767
+ function buildWitnessRecord(envelope, capsule, verification, execution, options) {
768
+ const witnessId = generateWitnessId(envelope.request_id, capsule.capsule_id);
769
+ const executionContextHash = computeExecutionContextHash(
770
+ options.axisLocalSecret,
771
+ capsule,
772
+ envelope.request_nonce
773
+ );
774
+ return {
775
+ witness_id: witnessId,
776
+ request_id: envelope.request_id,
777
+ capsule_id: capsule.capsule_id,
778
+ sub: capsule.sub,
779
+ intent: capsule.intent,
780
+ aud: capsule.aud,
781
+ tps_from: capsule.tps_from,
782
+ tps_to: capsule.tps_to,
783
+ timestamp: Math.floor(Date.now() / 1e3),
784
+ verification: {
785
+ client_sig: verification.clientSigVerified,
786
+ capsule_sig: verification.capsuleSigVerified,
787
+ tps_valid: verification.tpsValid,
788
+ audience_match: verification.audienceMatch,
789
+ intent_match: verification.intentMatch,
790
+ replay_clean: verification.replayClean,
791
+ nonce_unique: verification.nonceUnique,
792
+ decryption_ok: verification.decryptionOk
793
+ },
794
+ execution: {
795
+ status: execution.status,
796
+ handler_duration_ms: execution.handlerDurationMs,
797
+ ...execution.effect ? { effect: execution.effect } : {}
798
+ },
799
+ response_encrypted: options.responseEncrypted,
800
+ execution_context_hash: executionContextHash,
801
+ ...options.requestPayload ? { request_payload_hash: hashPayload(options.requestPayload) } : {},
802
+ ...options.responsePayload ? { response_payload_hash: hashPayload(options.responsePayload) } : {}
803
+ };
804
+ }
805
+ function extractVerificationState(metadata) {
806
+ return {
807
+ clientSigVerified: metadata.cceClientSigVerified === true,
808
+ capsuleSigVerified: metadata.cceCapsuleVerified === true,
809
+ tpsValid: metadata.cceTpsValid === true,
810
+ audienceMatch: metadata.cceBindingVerified === true,
811
+ intentMatch: metadata.cceBindingVerified === true,
812
+ replayClean: metadata.cceReplayClean === true,
813
+ nonceUnique: metadata.cceReplayClean === true,
814
+ decryptionOk: metadata.cceDecryptionOk === true
815
+ };
816
+ }
817
+ function generateWitnessId(requestId, capsuleId) {
818
+ const input = `witness:${requestId}:${capsuleId}:${Date.now()}`;
819
+ const hash = sha2563(new TextEncoder().encode(input));
820
+ return "wit_" + bytesToHex4(hash).slice(0, 24);
821
+ }
822
+ function computeExecutionContextHash(axisLocalSecret, capsule, requestNonce) {
823
+ const encoder = new TextEncoder();
824
+ const ikm = hexToBytes2(axisLocalSecret);
825
+ const salt = sha2563(
826
+ encoder.encode(
827
+ capsule.capsule_id + "|" + capsule.capsule_nonce + "|" + requestNonce
828
+ )
829
+ );
830
+ const info = encoder.encode(
831
+ [
832
+ CCE_DERIVATION.WITNESS,
833
+ capsule.sub,
834
+ capsule.kid,
835
+ capsule.intent,
836
+ capsule.aud,
837
+ String(capsule.tps_from),
838
+ String(capsule.tps_to),
839
+ capsule.policy_hash ?? "",
840
+ capsule.ver
841
+ ].join("|")
842
+ );
843
+ const witnessKey = hkdf2(sha2563, ikm, salt, info, 32);
844
+ const hash = bytesToHex4(sha2563(witnessKey));
845
+ witnessKey.fill(0);
846
+ return hash;
847
+ }
848
+ function hexToBytes2(hex) {
849
+ const bytes2 = new Uint8Array(hex.length / 2);
850
+ for (let i = 0; i < bytes2.length; i++) {
851
+ bytes2[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
852
+ }
853
+ return bytes2;
854
+ }
855
+
856
+ // src/cce/cce-pipeline.ts
857
+ async function executeCcePipeline(envelope, config) {
858
+ const startTime = Date.now();
859
+ if (envelope.ver !== CCE_PROTOCOL_VERSION) {
860
+ return {
861
+ ok: false,
862
+ error: {
863
+ code: CCE_ERROR.UNSUPPORTED_VERSION,
864
+ message: `Unsupported version: ${envelope.ver}`
865
+ },
866
+ status: "ERROR"
867
+ };
868
+ }
869
+ const sensorInput = {
870
+ intent: envelope.capsule.intent,
871
+ metadata: {
872
+ cce: true,
873
+ cceEnvelope: envelope,
874
+ contentType: "application/axis-cce"
875
+ }
876
+ };
877
+ const sortedSensors = [...config.sensors].sort(
878
+ (a, b) => (a.order ?? 999) - (b.order ?? 999)
879
+ );
880
+ for (const sensor of sortedSensors) {
881
+ if (sensor.supports && !sensor.supports(sensorInput)) {
882
+ continue;
883
+ }
884
+ let decision;
885
+ try {
886
+ decision = await sensor.run(sensorInput);
887
+ } catch (err) {
888
+ return {
889
+ ok: false,
890
+ error: {
891
+ code: CCE_ERROR.DECRYPTION_FAILED,
892
+ message: `Sensor ${sensor.name} failed`
893
+ },
894
+ status: "ERROR"
895
+ };
896
+ }
897
+ const normalized = normalizeSensorDecision(decision);
898
+ if (!normalized.allow) {
899
+ const code = normalized.reasons[0]?.split(":")[0] ?? CCE_ERROR.DECRYPTION_FAILED;
900
+ return {
901
+ ok: false,
902
+ error: { code, message: normalized.reasons.join("; ") },
903
+ status: "DENIED"
904
+ };
905
+ }
906
+ }
907
+ const capsule = sensorInput.metadata?.cceCapsule;
908
+ const decryptedPayload = sensorInput.metadata?.cceDecryptedPayload;
909
+ const clientKey = sensorInput.metadata?.cceClientKey;
910
+ if (!capsule || !decryptedPayload || !clientKey) {
911
+ return {
912
+ ok: false,
913
+ error: {
914
+ code: CCE_ERROR.DECRYPTION_FAILED,
915
+ message: "Sensor chain did not produce required outputs"
916
+ },
917
+ status: "ERROR"
918
+ };
919
+ }
920
+ const derivationInput = {
921
+ axisLocalSecret: config.axisLocalSecret,
922
+ capsule,
923
+ requestNonce: envelope.request_nonce
924
+ };
925
+ const executionContext = buildExecutionContext(
926
+ derivationInput,
927
+ envelope.request_id
928
+ );
929
+ const handler = config.handlers.get(capsule.intent);
930
+ if (!handler) {
931
+ return {
932
+ ok: false,
933
+ error: {
934
+ code: CCE_ERROR.HANDLER_NOT_FOUND,
935
+ message: `No handler for intent: ${capsule.intent}`
936
+ },
937
+ status: "ERROR"
938
+ };
939
+ }
940
+ const handlerContext = {
941
+ capsule,
942
+ executionContext,
943
+ envelope,
944
+ clientPublicKeyHex: clientKey.publicKeyHex,
945
+ intent: capsule.intent,
946
+ sub: capsule.sub
947
+ };
948
+ let result;
949
+ const handlerStart = Date.now();
950
+ try {
951
+ result = await handler(decryptedPayload, handlerContext);
952
+ } catch (err) {
953
+ const handlerDuration2 = Date.now() - handlerStart;
954
+ const verification2 = extractVerificationState(sensorInput.metadata ?? {});
955
+ const witness2 = buildWitnessRecord(
956
+ envelope,
957
+ capsule,
958
+ verification2,
959
+ { status: "FAILED", handlerDurationMs: handlerDuration2 },
960
+ {
961
+ axisLocalSecret: config.axisLocalSecret,
962
+ requestPayload: decryptedPayload,
963
+ responseEncrypted: false
964
+ }
965
+ );
966
+ await config.witnessStore.record(witness2);
967
+ return {
968
+ ok: false,
969
+ error: {
970
+ code: CCE_ERROR.HANDLER_EXECUTION_FAILED,
971
+ message: "Handler execution failed"
972
+ },
973
+ status: "FAILED"
974
+ };
975
+ }
976
+ const handlerDuration = Date.now() - handlerStart;
977
+ let responseEnvelope;
978
+ let responsePayloadHash;
979
+ try {
980
+ const responseResult = await buildCceResponse(
981
+ {
982
+ request: envelope,
983
+ capsule,
984
+ status: result.status,
985
+ body: result.body,
986
+ clientPublicKeyHex: clientKey.publicKeyHex
987
+ },
988
+ config.clientKeyEncryptor,
989
+ config.axisSigner
990
+ );
991
+ responseEnvelope = responseResult.envelope;
992
+ responsePayloadHash = responseResult.responsePayloadHash;
993
+ } catch (err) {
994
+ return {
995
+ ok: false,
996
+ error: {
997
+ code: CCE_ERROR.RESPONSE_ENCRYPTION_FAILED,
998
+ message: "Response encryption failed"
999
+ },
1000
+ status: "ERROR"
1001
+ };
1002
+ }
1003
+ const verification = extractVerificationState(sensorInput.metadata ?? {});
1004
+ const witness = buildWitnessRecord(
1005
+ envelope,
1006
+ capsule,
1007
+ verification,
1008
+ {
1009
+ status: result.status,
1010
+ handlerDurationMs: handlerDuration,
1011
+ effect: result.effect
1012
+ },
1013
+ {
1014
+ axisLocalSecret: config.axisLocalSecret,
1015
+ requestPayload: decryptedPayload,
1016
+ responsePayload: result.body,
1017
+ responseEncrypted: true
1018
+ }
1019
+ );
1020
+ await config.witnessStore.record(witness);
1021
+ return {
1022
+ ok: true,
1023
+ response: responseEnvelope,
1024
+ witnessId: witness.witness_id
1025
+ };
1026
+ }
1027
+
408
1028
  // src/engine/intent.router.ts
409
1029
  var IntentRouter = class {
410
1030
  constructor(moduleRef) {
@@ -422,6 +1042,10 @@ var IntentRouter = class {
422
1042
  this.intentValidators = /* @__PURE__ */ new Map();
423
1043
  /** Per-intent operation kind */
424
1044
  this.intentKinds = /* @__PURE__ */ new Map();
1045
+ /** CCE handler registry */
1046
+ this.cceHandlers = /* @__PURE__ */ new Map();
1047
+ /** CCE pipeline configuration (set via configureCce) */
1048
+ this.ccePipelineConfig = null;
425
1049
  }
426
1050
  getSchema(intent) {
427
1051
  return this.intentSchemas.get(intent);
@@ -685,6 +1309,58 @@ var IntentRouter = class {
685
1309
  }
686
1310
  }
687
1311
  }
1312
+ // ===========================================================================
1313
+ // CCE — Capsule-Carried Encryption Support
1314
+ // ===========================================================================
1315
+ /**
1316
+ * Configure the CCE pipeline.
1317
+ * Must be called before routeCce() can process encrypted requests.
1318
+ */
1319
+ configureCce(config) {
1320
+ this.ccePipelineConfig = config;
1321
+ this.logger.log("CCE pipeline configured");
1322
+ }
1323
+ /**
1324
+ * Register a CCE-encrypted intent handler.
1325
+ * CCE handlers receive decrypted payloads and execution context.
1326
+ */
1327
+ registerCceHandler(intent, handler) {
1328
+ this.cceHandlers.set(intent, handler);
1329
+ this.logger.debug(`CCE handler registered: ${intent}`);
1330
+ }
1331
+ /**
1332
+ * Check if a CCE handler exists for the given intent.
1333
+ */
1334
+ hasCceHandler(intent) {
1335
+ return this.cceHandlers.has(intent);
1336
+ }
1337
+ /**
1338
+ * Route a CCE-encrypted request through the full pipeline.
1339
+ *
1340
+ * Steps:
1341
+ * 1. Sensor chain (envelope validation → capsule verification → replay → decrypt)
1342
+ * 2. Execution context derivation
1343
+ * 3. Handler execution
1344
+ * 4. Response encryption
1345
+ * 5. Witness recording
1346
+ */
1347
+ async routeCce(envelope) {
1348
+ if (!this.ccePipelineConfig) {
1349
+ return {
1350
+ ok: false,
1351
+ error: {
1352
+ code: "CCE_NOT_CONFIGURED",
1353
+ message: "CCE pipeline not configured. Call configureCce() first."
1354
+ },
1355
+ status: "ERROR"
1356
+ };
1357
+ }
1358
+ const config = {
1359
+ ...this.ccePipelineConfig,
1360
+ handlers: this.cceHandlers
1361
+ };
1362
+ return executeCcePipeline(envelope, config);
1363
+ }
688
1364
  storeSchema(meta) {
689
1365
  if (meta.dto) {
690
1366
  if (meta.tlv && meta.tlv.length > 0) {
@@ -1039,7 +1715,7 @@ function verifyResponse(ctx, response) {
1039
1715
  import { encodeVarint, decodeVarint, varintLength } from "@nextera.one/axis-protocol";
1040
1716
 
1041
1717
  // src/core/signature.ts
1042
- import * as crypto from "crypto";
1718
+ import * as crypto2 from "crypto";
1043
1719
 
1044
1720
  // src/core/axis-bin.ts
1045
1721
  import * as z from "zod";
@@ -1169,19 +1845,19 @@ function signFrame(frame, privateKey) {
1169
1845
  32
1170
1846
  ]);
1171
1847
  const pkcs8Key = Buffer.concat([pkcs8Prefix, privateKey]);
1172
- keyObject = crypto.createPrivateKey({
1848
+ keyObject = crypto2.createPrivateKey({
1173
1849
  key: pkcs8Key,
1174
1850
  format: "der",
1175
1851
  type: "pkcs8"
1176
1852
  });
1177
1853
  } else {
1178
- keyObject = crypto.createPrivateKey({
1854
+ keyObject = crypto2.createPrivateKey({
1179
1855
  key: privateKey,
1180
1856
  format: "der",
1181
1857
  type: "pkcs8"
1182
1858
  });
1183
1859
  }
1184
- const signature = crypto.sign(null, payload, keyObject);
1860
+ const signature = crypto2.sign(null, payload, keyObject);
1185
1861
  if (signature.length !== 64) {
1186
1862
  throw new Error("Ed25519 signature must be 64 bytes");
1187
1863
  }
@@ -1213,19 +1889,19 @@ function verifyFrameSignature(frame, publicKey) {
1213
1889
  0
1214
1890
  ]);
1215
1891
  const spkiKey = Buffer.concat([spkiPrefix, publicKey]);
1216
- keyObject = crypto.createPublicKey({
1892
+ keyObject = crypto2.createPublicKey({
1217
1893
  key: spkiKey,
1218
1894
  format: "der",
1219
1895
  type: "spki"
1220
1896
  });
1221
1897
  } else {
1222
- keyObject = crypto.createPublicKey({
1898
+ keyObject = crypto2.createPublicKey({
1223
1899
  key: publicKey,
1224
1900
  format: "der",
1225
1901
  type: "spki"
1226
1902
  });
1227
1903
  }
1228
- const valid = crypto.verify(
1904
+ const valid = crypto2.verify(
1229
1905
  null,
1230
1906
  payload,
1231
1907
  keyObject,
@@ -1237,17 +1913,17 @@ function verifyFrameSignature(frame, publicKey) {
1237
1913
  }
1238
1914
  }
1239
1915
  function generateEd25519KeyPair() {
1240
- const { privateKey, publicKey } = crypto.generateKeyPairSync("ed25519");
1916
+ const { privateKey, publicKey } = crypto2.generateKeyPairSync("ed25519");
1241
1917
  return {
1242
1918
  privateKey: privateKey.export({ type: "pkcs8", format: "der" }),
1243
1919
  publicKey: publicKey.export({ type: "spki", format: "der" })
1244
1920
  };
1245
1921
  }
1246
- function sha256(data) {
1247
- return crypto.createHash("sha256").update(data).digest();
1922
+ function sha2564(data) {
1923
+ return crypto2.createHash("sha256").update(data).digest();
1248
1924
  }
1249
1925
  function computeReceiptHash(receiptBytes, prevHash) {
1250
- const hasher = crypto.createHash("sha256");
1926
+ const hasher = crypto2.createHash("sha256");
1251
1927
  hasher.update(receiptBytes);
1252
1928
  if (prevHash && prevHash.length > 0) {
1253
1929
  hasher.update(prevHash);
@@ -1305,7 +1981,7 @@ __export(ats1_exports, {
1305
1981
  encodeU64BE: () => encodeU64BE,
1306
1982
  encodeUVarint: () => encodeUVarint,
1307
1983
  logicalBodyToTLVs: () => logicalBodyToTLVs,
1308
- sha256: () => sha2562,
1984
+ sha256: () => sha2565,
1309
1985
  tlvsToLogicalBody: () => tlvsToLogicalBody,
1310
1986
  tlvsToMap: () => tlvsToMap,
1311
1987
  validateTLVsAgainstSchema: () => validateTLVsAgainstSchema
@@ -1359,7 +2035,7 @@ function decodeU64BE(buf) {
1359
2035
  if (buf.length !== 8) throw new Error("decodeU64BE: length must be 8");
1360
2036
  return buf.readBigUInt64BE(0);
1361
2037
  }
1362
- function sha2562(data) {
2038
+ function sha2565(data) {
1363
2039
  return createHash3("sha256").update(data).digest();
1364
2040
  }
1365
2041
  function encodeTLV(tag, value) {
@@ -1676,7 +2352,7 @@ function decodeAxisHeaderFromTLVs(hdrTlvs, limits = DEFAULT_LIMITS) {
1676
2352
  function encodeAxisRequestBinary(schema, req, limits = DEFAULT_LIMITS) {
1677
2353
  const bodyTlvs = logicalBodyToTLVs(schema, req.body, limits);
1678
2354
  const bodyBytes = encodeTLVStreamCanonical(bodyTlvs);
1679
- const bodyHash = sha2562(bodyBytes);
2355
+ const bodyHash = sha2565(bodyBytes);
1680
2356
  const hdr = {
1681
2357
  ...req.hdr,
1682
2358
  schemaId: schema.schemaId,
@@ -1692,7 +2368,7 @@ function decodeAxisRequestBinary(schema, hdrBytes, bodyBytes, limits = DEFAULT_L
1692
2368
  const hdr = decodeAxisHeaderFromTLVs(hdrTlvs, limits);
1693
2369
  if (hdr.schemaId !== schema.schemaId)
1694
2370
  throw new Error("decodeAxisRequestBinary: schemaId mismatch");
1695
- const bh = sha2562(bodyBytes);
2371
+ const bh = sha2565(bodyBytes);
1696
2372
  if (!Buffer.from(hdr.bodyHash).equals(bh))
1697
2373
  throw new Error("decodeAxisRequestBinary: body_hash mismatch");
1698
2374
  const body = tlvsToLogicalBody(schema, bodyTlvs, limits);
@@ -1765,7 +2441,7 @@ function packPasskeyLoginOptionsReq(params) {
1765
2441
  }
1766
2442
  );
1767
2443
  const body = encodeTLVStreamCanonical(bodyTlvs);
1768
- const bodyHash = sha2562(body);
2444
+ const bodyHash = sha2565(body);
1769
2445
  const hdr = buildAts1Hdr({
1770
2446
  intentId: params.intentId,
1771
2447
  schemaId: ATS1_SCHEMA.PASSKEY_LOGIN_OPTIONS_REQ,
@@ -1834,7 +2510,7 @@ function packPasskeyRegisterOptionsReq(params) {
1834
2510
  }
1835
2511
  );
1836
2512
  const body = encodeTLVStreamCanonical(bodyTlvs);
1837
- const bodyHash = sha2562(body);
2513
+ const bodyHash = sha2565(body);
1838
2514
  const hdr = buildAts1Hdr({
1839
2515
  intentId: params.intentId,
1840
2516
  schemaId: ATS1_SCHEMA.PASSKEY_REGISTER_OPTIONS_REQ,
@@ -1865,7 +2541,7 @@ function packPasskeyLoginVerifyReq(params) {
1865
2541
  }
1866
2542
  });
1867
2543
  const body = encodeTLVStreamCanonical(bodyTlvs);
1868
- const bodyHash = sha2562(body);
2544
+ const bodyHash = sha2565(body);
1869
2545
  const hdr = buildAts1Hdr({
1870
2546
  intentId: params.intentId,
1871
2547
  schemaId: ATS1_SCHEMA.PASSKEY_LOGIN_VERIFY_REQ,
@@ -1949,7 +2625,7 @@ function packPasskeyLoginVerifyRes(params) {
1949
2625
  }
1950
2626
 
1951
2627
  // src/codec/tlv.encode.ts
1952
- import { randomBytes as randomBytes2 } from "crypto";
2628
+ import { randomBytes as randomBytes4 } from "crypto";
1953
2629
  function encVarint(x) {
1954
2630
  if (x < 0n) throw new Error("VARINT_NEG");
1955
2631
  const out = [];
@@ -1977,7 +2653,7 @@ function bytes(b) {
1977
2653
  return Buffer.isBuffer(b) ? b : Buffer.from(b);
1978
2654
  }
1979
2655
  function nonce16() {
1980
- return randomBytes2(16);
2656
+ return randomBytes4(16);
1981
2657
  }
1982
2658
  function tlv(type, value) {
1983
2659
  if (!Number.isSafeInteger(type) || type < 0) throw new Error("TLV_BAD_TYPE");
@@ -2705,7 +3381,7 @@ function isTimestampValid(ts, skewSeconds = 120) {
2705
3381
 
2706
3382
  // src/upload/axis-files.handlers.ts
2707
3383
  import { Inject, Injectable as Injectable3, Logger as Logger2, Optional as Optional2 } from "@nestjs/common";
2708
- import * as crypto2 from "crypto";
3384
+ import * as crypto3 from "crypto";
2709
3385
 
2710
3386
  // src/upload/upload.tokens.ts
2711
3387
  var AXIS_UPLOAD_SESSION_STORE = "AXIS_UPLOAD_SESSION_STORE";
@@ -2806,7 +3482,7 @@ var AxisFilesFinalizeHandler = class {
2806
3482
  if (!await this.files.hasTemp(fileId)) {
2807
3483
  throw new Error("CHUNKS_NOT_FOUND");
2808
3484
  }
2809
- const hash = crypto2.createHash("sha256");
3485
+ const hash = crypto3.createHash("sha256");
2810
3486
  const rs = this.files.createTempReadStream(fileId);
2811
3487
  for await (const chunk of rs) {
2812
3488
  hash.update(chunk);
@@ -3226,10 +3902,10 @@ SensorRegistry = __decorateClass([
3226
3902
  ], SensorRegistry);
3227
3903
 
3228
3904
  // src/engine/axis-observation.ts
3229
- import { randomBytes as randomBytes3 } from "crypto";
3905
+ import { randomBytes as randomBytes5 } from "crypto";
3230
3906
  function createObservation(transport, ip) {
3231
3907
  return {
3232
- id: randomBytes3(16).toString("hex"),
3908
+ id: randomBytes5(16).toString("hex"),
3233
3909
  startMs: Date.now(),
3234
3910
  transport,
3235
3911
  ip,
@@ -3387,6 +4063,693 @@ AxisSensorChainService = __decorateClass([
3387
4063
  Injectable7()
3388
4064
  ], AxisSensorChainService);
3389
4065
 
4066
+ // src/cce/index.ts
4067
+ var cce_exports = {};
4068
+ __export(cce_exports, {
4069
+ CCE_AES_KEY_BYTES: () => CCE_AES_KEY_BYTES,
4070
+ CCE_DERIVATION: () => CCE_DERIVATION,
4071
+ CCE_ERROR: () => CCE_ERROR,
4072
+ CCE_IV_BYTES: () => CCE_IV_BYTES,
4073
+ CCE_NONCE_BYTES: () => CCE_NONCE_BYTES,
4074
+ CCE_PROTOCOL_VERSION: () => CCE_PROTOCOL_VERSION,
4075
+ CCE_TAG_BYTES: () => CCE_TAG_BYTES,
4076
+ CceAudienceIntentBindingSensor: () => CceAudienceIntentBindingSensor,
4077
+ CceCapsuleVerificationSensor: () => CceCapsuleVerificationSensor,
4078
+ CceClientSignatureSensor: () => CceClientSignatureSensor,
4079
+ CceEnvelopeValidationSensor: () => CceEnvelopeValidationSensor,
4080
+ CceError: () => CceError,
4081
+ CcePayloadDecryptionSensor: () => CcePayloadDecryptionSensor,
4082
+ CceReplayProtectionSensor: () => CceReplayProtectionSensor,
4083
+ CceTpsWindowSensor: () => CceTpsWindowSensor,
4084
+ InMemoryCceReplayStore: () => InMemoryCceReplayStore,
4085
+ InMemoryCceWitnessStore: () => InMemoryCceWitnessStore,
4086
+ aesGcmDecrypt: () => aesGcmDecrypt,
4087
+ aesGcmEncrypt: () => aesGcmEncrypt,
4088
+ base64UrlDecode: () => base64UrlDecode,
4089
+ base64UrlEncode: () => base64UrlEncode,
4090
+ buildCceErrorResponse: () => buildCceErrorResponse,
4091
+ buildCceResponse: () => buildCceResponse,
4092
+ buildExecutionContext: () => buildExecutionContext,
4093
+ buildWitnessRecord: () => buildWitnessRecord,
4094
+ deriveRequestExecutionKey: () => deriveRequestExecutionKey,
4095
+ deriveResponseExecutionKey: () => deriveResponseExecutionKey,
4096
+ deriveWitnessKey: () => deriveWitnessKey,
4097
+ executeCcePipeline: () => executeCcePipeline,
4098
+ extractVerificationState: () => extractVerificationState,
4099
+ generateAesKey: () => generateAesKey,
4100
+ generateCceNonce: () => generateCceNonce,
4101
+ generateIv: () => generateIv,
4102
+ hashPayload: () => hashPayload,
4103
+ nodeAesGcmProvider: () => nodeAesGcmProvider
4104
+ });
4105
+
4106
+ // src/cce/sensors/cce-envelope-validation.sensor.ts
4107
+ var REQUIRED_FIELDS = [
4108
+ "ver",
4109
+ "request_id",
4110
+ "correlation_id",
4111
+ "client_kid",
4112
+ "capsule",
4113
+ "encrypted_key",
4114
+ "encrypted_payload",
4115
+ "request_nonce",
4116
+ "client_sig",
4117
+ "algorithms"
4118
+ ];
4119
+ var CceEnvelopeValidationSensor = class {
4120
+ constructor() {
4121
+ this.name = "cce.envelope.validation";
4122
+ this.order = 5;
4123
+ this.phase = "PRE_DECODE";
4124
+ }
4125
+ supports(input) {
4126
+ return input.metadata?.cce === true || input.metadata?.contentType === "application/axis-cce";
4127
+ }
4128
+ async run(input) {
4129
+ const envelope = input.metadata?.cceEnvelope;
4130
+ if (!envelope) {
4131
+ return {
4132
+ allow: false,
4133
+ riskScore: 100,
4134
+ reasons: [CCE_ERROR.INVALID_ENVELOPE],
4135
+ code: CCE_ERROR.INVALID_ENVELOPE
4136
+ };
4137
+ }
4138
+ for (const field of REQUIRED_FIELDS) {
4139
+ if (envelope[field] === void 0 || envelope[field] === null) {
4140
+ return {
4141
+ allow: false,
4142
+ riskScore: 100,
4143
+ reasons: [`${CCE_ERROR.INVALID_ENVELOPE}: missing ${field}`],
4144
+ code: CCE_ERROR.INVALID_ENVELOPE
4145
+ };
4146
+ }
4147
+ }
4148
+ if (envelope.ver !== CCE_PROTOCOL_VERSION) {
4149
+ return {
4150
+ allow: false,
4151
+ riskScore: 100,
4152
+ reasons: [`${CCE_ERROR.UNSUPPORTED_VERSION}: ${envelope.ver}`],
4153
+ code: CCE_ERROR.UNSUPPORTED_VERSION
4154
+ };
4155
+ }
4156
+ if (!/^[0-9a-f]+$/i.test(envelope.request_nonce)) {
4157
+ return {
4158
+ allow: false,
4159
+ riskScore: 100,
4160
+ reasons: [
4161
+ `${CCE_ERROR.INVALID_ENVELOPE}: invalid request_nonce format`
4162
+ ],
4163
+ code: CCE_ERROR.INVALID_ENVELOPE
4164
+ };
4165
+ }
4166
+ if (envelope.request_nonce.length !== CCE_NONCE_BYTES * 2) {
4167
+ return {
4168
+ allow: false,
4169
+ riskScore: 100,
4170
+ reasons: [`${CCE_ERROR.INVALID_ENVELOPE}: request_nonce wrong length`],
4171
+ code: CCE_ERROR.INVALID_ENVELOPE
4172
+ };
4173
+ }
4174
+ const capsule = envelope.capsule;
4175
+ if (!capsule.capsule_id || !capsule.ver || !capsule.sub || !capsule.kid || !capsule.intent || !capsule.aud || !capsule.issuer_sig) {
4176
+ return {
4177
+ allow: false,
4178
+ riskScore: 100,
4179
+ reasons: [`${CCE_ERROR.MISSING_CAPSULE}: incomplete capsule claims`],
4180
+ code: CCE_ERROR.MISSING_CAPSULE
4181
+ };
4182
+ }
4183
+ if (!envelope.encrypted_key.ciphertext || !envelope.encrypted_key.alg) {
4184
+ return {
4185
+ allow: false,
4186
+ riskScore: 100,
4187
+ reasons: [
4188
+ `${CCE_ERROR.MISSING_ENCRYPTED_KEY}: incomplete encrypted_key`
4189
+ ],
4190
+ code: CCE_ERROR.MISSING_ENCRYPTED_KEY
4191
+ };
4192
+ }
4193
+ input.metadata = input.metadata ?? {};
4194
+ input.metadata.cceEnvelopeValid = true;
4195
+ return {
4196
+ decision: "ALLOW" /* ALLOW */,
4197
+ allow: true,
4198
+ riskScore: 0,
4199
+ reasons: []
4200
+ };
4201
+ }
4202
+ };
4203
+
4204
+ // src/cce/sensors/cce-client-signature.sensor.ts
4205
+ var CceClientSignatureSensor = class {
4206
+ constructor(keyResolver, signatureVerifier) {
4207
+ this.keyResolver = keyResolver;
4208
+ this.signatureVerifier = signatureVerifier;
4209
+ this.name = "cce.client.signature";
4210
+ this.order = 45;
4211
+ this.phase = "POST_DECODE";
4212
+ }
4213
+ supports(input) {
4214
+ return input.metadata?.cceEnvelopeValid === true;
4215
+ }
4216
+ async run(input) {
4217
+ const envelope = input.metadata?.cceEnvelope;
4218
+ if (!envelope) {
4219
+ return {
4220
+ allow: false,
4221
+ riskScore: 100,
4222
+ reasons: [CCE_ERROR.INVALID_ENVELOPE],
4223
+ code: CCE_ERROR.INVALID_ENVELOPE
4224
+ };
4225
+ }
4226
+ const keyRecord = await this.keyResolver.resolve(envelope.client_kid);
4227
+ if (!keyRecord) {
4228
+ return {
4229
+ allow: false,
4230
+ riskScore: 100,
4231
+ reasons: [
4232
+ `${CCE_ERROR.CLIENT_KEY_NOT_FOUND}: kid=${envelope.client_kid}`
4233
+ ],
4234
+ code: CCE_ERROR.CLIENT_KEY_NOT_FOUND
4235
+ };
4236
+ }
4237
+ const { client_sig, ...signable } = envelope;
4238
+ const canonical = canonicalize2(signable);
4239
+ const message = new TextEncoder().encode(canonical);
4240
+ const valid = await this.signatureVerifier.verify(
4241
+ message,
4242
+ client_sig.value,
4243
+ keyRecord.publicKeyHex,
4244
+ keyRecord.alg
4245
+ );
4246
+ if (!valid) {
4247
+ return {
4248
+ allow: false,
4249
+ riskScore: 100,
4250
+ reasons: [CCE_ERROR.CLIENT_SIG_INVALID],
4251
+ code: CCE_ERROR.CLIENT_SIG_INVALID
4252
+ };
4253
+ }
4254
+ input.metadata = input.metadata ?? {};
4255
+ input.metadata.cceClientKey = keyRecord;
4256
+ input.metadata.cceClientSigVerified = true;
4257
+ return {
4258
+ decision: "ALLOW" /* ALLOW */,
4259
+ allow: true,
4260
+ riskScore: 0,
4261
+ reasons: [],
4262
+ meta: { kid: envelope.client_kid }
4263
+ };
4264
+ }
4265
+ };
4266
+ function canonicalize2(obj) {
4267
+ if (Array.isArray(obj)) {
4268
+ return "[" + obj.map(canonicalize2).join(",") + "]";
4269
+ }
4270
+ if (obj !== null && typeof obj === "object") {
4271
+ const sorted = Object.keys(obj).sort().map(
4272
+ (k) => JSON.stringify(k) + ":" + canonicalize2(obj[k])
4273
+ );
4274
+ return "{" + sorted.join(",") + "}";
4275
+ }
4276
+ return JSON.stringify(obj);
4277
+ }
4278
+
4279
+ // src/cce/sensors/cce-capsule-verification.sensor.ts
4280
+ import { blake3 } from "@noble/hashes/blake3.js";
4281
+ import { bytesToHex as bytesToHex5 } from "@noble/hashes/utils.js";
4282
+ var CceCapsuleVerificationSensor = class {
4283
+ constructor(issuerKeyResolver, capsuleVerifier) {
4284
+ this.issuerKeyResolver = issuerKeyResolver;
4285
+ this.capsuleVerifier = capsuleVerifier;
4286
+ this.name = "cce.capsule.verification";
4287
+ this.order = 50;
4288
+ this.phase = "POST_DECODE";
4289
+ }
4290
+ supports(input) {
4291
+ return input.metadata?.cceEnvelopeValid === true;
4292
+ }
4293
+ async run(input) {
4294
+ const capsule = input.metadata?.cceEnvelope?.capsule;
4295
+ if (!capsule) {
4296
+ return {
4297
+ allow: false,
4298
+ riskScore: 100,
4299
+ reasons: [CCE_ERROR.MISSING_CAPSULE],
4300
+ code: CCE_ERROR.MISSING_CAPSULE
4301
+ };
4302
+ }
4303
+ if (capsule.ver !== CCE_PROTOCOL_VERSION) {
4304
+ return {
4305
+ allow: false,
4306
+ riskScore: 100,
4307
+ reasons: [
4308
+ `${CCE_ERROR.CAPSULE_SIG_INVALID}: wrong version ${capsule.ver}`
4309
+ ],
4310
+ code: CCE_ERROR.CAPSULE_SIG_INVALID
4311
+ };
4312
+ }
4313
+ const { capsule_id, issuer_sig, ...claimsBody } = capsule;
4314
+ const expectedId = computeCceCapsuleId(claimsBody);
4315
+ if (capsule_id !== expectedId) {
4316
+ return {
4317
+ allow: false,
4318
+ riskScore: 100,
4319
+ reasons: [`${CCE_ERROR.CAPSULE_SIG_INVALID}: content hash mismatch`],
4320
+ code: CCE_ERROR.CAPSULE_SIG_INVALID
4321
+ };
4322
+ }
4323
+ const issuerKey = await this.issuerKeyResolver.resolve(
4324
+ capsule.issuer_sig.kid
4325
+ );
4326
+ if (!issuerKey) {
4327
+ return {
4328
+ allow: false,
4329
+ riskScore: 100,
4330
+ reasons: [`${CCE_ERROR.CAPSULE_SIG_INVALID}: issuer key not found`],
4331
+ code: CCE_ERROR.CAPSULE_SIG_INVALID
4332
+ };
4333
+ }
4334
+ const { issuer_sig: sig, ...rest } = capsule;
4335
+ const sigValid = await this.capsuleVerifier.verify(
4336
+ rest,
4337
+ sig,
4338
+ issuerKey.publicKeyHex
4339
+ );
4340
+ if (!sigValid) {
4341
+ return {
4342
+ allow: false,
4343
+ riskScore: 100,
4344
+ reasons: [CCE_ERROR.CAPSULE_SIG_INVALID],
4345
+ code: CCE_ERROR.CAPSULE_SIG_INVALID
4346
+ };
4347
+ }
4348
+ const nowSeconds = Math.floor(Date.now() / 1e3);
4349
+ if (capsule.exp < nowSeconds) {
4350
+ return {
4351
+ allow: false,
4352
+ riskScore: 100,
4353
+ reasons: [`${CCE_ERROR.CAPSULE_EXPIRED}: exp=${capsule.exp}`],
4354
+ code: CCE_ERROR.CAPSULE_EXPIRED
4355
+ };
4356
+ }
4357
+ if (capsule.iat > nowSeconds + 5) {
4358
+ return {
4359
+ allow: false,
4360
+ riskScore: 100,
4361
+ reasons: [`${CCE_ERROR.CAPSULE_NOT_YET_VALID}: iat=${capsule.iat}`],
4362
+ code: CCE_ERROR.CAPSULE_NOT_YET_VALID
4363
+ };
4364
+ }
4365
+ input.metadata = input.metadata ?? {};
4366
+ input.metadata.cceCapsuleVerified = true;
4367
+ input.metadata.cceCapsule = capsule;
4368
+ return {
4369
+ decision: "ALLOW" /* ALLOW */,
4370
+ allow: true,
4371
+ riskScore: 0,
4372
+ reasons: [],
4373
+ meta: { capsule_id: capsule.capsule_id }
4374
+ };
4375
+ }
4376
+ };
4377
+ function canonicalize3(obj) {
4378
+ if (Array.isArray(obj)) {
4379
+ return "[" + obj.map(canonicalize3).join(",") + "]";
4380
+ }
4381
+ if (obj !== null && typeof obj === "object") {
4382
+ const sorted = Object.keys(obj).sort().map(
4383
+ (k) => JSON.stringify(k) + ":" + canonicalize3(obj[k])
4384
+ );
4385
+ return "{" + sorted.join(",") + "}";
4386
+ }
4387
+ return JSON.stringify(obj);
4388
+ }
4389
+ function computeCceCapsuleId(claims) {
4390
+ const canonical = canonicalize3(claims);
4391
+ const hash = blake3(new TextEncoder().encode(canonical));
4392
+ return "cce_b3_" + bytesToHex5(hash).slice(0, 32);
4393
+ }
4394
+
4395
+ // src/cce/sensors/cce-tps-window.sensor.ts
4396
+ var DEFAULT_SKEW_MS = 5e3;
4397
+ var CceTpsWindowSensor = class {
4398
+ constructor(skewMs = DEFAULT_SKEW_MS) {
4399
+ this.skewMs = skewMs;
4400
+ this.name = "cce.tps.window";
4401
+ this.order = 92;
4402
+ this.phase = "POST_DECODE";
4403
+ }
4404
+ supports(input) {
4405
+ return input.metadata?.cceCapsuleVerified === true;
4406
+ }
4407
+ async run(input) {
4408
+ const capsule = input.metadata?.cceCapsule;
4409
+ if (!capsule) {
4410
+ return {
4411
+ allow: false,
4412
+ riskScore: 100,
4413
+ reasons: [CCE_ERROR.MISSING_CAPSULE],
4414
+ code: CCE_ERROR.MISSING_CAPSULE
4415
+ };
4416
+ }
4417
+ const nowMs = Date.now();
4418
+ if (nowMs > capsule.tps_to + this.skewMs) {
4419
+ return {
4420
+ allow: false,
4421
+ riskScore: 100,
4422
+ reasons: [
4423
+ `${CCE_ERROR.TPS_WINDOW_EXPIRED}: window ended at ${capsule.tps_to}, now=${nowMs}`
4424
+ ],
4425
+ code: CCE_ERROR.TPS_WINDOW_EXPIRED
4426
+ };
4427
+ }
4428
+ if (nowMs < capsule.tps_from - this.skewMs) {
4429
+ return {
4430
+ allow: false,
4431
+ riskScore: 100,
4432
+ reasons: [
4433
+ `${CCE_ERROR.TPS_WINDOW_FUTURE}: window starts at ${capsule.tps_from}, now=${nowMs}`
4434
+ ],
4435
+ code: CCE_ERROR.TPS_WINDOW_FUTURE
4436
+ };
4437
+ }
4438
+ input.metadata = input.metadata ?? {};
4439
+ input.metadata.cceTpsValid = true;
4440
+ return {
4441
+ decision: "ALLOW" /* ALLOW */,
4442
+ allow: true,
4443
+ riskScore: 0,
4444
+ reasons: []
4445
+ };
4446
+ }
4447
+ };
4448
+
4449
+ // src/cce/sensors/cce-audience-intent-binding.sensor.ts
4450
+ var CceAudienceIntentBindingSensor = class {
4451
+ constructor(axisAudience) {
4452
+ this.axisAudience = axisAudience;
4453
+ this.name = "cce.audience.intent.binding";
4454
+ this.order = 95;
4455
+ this.phase = "POST_DECODE";
4456
+ }
4457
+ supports(input) {
4458
+ return input.metadata?.cceCapsuleVerified === true;
4459
+ }
4460
+ async run(input) {
4461
+ const capsule = input.metadata?.cceCapsule;
4462
+ const envelope = input.metadata?.cceEnvelope;
4463
+ if (!capsule || !envelope) {
4464
+ return {
4465
+ allow: false,
4466
+ riskScore: 100,
4467
+ reasons: [CCE_ERROR.MISSING_CAPSULE],
4468
+ code: CCE_ERROR.MISSING_CAPSULE
4469
+ };
4470
+ }
4471
+ if (capsule.aud !== this.axisAudience) {
4472
+ return {
4473
+ allow: false,
4474
+ riskScore: 100,
4475
+ reasons: [
4476
+ `${CCE_ERROR.AUDIENCE_MISMATCH}: capsule.aud=${capsule.aud}, expected=${this.axisAudience}`
4477
+ ],
4478
+ code: CCE_ERROR.AUDIENCE_MISMATCH
4479
+ };
4480
+ }
4481
+ const requestIntent = input.intent ?? input.metadata?.cceRequestIntent;
4482
+ if (requestIntent && capsule.intent !== requestIntent) {
4483
+ return {
4484
+ allow: false,
4485
+ riskScore: 100,
4486
+ reasons: [
4487
+ `${CCE_ERROR.INTENT_MISMATCH}: capsule.intent=${capsule.intent}, request=${requestIntent}`
4488
+ ],
4489
+ code: CCE_ERROR.INTENT_MISMATCH
4490
+ };
4491
+ }
4492
+ if (envelope.client_kid !== capsule.kid) {
4493
+ return {
4494
+ allow: false,
4495
+ riskScore: 100,
4496
+ reasons: [
4497
+ `${CCE_ERROR.INTENT_MISMATCH}: envelope.kid=${envelope.client_kid}, capsule.kid=${capsule.kid}`
4498
+ ],
4499
+ code: CCE_ERROR.INTENT_MISMATCH
4500
+ };
4501
+ }
4502
+ input.metadata = input.metadata ?? {};
4503
+ input.metadata.cceBindingVerified = true;
4504
+ return {
4505
+ decision: "ALLOW" /* ALLOW */,
4506
+ allow: true,
4507
+ riskScore: 0,
4508
+ reasons: []
4509
+ };
4510
+ }
4511
+ };
4512
+
4513
+ // src/cce/sensors/cce-replay-protection.sensor.ts
4514
+ var InMemoryCceReplayStore = class {
4515
+ constructor() {
4516
+ this.nonces = /* @__PURE__ */ new Map();
4517
+ this.consumed = /* @__PURE__ */ new Set();
4518
+ this.revoked = /* @__PURE__ */ new Set();
4519
+ }
4520
+ async checkAndMark(key, ttlMs) {
4521
+ this.cleanup();
4522
+ if (this.nonces.has(key)) return false;
4523
+ this.nonces.set(key, Date.now() + ttlMs);
4524
+ return true;
4525
+ }
4526
+ async isCapsuleConsumed(capsuleId) {
4527
+ return this.consumed.has(capsuleId);
4528
+ }
4529
+ async markCapsuleConsumed(capsuleId, _ttlMs) {
4530
+ this.consumed.add(capsuleId);
4531
+ }
4532
+ async isCapsuleRevoked(capsuleId) {
4533
+ return this.revoked.has(capsuleId);
4534
+ }
4535
+ /** Revoke a capsule (for testing/admin) */
4536
+ revoke(capsuleId) {
4537
+ this.revoked.add(capsuleId);
4538
+ }
4539
+ cleanup() {
4540
+ const now = Date.now();
4541
+ for (const [key, expiresAt] of this.nonces) {
4542
+ if (expiresAt < now) this.nonces.delete(key);
4543
+ }
4544
+ }
4545
+ };
4546
+ var CceReplayProtectionSensor = class {
4547
+ constructor(replayStore, options) {
4548
+ this.replayStore = replayStore;
4549
+ this.name = "cce.replay.protection";
4550
+ this.order = 98;
4551
+ this.phase = "POST_DECODE";
4552
+ this.nonceTtlMs = options?.nonceTtlMs ?? 5 * 60 * 1e3;
4553
+ }
4554
+ supports(input) {
4555
+ return input.metadata?.cceCapsuleVerified === true;
4556
+ }
4557
+ async run(input) {
4558
+ const capsule = input.metadata?.cceCapsule;
4559
+ const envelope = input.metadata?.cceEnvelope;
4560
+ if (!capsule || !envelope) {
4561
+ return {
4562
+ allow: false,
4563
+ riskScore: 100,
4564
+ reasons: [CCE_ERROR.MISSING_CAPSULE],
4565
+ code: CCE_ERROR.MISSING_CAPSULE
4566
+ };
4567
+ }
4568
+ const revoked = await this.replayStore.isCapsuleRevoked(capsule.capsule_id);
4569
+ if (revoked) {
4570
+ return {
4571
+ allow: false,
4572
+ riskScore: 100,
4573
+ reasons: [`${CCE_ERROR.CAPSULE_REVOKED}: ${capsule.capsule_id}`],
4574
+ code: CCE_ERROR.CAPSULE_REVOKED
4575
+ };
4576
+ }
4577
+ if (capsule.mode === "SINGLE_USE") {
4578
+ const consumed = await this.replayStore.isCapsuleConsumed(
4579
+ capsule.capsule_id
4580
+ );
4581
+ if (consumed) {
4582
+ return {
4583
+ allow: false,
4584
+ riskScore: 100,
4585
+ reasons: [`${CCE_ERROR.CAPSULE_CONSUMED}: ${capsule.capsule_id}`],
4586
+ code: CCE_ERROR.CAPSULE_CONSUMED
4587
+ };
4588
+ }
4589
+ }
4590
+ const nonceKey = `cce:nonce:${capsule.sub}:${capsule.aud}:${capsule.intent}:${envelope.request_nonce}`;
4591
+ const nonceValid = await this.replayStore.checkAndMark(
4592
+ nonceKey,
4593
+ this.nonceTtlMs
4594
+ );
4595
+ if (!nonceValid) {
4596
+ return {
4597
+ allow: false,
4598
+ riskScore: 100,
4599
+ reasons: [
4600
+ `${CCE_ERROR.NONCE_REUSED}: ${envelope.request_nonce.slice(0, 16)}...`
4601
+ ],
4602
+ code: CCE_ERROR.NONCE_REUSED
4603
+ };
4604
+ }
4605
+ if (capsule.mode === "SINGLE_USE") {
4606
+ const capsuleTtl = (capsule.exp - capsule.iat) * 1e3 + 6e4;
4607
+ await this.replayStore.markCapsuleConsumed(
4608
+ capsule.capsule_id,
4609
+ capsuleTtl
4610
+ );
4611
+ }
4612
+ input.metadata = input.metadata ?? {};
4613
+ input.metadata.cceReplayClean = true;
4614
+ return {
4615
+ decision: "ALLOW" /* ALLOW */,
4616
+ allow: true,
4617
+ riskScore: 0,
4618
+ reasons: []
4619
+ };
4620
+ }
4621
+ };
4622
+
4623
+ // src/cce/sensors/cce-payload-decryption.sensor.ts
4624
+ var CcePayloadDecryptionSensor = class {
4625
+ constructor(keyProvider, aesProvider, maxPayloadBytes = 64 * 1024) {
4626
+ this.keyProvider = keyProvider;
4627
+ this.aesProvider = aesProvider;
4628
+ this.maxPayloadBytes = maxPayloadBytes;
4629
+ this.name = "cce.payload.decryption";
4630
+ this.order = 145;
4631
+ this.phase = "POST_DECODE";
4632
+ }
4633
+ supports(input) {
4634
+ return input.metadata?.cceEnvelopeValid === true && input.metadata?.cceClientSigVerified === true && input.metadata?.cceCapsuleVerified === true && input.metadata?.cceReplayClean === true;
4635
+ }
4636
+ async run(input) {
4637
+ const envelope = input.metadata?.cceEnvelope;
4638
+ if (!envelope) {
4639
+ return {
4640
+ allow: false,
4641
+ riskScore: 100,
4642
+ reasons: [CCE_ERROR.INVALID_ENVELOPE],
4643
+ code: CCE_ERROR.INVALID_ENVELOPE
4644
+ };
4645
+ }
4646
+ let aesKey;
4647
+ try {
4648
+ aesKey = await this.keyProvider.unwrapKey(
4649
+ envelope.encrypted_key.ciphertext,
4650
+ envelope.encrypted_key.alg,
4651
+ envelope.encrypted_key.axis_kid,
4652
+ envelope.encrypted_key.ephemeral_pk
4653
+ );
4654
+ } catch {
4655
+ return {
4656
+ allow: false,
4657
+ riskScore: 100,
4658
+ reasons: [CCE_ERROR.KEY_UNWRAP_FAILED],
4659
+ code: CCE_ERROR.KEY_UNWRAP_FAILED
4660
+ };
4661
+ }
4662
+ if (!aesKey) {
4663
+ return {
4664
+ allow: false,
4665
+ riskScore: 100,
4666
+ reasons: [CCE_ERROR.KEY_UNWRAP_FAILED],
4667
+ code: CCE_ERROR.KEY_UNWRAP_FAILED
4668
+ };
4669
+ }
4670
+ let iv;
4671
+ let ciphertext;
4672
+ let tag;
4673
+ try {
4674
+ iv = base64UrlDecode2(envelope.encrypted_payload.iv);
4675
+ ciphertext = base64UrlDecode2(envelope.encrypted_payload.ciphertext);
4676
+ tag = base64UrlDecode2(envelope.encrypted_payload.tag);
4677
+ } catch {
4678
+ return {
4679
+ allow: false,
4680
+ riskScore: 100,
4681
+ reasons: [`${CCE_ERROR.DECRYPTION_FAILED}: invalid base64url encoding`],
4682
+ code: CCE_ERROR.DECRYPTION_FAILED
4683
+ };
4684
+ }
4685
+ if (ciphertext.length > this.maxPayloadBytes) {
4686
+ return {
4687
+ allow: false,
4688
+ riskScore: 100,
4689
+ reasons: [
4690
+ `${CCE_ERROR.PAYLOAD_TOO_LARGE}: ${ciphertext.length} > ${this.maxPayloadBytes}`
4691
+ ],
4692
+ code: CCE_ERROR.PAYLOAD_TOO_LARGE
4693
+ };
4694
+ }
4695
+ const aad = buildAad(envelope);
4696
+ let plaintext;
4697
+ try {
4698
+ plaintext = await this.aesProvider.decrypt(
4699
+ aesKey,
4700
+ iv,
4701
+ ciphertext,
4702
+ tag,
4703
+ aad
4704
+ );
4705
+ } catch {
4706
+ plaintext = null;
4707
+ } finally {
4708
+ aesKey.fill(0);
4709
+ }
4710
+ if (!plaintext) {
4711
+ return {
4712
+ allow: false,
4713
+ riskScore: 100,
4714
+ reasons: [CCE_ERROR.AEAD_TAG_MISMATCH],
4715
+ code: CCE_ERROR.AEAD_TAG_MISMATCH
4716
+ };
4717
+ }
4718
+ input.metadata = input.metadata ?? {};
4719
+ input.metadata.cceDecryptedPayload = plaintext;
4720
+ input.metadata.cceDecryptionOk = true;
4721
+ return {
4722
+ decision: "ALLOW" /* ALLOW */,
4723
+ allow: true,
4724
+ riskScore: 0,
4725
+ reasons: []
4726
+ };
4727
+ }
4728
+ };
4729
+ function buildAad(envelope) {
4730
+ const parts = [
4731
+ envelope.ver,
4732
+ envelope.request_id,
4733
+ envelope.correlation_id,
4734
+ envelope.client_kid,
4735
+ envelope.capsule.capsule_id,
4736
+ envelope.capsule.intent,
4737
+ envelope.capsule.aud,
4738
+ envelope.request_nonce
4739
+ ];
4740
+ return new TextEncoder().encode(parts.join("|"));
4741
+ }
4742
+ function base64UrlDecode2(input) {
4743
+ const base64 = input.replace(/-/g, "+").replace(/_/g, "/");
4744
+ const padding = "=".repeat((4 - base64.length % 4) % 4);
4745
+ const binary = atob(base64 + padding);
4746
+ const bytes2 = new Uint8Array(binary.length);
4747
+ for (let i = 0; i < binary.length; i++) {
4748
+ bytes2[i] = binary.charCodeAt(i);
4749
+ }
4750
+ return bytes2;
4751
+ }
4752
+
3390
4753
  // src/core/index.ts
3391
4754
  var core_exports = {};
3392
4755
  __export(core_exports, {
@@ -3468,7 +4831,7 @@ __export(core_exports, {
3468
4831
  encodeVarint: () => encodeVarint,
3469
4832
  generateEd25519KeyPair: () => generateEd25519KeyPair,
3470
4833
  getSignTarget: () => getSignTarget,
3471
- sha256: () => sha256,
4834
+ sha256: () => sha2564,
3472
4835
  signFrame: () => signFrame,
3473
4836
  varintLength: () => varintLength,
3474
4837
  verifyFrameSignature: () => verifyFrameSignature
@@ -3488,7 +4851,7 @@ __export(crypto_exports, {
3488
4851
 
3489
4852
  // src/crypto/proof-verification.service.ts
3490
4853
  import { Injectable as Injectable8, Logger as Logger7 } from "@nestjs/common";
3491
- import * as crypto3 from "crypto";
4854
+ import * as crypto4 from "crypto";
3492
4855
  import * as nacl from "tweetnacl";
3493
4856
  var ProofVerificationService = class {
3494
4857
  constructor() {
@@ -3700,7 +5063,7 @@ var ProofVerificationService = class {
3700
5063
  certPem.replace(/-----BEGIN CERTIFICATE-----/, "").replace(/-----END CERTIFICATE-----/, "").replace(/\s/g, ""),
3701
5064
  "base64"
3702
5065
  );
3703
- return crypto3.createHash("sha256").update(der).digest("hex");
5066
+ return crypto4.createHash("sha256").update(der).digest("hex");
3704
5067
  }
3705
5068
  };
3706
5069
  ProofVerificationService = __decorateClass([
@@ -4590,7 +5953,7 @@ ChunkHashSensor = __decorateClass([
4590
5953
 
4591
5954
  // src/sensors/entropy.sensor.ts
4592
5955
  import { Injectable as Injectable14, Logger as Logger10 } from "@nestjs/common";
4593
- import * as crypto4 from "crypto";
5956
+ import * as crypto5 from "crypto";
4594
5957
  var EntropySensor = class {
4595
5958
  constructor() {
4596
5959
  this.logger = new Logger10(EntropySensor.name);
@@ -4758,7 +6121,7 @@ var EntropySensor = class {
4758
6121
  * @returns {Uint8Array} Cryptographically secure random bytes
4759
6122
  */
4760
6123
  static generateSecureRandom(length) {
4761
- return new Uint8Array(crypto4.randomBytes(length));
6124
+ return new Uint8Array(crypto5.randomBytes(length));
4762
6125
  }
4763
6126
  };
4764
6127
  EntropySensor = __decorateClass([
@@ -5901,6 +7264,9 @@ export {
5901
7264
  BAND,
5902
7265
  BodyProfile,
5903
7266
  CAPABILITIES,
7267
+ CCE_ERROR,
7268
+ CCE_PROTOCOL_VERSION,
7269
+ CceError,
5904
7270
  ContractViolationError,
5905
7271
  DEFAULT_CONTRACTS,
5906
7272
  DEFAULT_TIMEOUT,
@@ -6027,6 +7393,7 @@ export {
6027
7393
  canonicalJson,
6028
7394
  canonicalJsonExcluding,
6029
7395
  canonicalizeObservation,
7396
+ cce_exports as cce,
6030
7397
  classifyIntent,
6031
7398
  computeReceiptHash,
6032
7399
  computeSignaturePayload,
@@ -6050,6 +7417,7 @@ export {
6050
7417
  encodeVarint,
6051
7418
  endStage,
6052
7419
  engine_exports as engine,
7420
+ executeCcePipeline,
6053
7421
  extractDtoSchema,
6054
7422
  finalizeObservation,
6055
7423
  generateEd25519KeyPair,
@@ -6076,7 +7444,7 @@ export {
6076
7444
  security_exports as security,
6077
7445
  sensitivityName,
6078
7446
  sensors_exports as sensors,
6079
- sha256,
7447
+ sha2564 as sha256,
6080
7448
  signFrame,
6081
7449
  stableJsonStringify,
6082
7450
  startStage,