@continuonai/rcan-ts 1.2.2 → 1.3.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 CHANGED
@@ -102,7 +102,7 @@ declare enum MessageType {
102
102
  /** §8.5 — Sender Type and Service Identity */
103
103
  type SenderType = "robot" | "human" | "cloud_function" | "system";
104
104
  /** §12 — Command Delegation and Chain of Custody */
105
- interface DelegationHop {
105
+ interface DelegationHop$1 {
106
106
  issuerRuri: string;
107
107
  humanSubject: string;
108
108
  timestamp: string;
@@ -139,7 +139,7 @@ interface RCANMessageData {
139
139
  /** v1.5: GAP-09 key id */
140
140
  keyId?: string;
141
141
  /** v1.5: GAP-01 delegation chain */
142
- delegationChain?: DelegationHop[];
142
+ delegationChain?: DelegationHop$1[];
143
143
  /** v1.5: GAP-13 fleet group */
144
144
  groupId?: string;
145
145
  /** v1.5: GAP-11 QoS level */
@@ -161,6 +161,11 @@ interface RCANMessageData {
161
161
  attestationRef?: string;
162
162
  /** v2.2: ML-DSA-65 post-quantum signature block (field 16, FIPS 204). Hybrid mode alongside Ed25519. */
163
163
  pqSig?: PQSignatureBlock | undefined;
164
+ /** v2.2 snake_case envelope aliases (spec §3.2) */
165
+ firmware_hash?: string;
166
+ attestation_ref?: string;
167
+ pq_sig?: string;
168
+ pq_alg?: string;
164
169
  [key: string]: unknown;
165
170
  }
166
171
  declare class RCANMessageError extends Error {
@@ -181,7 +186,7 @@ declare class RCANMessage {
181
186
  readonly senderType: SenderType | undefined;
182
187
  readonly cloudProvider: string | undefined;
183
188
  readonly keyId: string | undefined;
184
- readonly delegationChain: DelegationHop[] | undefined;
189
+ readonly delegationChain: DelegationHop$1[] | undefined;
185
190
  readonly groupId: string | undefined;
186
191
  readonly qos: number | undefined;
187
192
  readonly presenceVerified: boolean | undefined;
@@ -220,7 +225,7 @@ declare function makeCloudRelayMessage(base: RCANMessage, provider: string): RCA
220
225
  /**
221
226
  * §12 — Add a delegation hop to a message.
222
227
  */
223
- declare function addDelegationHop(msg: RCANMessage, hop: DelegationHop): RCANMessage;
228
+ declare function addDelegationHop(msg: RCANMessage, hop: DelegationHop$1): RCANMessage;
224
229
  /**
225
230
  * §12 — Validate a delegation chain (structure only; signature verification
226
231
  * requires crypto module).
@@ -229,7 +234,7 @@ declare function addDelegationHop(msg: RCANMessage, hop: DelegationHop): RCANMes
229
234
  * - Max depth 4 hops
230
235
  * - Each hop must have issuerRuri, humanSubject, timestamp, scope, signature
231
236
  */
232
- declare function validateDelegationChain(chain: DelegationHop[]): {
237
+ declare function validateDelegationChain$1(chain: DelegationHop$1[]): {
233
238
  valid: boolean;
234
239
  reason: string;
235
240
  };
@@ -750,14 +755,14 @@ interface TransparencyMessage {
750
755
  timestamp_ms: number;
751
756
  message_id: string;
752
757
  /** v1.5 GAP-22: third-party control chain */
753
- delegation_chain?: DelegationHop[];
758
+ delegation_chain?: DelegationHop$1[];
754
759
  }
755
760
  /**
756
761
  * Build a TRANSPARENCY message for EU AI Act Article 13 compliance.
757
762
  *
758
763
  * v1.5 (GAP-22): includes delegation_chain when available.
759
764
  */
760
- declare function makeTransparencyMessage(ruri: string, disclosure: string, delegationChain?: DelegationHop[]): TransparencyMessage;
765
+ declare function makeTransparencyMessage(ruri: string, disclosure: string, delegationChain?: DelegationHop$1[]): TransparencyMessage;
761
766
 
762
767
  /**
763
768
  * RCAN Protocol Version — single source of truth.
@@ -1466,7 +1471,7 @@ declare enum MediaEncoding {
1466
1471
  BASE64 = "base64",
1467
1472
  REF = "ref"
1468
1473
  }
1469
- interface MediaChunk {
1474
+ interface MediaChunk$1 {
1470
1475
  chunkId: string;
1471
1476
  mimeType: string;
1472
1477
  encoding: MediaEncoding;
@@ -1479,7 +1484,7 @@ interface StreamChunk {
1479
1484
  streamId: string;
1480
1485
  chunkIndex: number;
1481
1486
  isFinal: boolean;
1482
- chunk: MediaChunk;
1487
+ chunk: MediaChunk$1;
1483
1488
  }
1484
1489
  /**
1485
1490
  * Attach inline (base64-encoded) media to a message.
@@ -1914,6 +1919,135 @@ declare const addPQSignature: typeof signMessage;
1914
1919
  /** @deprecated Use verifyMessage() — Ed25519 is removed in RCAN v2.2 */
1915
1920
  declare function verifyPQSignature(msg: RCANMessage, trustedKeys: MLDSAKeyPair[], _requirePQ?: boolean): Promise<void>;
1916
1921
 
1922
+ /** An ML-DSA-65 key pair (NIST FIPS 204, 192-bit PQ security). */
1923
+ interface MlDsaKeyPair {
1924
+ /** ML-DSA-65 secret key (4032 bytes). */
1925
+ privateKey: Uint8Array;
1926
+ /** ML-DSA-65 public key (1952 bytes). */
1927
+ publicKey: Uint8Array;
1928
+ }
1929
+ /**
1930
+ * Hybrid Ed25519 + ML-DSA-65 signature.
1931
+ * Both algorithms sign the same message; verification requires both to pass.
1932
+ */
1933
+ interface HybridSignature {
1934
+ profile: "pqc-hybrid-v1";
1935
+ /** Ed25519 signature (64 bytes, base-64url decoded). */
1936
+ ed25519Sig: Uint8Array;
1937
+ /** ML-DSA-65 signature (3309 bytes, base-64url decoded). */
1938
+ mlDsaSig: Uint8Array;
1939
+ }
1940
+ /** Generate a fresh ML-DSA-65 key pair. */
1941
+ declare function generateMlDsaKeypair(): MlDsaKeyPair;
1942
+ /** Sign `message` with an ML-DSA-65 secret key. Returns the raw signature. */
1943
+ declare function signMlDsa(privateKey: Uint8Array, message: Uint8Array): Uint8Array;
1944
+ /**
1945
+ * Verify an ML-DSA-65 signature.
1946
+ * @returns `true` if valid, `false` otherwise.
1947
+ */
1948
+ declare function verifyMlDsa(publicKey: Uint8Array, message: Uint8Array, sig: Uint8Array): boolean;
1949
+ /**
1950
+ * Sign `msg` with both Ed25519 and ML-DSA-65.
1951
+ * The caller supplies both private keys; neither is derived from the other.
1952
+ */
1953
+ declare function signHybrid(ed25519Priv: Uint8Array, mlDsaPriv: Uint8Array, msg: Uint8Array): HybridSignature;
1954
+ /**
1955
+ * Verify a hybrid signature. Both Ed25519 and ML-DSA-65 must be valid.
1956
+ * @returns `true` only when both signatures pass.
1957
+ */
1958
+ declare function verifyHybrid(ed25519Pub: Uint8Array, mlDsaPub: Uint8Array, msg: Uint8Array, sig: HybridSignature): boolean;
1959
+ /**
1960
+ * Encode a HybridSignature to a compact string.
1961
+ * Format: `pqc-hybrid-v1.<ed25519-b64url>.<mldsa-b64url>`
1962
+ */
1963
+ declare function encodeHybridSig(sig: HybridSignature): string;
1964
+ /**
1965
+ * Decode a hybrid signature string produced by `encodeHybridSig`.
1966
+ * @throws if the string is not in the expected format.
1967
+ */
1968
+ declare function decodeHybridSig(s: string): HybridSignature;
1969
+ /**
1970
+ * Encode an ML-DSA-65 public key as a JWK-like object.
1971
+ * Uses `kty: "OKP"`, `alg: "ML-DSA-65"`, `x: <base64url>`.
1972
+ */
1973
+ declare function encodeMlDsaPublicKeyJwk(pub: Uint8Array): object;
1974
+ /**
1975
+ * Decode an ML-DSA-65 public key from a JWK-like object.
1976
+ * @throws if `kty` or `alg` fields are wrong.
1977
+ */
1978
+ declare function decodeMlDsaPublicKeyJwk(jwk: object): Uint8Array;
1979
+
1980
+ /**
1981
+ * rcan/mcp.ts — MCP integration types for RCAN v2.2 §22
1982
+ *
1983
+ * Provider-agnostic: LoA is tied to the token, not the model or AI provider.
1984
+ */
1985
+ /** LoA → RCAN command scopes mapping (§22.4) */
1986
+ declare const LOA_TO_SCOPES: Record<number, string[]>;
1987
+ /** Required LoA for each MCP tool (§22.3) */
1988
+ declare const TOOL_LOA_REQUIREMENTS: Record<string, number>;
1989
+ /** MCP client entry stored in the RCAN yaml mcp_clients: block */
1990
+ interface McpClientConfig {
1991
+ name: string;
1992
+ token_hash: string;
1993
+ loa: number;
1994
+ }
1995
+ /** Full MCP server configuration extracted from the RCAN yaml */
1996
+ interface McpServerConfig {
1997
+ rrn: string;
1998
+ clients: McpClientConfig[];
1999
+ }
2000
+ /** Check if a client's LoA satisfies a tool's requirement */
2001
+ declare function clientAllowsTool(client: McpClientConfig, toolName: string): boolean;
2002
+ /** Tool call result shapes */
2003
+ interface RobotStatusResult {
2004
+ rrn: string;
2005
+ status: Record<string, unknown>;
2006
+ }
2007
+ interface FleetListResult {
2008
+ fleet: Record<string, unknown>[];
2009
+ }
2010
+ interface RrfLookupResult {
2011
+ entity_id: string;
2012
+ record: Record<string, unknown>;
2013
+ }
2014
+ interface RobotCommandResult {
2015
+ rrn: string;
2016
+ instruction: string;
2017
+ scope: string;
2018
+ result: Record<string, unknown>;
2019
+ }
2020
+ interface ComplianceReportResult {
2021
+ rrn: string;
2022
+ compliance: Record<string, unknown>;
2023
+ }
2024
+
2025
+ /**
2026
+ * RCAN v2.2 Delegation and Media envelope types.
2027
+ * Spec: https://robotregistryfoundation.org/docs/mcp/
2028
+ */
2029
+ /** A single hop in a v2.2 delegation chain. */
2030
+ interface DelegationHop {
2031
+ robot_rrn: string;
2032
+ scope: string;
2033
+ issued_at: string;
2034
+ expires_at: string;
2035
+ sig?: string;
2036
+ }
2037
+ /** An inline or by-reference media attachment for v2.2 messages. */
2038
+ interface MediaChunk {
2039
+ chunk_id: string;
2040
+ mime_type: string;
2041
+ size_bytes: number;
2042
+ hash_sha256: string;
2043
+ data?: string;
2044
+ ref_url?: string;
2045
+ }
2046
+ declare function validateDelegationChain(chain: DelegationHop[]): void;
2047
+ declare function verifyMediaChunkHash(chunk: MediaChunk): void;
2048
+ type V22DelegationHop = DelegationHop;
2049
+ type V22MediaChunk = MediaChunk;
2050
+
1917
2051
  /**
1918
2052
  * rcan-ts — Official TypeScript SDK for RCAN v1.6
1919
2053
  * Robot Communication and Accountability Network
@@ -1926,4 +2060,4 @@ declare const VERSION = "0.6.0";
1926
2060
  /** @deprecated Use SPEC_VERSION from ./version instead */
1927
2061
  declare const RCAN_VERSION = "1.6";
1928
2062
 
1929
- export { AUTHORITY_ERROR_CODES, type ApprovalStatus, AuditChain, AuditError, type AuditExportRequest, type AuthorityAccessPayload, type AuthorityAccessPayloadWire, type AuthorityDataCategory, type AuthorityResponseData, type AuthorityResponsePayload, COMPETITION_SCOPE_LEVEL, CONTRIBUTE_SCOPE_LEVEL, type CachedKey, type ChainVerifyResult, ClockDriftError, type ClockSyncStatus, CommitmentRecord, type CommitmentRecordData, type CommitmentRecordJSON, type CompetitionBadge, type CompetitionEnter, type CompetitionFormat, type CompetitionScore, type ComputeResource, ConfidenceGate, type ConsentRequestParams, type ConsentResponseParams, type ConsentType, type ContributeCancel, type ContributeRequest, type ContributeResult, DEFAULT_LOA_POLICY, DataCategory, type DelegationHop, FIRMWARE_MANIFEST_PATH, FaultCode, type FaultReportParams, type FaultSeverity, type FederationSyncPayload, FederationSyncType, type FirmwareComponent, FirmwareIntegrityError, type FirmwareManifest, type FirmwareManifestWire, GateError, HiTLGate, type IdentityRecord, type JWKEntry, type JWKSDocument, KeyStore, LevelOfAssurance, type ListResult, type LoaPolicy, M2MAuthError, type M2MPeerClaims, type M2MTrustedClaims, M2M_TRUSTED_ISSUER, MLDSAKeyPair, type MLDSAKeyPairData, type MediaChunk, MediaEncoding, MessageType, NodeClient, type OfflineCommandResult, OfflineModeManager, type OfflineState, PRODUCTION_LOA_POLICY, type PendingApproval, type PersonalResearchResult, QoSAckTimeoutError, QoSLevel, QoSManager, type QoSResult, type QoSSendOptions, RCANAddressError, type RCANAgentConfig, type RCANConfig, RCANConfigAuthorizationError, RCANDelegationChainError, RCANError, RCANGateError, RCANMessage, type RCANMessageData, type RCANMessageEnvelope, RCANMessageError, type RCANMetadata, RCANNodeError, RCANNodeNotFoundError, RCANNodeSyncError, RCANNodeTrustError, RCANRegistryError, type RCANRegistryNode, RCANReplayAttackError, type RCANResolveResult, RCANSignatureError, RCANValidationError, RCANVersionIncompatibleError, RCAN_VERSION, ROLE_JWT_LEVEL, RRF_REVOCATION_CACHE_TTL_MS, RRF_REVOCATION_URL, type RegistrationResult, RegistryClient, type RegistryIdentity, RegistryTier, ReplayCache, type ReplayCheckResult, type ReplayableMessage, type ResearchMetrics, RevocationCache$1 as RevocationCache, type RevocationStatus, type RevocationStatusValue, type Robot, type RobotRegistration, RobotURI, RobotURIError, type RobotURIOptions, Role, type RunType, SAFETY_MESSAGE_TYPE, SCOPE_MIN_ROLE, SDK_VERSION, SPEC_VERSION, type SafetyEvent, type SafetyMessage, type ScopeValidationResult, type SeasonStanding, type SenderType, type SignatureBlock, type StandingEntry, type StreamChunk, type TrainingConsentRequestParams, type TransparencyMessage, TransportEncoding, TransportError, TrustAnchorCache, VERSION, type ValidationResult, type WorkUnitStatus, addDelegationHop, addMediaInline, addMediaRef, addPQSignature, assertClockSynced, authorityAccessFromWire, authorityAccessToWire, canonicalManifestJson, checkClockSync, checkRevocation, decodeBleFrames, decodeCompact, decodeMinimal, encodeBleFrames, encodeCompact, encodeMinimal, extractIdentityFromJwt, extractLoaFromJwt, extractRoleFromJwt, fetchCanonicalSchema, fetchRRFRevocations, isAuthorityRequestValid, isM2mTrustedRevoked, isPreemptedBy, isSafetyMessage, makeCloudRelayMessage, makeCompetitionEnter, makeCompetitionScore, makeConfigUpdate, makeConsentDeny, makeConsentGrant, makeConsentRequest, makeContributeCancel, makeContributeRequest, makeContributeResult, makeEstopMessage, makeEstopWithQoS, makeFaultReport, makeFederationSync, makeKeyRotationMessage, makePersonalResearchResult, makeResumeMessage, makeRevocationBroadcast, makeSeasonStanding, makeStopMessage, makeStreamChunk, makeTrainingConsentDeny, makeTrainingConsentGrant, makeTrainingConsentRequest, makeTrainingDataMessage, makeTransparencyMessage, manifestFromWire, manifestToWire, parseM2mPeerToken, parseM2mTrustedToken, roleFromJwtLevel, selectTransport, signMessage, validateAuthorityAccess, validateCompetitionScope, validateConfig, validateConfigAgainstSchema, validateConfigUpdate, validateConsentMessage, validateContributeScope, validateCrossRegistryCommand, validateDelegationChain, validateLoaForScope, validateManifest, validateMediaChunks, validateMessage, validateNodeAgainstSchema, validateReplay, validateRoleForScope, validateSafetyMessage, validateTrainingDataMessage, validateURI, validateVersionCompat, verifyM2mTrustedToken, verifyM2mTrustedTokenClaims, verifyMessage, verifyPQSignature };
2063
+ export { AUTHORITY_ERROR_CODES, type ApprovalStatus, AuditChain, AuditError, type AuditExportRequest, type AuthorityAccessPayload, type AuthorityAccessPayloadWire, type AuthorityDataCategory, type AuthorityResponseData, type AuthorityResponsePayload, COMPETITION_SCOPE_LEVEL, CONTRIBUTE_SCOPE_LEVEL, type CachedKey, type ChainVerifyResult, ClockDriftError, type ClockSyncStatus, CommitmentRecord, type CommitmentRecordData, type CommitmentRecordJSON, type CompetitionBadge, type CompetitionEnter, type CompetitionFormat, type CompetitionScore, type ComplianceReportResult, type ComputeResource, ConfidenceGate, type ConsentRequestParams, type ConsentResponseParams, type ConsentType, type ContributeCancel, type ContributeRequest, type ContributeResult, DEFAULT_LOA_POLICY, DataCategory, type DelegationHop$1 as DelegationHop, FIRMWARE_MANIFEST_PATH, FaultCode, type FaultReportParams, type FaultSeverity, type FederationSyncPayload, FederationSyncType, type FirmwareComponent, FirmwareIntegrityError, type FirmwareManifest, type FirmwareManifestWire, type FleetListResult, GateError, HiTLGate, type HybridSignature, type IdentityRecord, type JWKEntry, type JWKSDocument, KeyStore, LOA_TO_SCOPES, LevelOfAssurance, type ListResult, type LoaPolicy, M2MAuthError, type M2MPeerClaims, type M2MTrustedClaims, M2M_TRUSTED_ISSUER, MLDSAKeyPair, type MLDSAKeyPairData, type McpClientConfig, type McpServerConfig, type MediaChunk$1 as MediaChunk, MediaEncoding, MessageType, type MlDsaKeyPair, NodeClient, type OfflineCommandResult, OfflineModeManager, type OfflineState, PRODUCTION_LOA_POLICY, type PendingApproval, type PersonalResearchResult, QoSAckTimeoutError, QoSLevel, QoSManager, type QoSResult, type QoSSendOptions, RCANAddressError, type RCANAgentConfig, type RCANConfig, RCANConfigAuthorizationError, RCANDelegationChainError, RCANError, RCANGateError, RCANMessage, type RCANMessageData, type RCANMessageEnvelope, RCANMessageError, type RCANMetadata, RCANNodeError, RCANNodeNotFoundError, RCANNodeSyncError, RCANNodeTrustError, RCANRegistryError, type RCANRegistryNode, RCANReplayAttackError, type RCANResolveResult, RCANSignatureError, RCANValidationError, RCANVersionIncompatibleError, RCAN_VERSION, ROLE_JWT_LEVEL, RRF_REVOCATION_CACHE_TTL_MS, RRF_REVOCATION_URL, type RegistrationResult, RegistryClient, type RegistryIdentity, RegistryTier, ReplayCache, type ReplayCheckResult, type ReplayableMessage, type ResearchMetrics, RevocationCache$1 as RevocationCache, type RevocationStatus, type RevocationStatusValue, type Robot, type RobotCommandResult, type RobotRegistration, type RobotStatusResult, RobotURI, RobotURIError, type RobotURIOptions, Role, type RrfLookupResult, type RunType, SAFETY_MESSAGE_TYPE, SCOPE_MIN_ROLE, SDK_VERSION, SPEC_VERSION, type SafetyEvent, type SafetyMessage, type ScopeValidationResult, type SeasonStanding, type SenderType, type SignatureBlock, type StandingEntry, type StreamChunk, TOOL_LOA_REQUIREMENTS, type TrainingConsentRequestParams, type TransparencyMessage, TransportEncoding, TransportError, TrustAnchorCache, type V22DelegationHop, type V22MediaChunk, VERSION, type ValidationResult, type WorkUnitStatus, addDelegationHop, addMediaInline, addMediaRef, addPQSignature, assertClockSynced, authorityAccessFromWire, authorityAccessToWire, canonicalManifestJson, checkClockSync, checkRevocation, clientAllowsTool, decodeBleFrames, decodeCompact, decodeHybridSig, decodeMinimal, decodeMlDsaPublicKeyJwk, encodeBleFrames, encodeCompact, encodeHybridSig, encodeMinimal, encodeMlDsaPublicKeyJwk, extractIdentityFromJwt, extractLoaFromJwt, extractRoleFromJwt, fetchCanonicalSchema, fetchRRFRevocations, generateMlDsaKeypair, isAuthorityRequestValid, isM2mTrustedRevoked, isPreemptedBy, isSafetyMessage, makeCloudRelayMessage, makeCompetitionEnter, makeCompetitionScore, makeConfigUpdate, makeConsentDeny, makeConsentGrant, makeConsentRequest, makeContributeCancel, makeContributeRequest, makeContributeResult, makeEstopMessage, makeEstopWithQoS, makeFaultReport, makeFederationSync, makeKeyRotationMessage, makePersonalResearchResult, makeResumeMessage, makeRevocationBroadcast, makeSeasonStanding, makeStopMessage, makeStreamChunk, makeTrainingConsentDeny, makeTrainingConsentGrant, makeTrainingConsentRequest, makeTrainingDataMessage, makeTransparencyMessage, manifestFromWire, manifestToWire, parseM2mPeerToken, parseM2mTrustedToken, roleFromJwtLevel, selectTransport, signHybrid, signMessage, signMlDsa, validateAuthorityAccess, validateCompetitionScope, validateConfig, validateConfigAgainstSchema, validateConfigUpdate, validateConsentMessage, validateContributeScope, validateCrossRegistryCommand, validateDelegationChain$1 as validateDelegationChain, validateLoaForScope, validateManifest, validateMediaChunks, validateMessage, validateNodeAgainstSchema, validateReplay, validateRoleForScope, validateSafetyMessage, validateTrainingDataMessage, validateURI, validateDelegationChain as validateV22DelegationChain, validateVersionCompat, verifyHybrid, verifyM2mTrustedToken, verifyM2mTrustedTokenClaims, verifyMessage, verifyMlDsa, verifyPQSignature, verifyMediaChunkHash as verifyV22MediaChunkHash };
package/dist/index.d.ts CHANGED
@@ -102,7 +102,7 @@ declare enum MessageType {
102
102
  /** §8.5 — Sender Type and Service Identity */
103
103
  type SenderType = "robot" | "human" | "cloud_function" | "system";
104
104
  /** §12 — Command Delegation and Chain of Custody */
105
- interface DelegationHop {
105
+ interface DelegationHop$1 {
106
106
  issuerRuri: string;
107
107
  humanSubject: string;
108
108
  timestamp: string;
@@ -139,7 +139,7 @@ interface RCANMessageData {
139
139
  /** v1.5: GAP-09 key id */
140
140
  keyId?: string;
141
141
  /** v1.5: GAP-01 delegation chain */
142
- delegationChain?: DelegationHop[];
142
+ delegationChain?: DelegationHop$1[];
143
143
  /** v1.5: GAP-13 fleet group */
144
144
  groupId?: string;
145
145
  /** v1.5: GAP-11 QoS level */
@@ -161,6 +161,11 @@ interface RCANMessageData {
161
161
  attestationRef?: string;
162
162
  /** v2.2: ML-DSA-65 post-quantum signature block (field 16, FIPS 204). Hybrid mode alongside Ed25519. */
163
163
  pqSig?: PQSignatureBlock | undefined;
164
+ /** v2.2 snake_case envelope aliases (spec §3.2) */
165
+ firmware_hash?: string;
166
+ attestation_ref?: string;
167
+ pq_sig?: string;
168
+ pq_alg?: string;
164
169
  [key: string]: unknown;
165
170
  }
166
171
  declare class RCANMessageError extends Error {
@@ -181,7 +186,7 @@ declare class RCANMessage {
181
186
  readonly senderType: SenderType | undefined;
182
187
  readonly cloudProvider: string | undefined;
183
188
  readonly keyId: string | undefined;
184
- readonly delegationChain: DelegationHop[] | undefined;
189
+ readonly delegationChain: DelegationHop$1[] | undefined;
185
190
  readonly groupId: string | undefined;
186
191
  readonly qos: number | undefined;
187
192
  readonly presenceVerified: boolean | undefined;
@@ -220,7 +225,7 @@ declare function makeCloudRelayMessage(base: RCANMessage, provider: string): RCA
220
225
  /**
221
226
  * §12 — Add a delegation hop to a message.
222
227
  */
223
- declare function addDelegationHop(msg: RCANMessage, hop: DelegationHop): RCANMessage;
228
+ declare function addDelegationHop(msg: RCANMessage, hop: DelegationHop$1): RCANMessage;
224
229
  /**
225
230
  * §12 — Validate a delegation chain (structure only; signature verification
226
231
  * requires crypto module).
@@ -229,7 +234,7 @@ declare function addDelegationHop(msg: RCANMessage, hop: DelegationHop): RCANMes
229
234
  * - Max depth 4 hops
230
235
  * - Each hop must have issuerRuri, humanSubject, timestamp, scope, signature
231
236
  */
232
- declare function validateDelegationChain(chain: DelegationHop[]): {
237
+ declare function validateDelegationChain$1(chain: DelegationHop$1[]): {
233
238
  valid: boolean;
234
239
  reason: string;
235
240
  };
@@ -750,14 +755,14 @@ interface TransparencyMessage {
750
755
  timestamp_ms: number;
751
756
  message_id: string;
752
757
  /** v1.5 GAP-22: third-party control chain */
753
- delegation_chain?: DelegationHop[];
758
+ delegation_chain?: DelegationHop$1[];
754
759
  }
755
760
  /**
756
761
  * Build a TRANSPARENCY message for EU AI Act Article 13 compliance.
757
762
  *
758
763
  * v1.5 (GAP-22): includes delegation_chain when available.
759
764
  */
760
- declare function makeTransparencyMessage(ruri: string, disclosure: string, delegationChain?: DelegationHop[]): TransparencyMessage;
765
+ declare function makeTransparencyMessage(ruri: string, disclosure: string, delegationChain?: DelegationHop$1[]): TransparencyMessage;
761
766
 
762
767
  /**
763
768
  * RCAN Protocol Version — single source of truth.
@@ -1466,7 +1471,7 @@ declare enum MediaEncoding {
1466
1471
  BASE64 = "base64",
1467
1472
  REF = "ref"
1468
1473
  }
1469
- interface MediaChunk {
1474
+ interface MediaChunk$1 {
1470
1475
  chunkId: string;
1471
1476
  mimeType: string;
1472
1477
  encoding: MediaEncoding;
@@ -1479,7 +1484,7 @@ interface StreamChunk {
1479
1484
  streamId: string;
1480
1485
  chunkIndex: number;
1481
1486
  isFinal: boolean;
1482
- chunk: MediaChunk;
1487
+ chunk: MediaChunk$1;
1483
1488
  }
1484
1489
  /**
1485
1490
  * Attach inline (base64-encoded) media to a message.
@@ -1914,6 +1919,135 @@ declare const addPQSignature: typeof signMessage;
1914
1919
  /** @deprecated Use verifyMessage() — Ed25519 is removed in RCAN v2.2 */
1915
1920
  declare function verifyPQSignature(msg: RCANMessage, trustedKeys: MLDSAKeyPair[], _requirePQ?: boolean): Promise<void>;
1916
1921
 
1922
+ /** An ML-DSA-65 key pair (NIST FIPS 204, 192-bit PQ security). */
1923
+ interface MlDsaKeyPair {
1924
+ /** ML-DSA-65 secret key (4032 bytes). */
1925
+ privateKey: Uint8Array;
1926
+ /** ML-DSA-65 public key (1952 bytes). */
1927
+ publicKey: Uint8Array;
1928
+ }
1929
+ /**
1930
+ * Hybrid Ed25519 + ML-DSA-65 signature.
1931
+ * Both algorithms sign the same message; verification requires both to pass.
1932
+ */
1933
+ interface HybridSignature {
1934
+ profile: "pqc-hybrid-v1";
1935
+ /** Ed25519 signature (64 bytes, base-64url decoded). */
1936
+ ed25519Sig: Uint8Array;
1937
+ /** ML-DSA-65 signature (3309 bytes, base-64url decoded). */
1938
+ mlDsaSig: Uint8Array;
1939
+ }
1940
+ /** Generate a fresh ML-DSA-65 key pair. */
1941
+ declare function generateMlDsaKeypair(): MlDsaKeyPair;
1942
+ /** Sign `message` with an ML-DSA-65 secret key. Returns the raw signature. */
1943
+ declare function signMlDsa(privateKey: Uint8Array, message: Uint8Array): Uint8Array;
1944
+ /**
1945
+ * Verify an ML-DSA-65 signature.
1946
+ * @returns `true` if valid, `false` otherwise.
1947
+ */
1948
+ declare function verifyMlDsa(publicKey: Uint8Array, message: Uint8Array, sig: Uint8Array): boolean;
1949
+ /**
1950
+ * Sign `msg` with both Ed25519 and ML-DSA-65.
1951
+ * The caller supplies both private keys; neither is derived from the other.
1952
+ */
1953
+ declare function signHybrid(ed25519Priv: Uint8Array, mlDsaPriv: Uint8Array, msg: Uint8Array): HybridSignature;
1954
+ /**
1955
+ * Verify a hybrid signature. Both Ed25519 and ML-DSA-65 must be valid.
1956
+ * @returns `true` only when both signatures pass.
1957
+ */
1958
+ declare function verifyHybrid(ed25519Pub: Uint8Array, mlDsaPub: Uint8Array, msg: Uint8Array, sig: HybridSignature): boolean;
1959
+ /**
1960
+ * Encode a HybridSignature to a compact string.
1961
+ * Format: `pqc-hybrid-v1.<ed25519-b64url>.<mldsa-b64url>`
1962
+ */
1963
+ declare function encodeHybridSig(sig: HybridSignature): string;
1964
+ /**
1965
+ * Decode a hybrid signature string produced by `encodeHybridSig`.
1966
+ * @throws if the string is not in the expected format.
1967
+ */
1968
+ declare function decodeHybridSig(s: string): HybridSignature;
1969
+ /**
1970
+ * Encode an ML-DSA-65 public key as a JWK-like object.
1971
+ * Uses `kty: "OKP"`, `alg: "ML-DSA-65"`, `x: <base64url>`.
1972
+ */
1973
+ declare function encodeMlDsaPublicKeyJwk(pub: Uint8Array): object;
1974
+ /**
1975
+ * Decode an ML-DSA-65 public key from a JWK-like object.
1976
+ * @throws if `kty` or `alg` fields are wrong.
1977
+ */
1978
+ declare function decodeMlDsaPublicKeyJwk(jwk: object): Uint8Array;
1979
+
1980
+ /**
1981
+ * rcan/mcp.ts — MCP integration types for RCAN v2.2 §22
1982
+ *
1983
+ * Provider-agnostic: LoA is tied to the token, not the model or AI provider.
1984
+ */
1985
+ /** LoA → RCAN command scopes mapping (§22.4) */
1986
+ declare const LOA_TO_SCOPES: Record<number, string[]>;
1987
+ /** Required LoA for each MCP tool (§22.3) */
1988
+ declare const TOOL_LOA_REQUIREMENTS: Record<string, number>;
1989
+ /** MCP client entry stored in the RCAN yaml mcp_clients: block */
1990
+ interface McpClientConfig {
1991
+ name: string;
1992
+ token_hash: string;
1993
+ loa: number;
1994
+ }
1995
+ /** Full MCP server configuration extracted from the RCAN yaml */
1996
+ interface McpServerConfig {
1997
+ rrn: string;
1998
+ clients: McpClientConfig[];
1999
+ }
2000
+ /** Check if a client's LoA satisfies a tool's requirement */
2001
+ declare function clientAllowsTool(client: McpClientConfig, toolName: string): boolean;
2002
+ /** Tool call result shapes */
2003
+ interface RobotStatusResult {
2004
+ rrn: string;
2005
+ status: Record<string, unknown>;
2006
+ }
2007
+ interface FleetListResult {
2008
+ fleet: Record<string, unknown>[];
2009
+ }
2010
+ interface RrfLookupResult {
2011
+ entity_id: string;
2012
+ record: Record<string, unknown>;
2013
+ }
2014
+ interface RobotCommandResult {
2015
+ rrn: string;
2016
+ instruction: string;
2017
+ scope: string;
2018
+ result: Record<string, unknown>;
2019
+ }
2020
+ interface ComplianceReportResult {
2021
+ rrn: string;
2022
+ compliance: Record<string, unknown>;
2023
+ }
2024
+
2025
+ /**
2026
+ * RCAN v2.2 Delegation and Media envelope types.
2027
+ * Spec: https://robotregistryfoundation.org/docs/mcp/
2028
+ */
2029
+ /** A single hop in a v2.2 delegation chain. */
2030
+ interface DelegationHop {
2031
+ robot_rrn: string;
2032
+ scope: string;
2033
+ issued_at: string;
2034
+ expires_at: string;
2035
+ sig?: string;
2036
+ }
2037
+ /** An inline or by-reference media attachment for v2.2 messages. */
2038
+ interface MediaChunk {
2039
+ chunk_id: string;
2040
+ mime_type: string;
2041
+ size_bytes: number;
2042
+ hash_sha256: string;
2043
+ data?: string;
2044
+ ref_url?: string;
2045
+ }
2046
+ declare function validateDelegationChain(chain: DelegationHop[]): void;
2047
+ declare function verifyMediaChunkHash(chunk: MediaChunk): void;
2048
+ type V22DelegationHop = DelegationHop;
2049
+ type V22MediaChunk = MediaChunk;
2050
+
1917
2051
  /**
1918
2052
  * rcan-ts — Official TypeScript SDK for RCAN v1.6
1919
2053
  * Robot Communication and Accountability Network
@@ -1926,4 +2060,4 @@ declare const VERSION = "0.6.0";
1926
2060
  /** @deprecated Use SPEC_VERSION from ./version instead */
1927
2061
  declare const RCAN_VERSION = "1.6";
1928
2062
 
1929
- export { AUTHORITY_ERROR_CODES, type ApprovalStatus, AuditChain, AuditError, type AuditExportRequest, type AuthorityAccessPayload, type AuthorityAccessPayloadWire, type AuthorityDataCategory, type AuthorityResponseData, type AuthorityResponsePayload, COMPETITION_SCOPE_LEVEL, CONTRIBUTE_SCOPE_LEVEL, type CachedKey, type ChainVerifyResult, ClockDriftError, type ClockSyncStatus, CommitmentRecord, type CommitmentRecordData, type CommitmentRecordJSON, type CompetitionBadge, type CompetitionEnter, type CompetitionFormat, type CompetitionScore, type ComputeResource, ConfidenceGate, type ConsentRequestParams, type ConsentResponseParams, type ConsentType, type ContributeCancel, type ContributeRequest, type ContributeResult, DEFAULT_LOA_POLICY, DataCategory, type DelegationHop, FIRMWARE_MANIFEST_PATH, FaultCode, type FaultReportParams, type FaultSeverity, type FederationSyncPayload, FederationSyncType, type FirmwareComponent, FirmwareIntegrityError, type FirmwareManifest, type FirmwareManifestWire, GateError, HiTLGate, type IdentityRecord, type JWKEntry, type JWKSDocument, KeyStore, LevelOfAssurance, type ListResult, type LoaPolicy, M2MAuthError, type M2MPeerClaims, type M2MTrustedClaims, M2M_TRUSTED_ISSUER, MLDSAKeyPair, type MLDSAKeyPairData, type MediaChunk, MediaEncoding, MessageType, NodeClient, type OfflineCommandResult, OfflineModeManager, type OfflineState, PRODUCTION_LOA_POLICY, type PendingApproval, type PersonalResearchResult, QoSAckTimeoutError, QoSLevel, QoSManager, type QoSResult, type QoSSendOptions, RCANAddressError, type RCANAgentConfig, type RCANConfig, RCANConfigAuthorizationError, RCANDelegationChainError, RCANError, RCANGateError, RCANMessage, type RCANMessageData, type RCANMessageEnvelope, RCANMessageError, type RCANMetadata, RCANNodeError, RCANNodeNotFoundError, RCANNodeSyncError, RCANNodeTrustError, RCANRegistryError, type RCANRegistryNode, RCANReplayAttackError, type RCANResolveResult, RCANSignatureError, RCANValidationError, RCANVersionIncompatibleError, RCAN_VERSION, ROLE_JWT_LEVEL, RRF_REVOCATION_CACHE_TTL_MS, RRF_REVOCATION_URL, type RegistrationResult, RegistryClient, type RegistryIdentity, RegistryTier, ReplayCache, type ReplayCheckResult, type ReplayableMessage, type ResearchMetrics, RevocationCache$1 as RevocationCache, type RevocationStatus, type RevocationStatusValue, type Robot, type RobotRegistration, RobotURI, RobotURIError, type RobotURIOptions, Role, type RunType, SAFETY_MESSAGE_TYPE, SCOPE_MIN_ROLE, SDK_VERSION, SPEC_VERSION, type SafetyEvent, type SafetyMessage, type ScopeValidationResult, type SeasonStanding, type SenderType, type SignatureBlock, type StandingEntry, type StreamChunk, type TrainingConsentRequestParams, type TransparencyMessage, TransportEncoding, TransportError, TrustAnchorCache, VERSION, type ValidationResult, type WorkUnitStatus, addDelegationHop, addMediaInline, addMediaRef, addPQSignature, assertClockSynced, authorityAccessFromWire, authorityAccessToWire, canonicalManifestJson, checkClockSync, checkRevocation, decodeBleFrames, decodeCompact, decodeMinimal, encodeBleFrames, encodeCompact, encodeMinimal, extractIdentityFromJwt, extractLoaFromJwt, extractRoleFromJwt, fetchCanonicalSchema, fetchRRFRevocations, isAuthorityRequestValid, isM2mTrustedRevoked, isPreemptedBy, isSafetyMessage, makeCloudRelayMessage, makeCompetitionEnter, makeCompetitionScore, makeConfigUpdate, makeConsentDeny, makeConsentGrant, makeConsentRequest, makeContributeCancel, makeContributeRequest, makeContributeResult, makeEstopMessage, makeEstopWithQoS, makeFaultReport, makeFederationSync, makeKeyRotationMessage, makePersonalResearchResult, makeResumeMessage, makeRevocationBroadcast, makeSeasonStanding, makeStopMessage, makeStreamChunk, makeTrainingConsentDeny, makeTrainingConsentGrant, makeTrainingConsentRequest, makeTrainingDataMessage, makeTransparencyMessage, manifestFromWire, manifestToWire, parseM2mPeerToken, parseM2mTrustedToken, roleFromJwtLevel, selectTransport, signMessage, validateAuthorityAccess, validateCompetitionScope, validateConfig, validateConfigAgainstSchema, validateConfigUpdate, validateConsentMessage, validateContributeScope, validateCrossRegistryCommand, validateDelegationChain, validateLoaForScope, validateManifest, validateMediaChunks, validateMessage, validateNodeAgainstSchema, validateReplay, validateRoleForScope, validateSafetyMessage, validateTrainingDataMessage, validateURI, validateVersionCompat, verifyM2mTrustedToken, verifyM2mTrustedTokenClaims, verifyMessage, verifyPQSignature };
2063
+ export { AUTHORITY_ERROR_CODES, type ApprovalStatus, AuditChain, AuditError, type AuditExportRequest, type AuthorityAccessPayload, type AuthorityAccessPayloadWire, type AuthorityDataCategory, type AuthorityResponseData, type AuthorityResponsePayload, COMPETITION_SCOPE_LEVEL, CONTRIBUTE_SCOPE_LEVEL, type CachedKey, type ChainVerifyResult, ClockDriftError, type ClockSyncStatus, CommitmentRecord, type CommitmentRecordData, type CommitmentRecordJSON, type CompetitionBadge, type CompetitionEnter, type CompetitionFormat, type CompetitionScore, type ComplianceReportResult, type ComputeResource, ConfidenceGate, type ConsentRequestParams, type ConsentResponseParams, type ConsentType, type ContributeCancel, type ContributeRequest, type ContributeResult, DEFAULT_LOA_POLICY, DataCategory, type DelegationHop$1 as DelegationHop, FIRMWARE_MANIFEST_PATH, FaultCode, type FaultReportParams, type FaultSeverity, type FederationSyncPayload, FederationSyncType, type FirmwareComponent, FirmwareIntegrityError, type FirmwareManifest, type FirmwareManifestWire, type FleetListResult, GateError, HiTLGate, type HybridSignature, type IdentityRecord, type JWKEntry, type JWKSDocument, KeyStore, LOA_TO_SCOPES, LevelOfAssurance, type ListResult, type LoaPolicy, M2MAuthError, type M2MPeerClaims, type M2MTrustedClaims, M2M_TRUSTED_ISSUER, MLDSAKeyPair, type MLDSAKeyPairData, type McpClientConfig, type McpServerConfig, type MediaChunk$1 as MediaChunk, MediaEncoding, MessageType, type MlDsaKeyPair, NodeClient, type OfflineCommandResult, OfflineModeManager, type OfflineState, PRODUCTION_LOA_POLICY, type PendingApproval, type PersonalResearchResult, QoSAckTimeoutError, QoSLevel, QoSManager, type QoSResult, type QoSSendOptions, RCANAddressError, type RCANAgentConfig, type RCANConfig, RCANConfigAuthorizationError, RCANDelegationChainError, RCANError, RCANGateError, RCANMessage, type RCANMessageData, type RCANMessageEnvelope, RCANMessageError, type RCANMetadata, RCANNodeError, RCANNodeNotFoundError, RCANNodeSyncError, RCANNodeTrustError, RCANRegistryError, type RCANRegistryNode, RCANReplayAttackError, type RCANResolveResult, RCANSignatureError, RCANValidationError, RCANVersionIncompatibleError, RCAN_VERSION, ROLE_JWT_LEVEL, RRF_REVOCATION_CACHE_TTL_MS, RRF_REVOCATION_URL, type RegistrationResult, RegistryClient, type RegistryIdentity, RegistryTier, ReplayCache, type ReplayCheckResult, type ReplayableMessage, type ResearchMetrics, RevocationCache$1 as RevocationCache, type RevocationStatus, type RevocationStatusValue, type Robot, type RobotCommandResult, type RobotRegistration, type RobotStatusResult, RobotURI, RobotURIError, type RobotURIOptions, Role, type RrfLookupResult, type RunType, SAFETY_MESSAGE_TYPE, SCOPE_MIN_ROLE, SDK_VERSION, SPEC_VERSION, type SafetyEvent, type SafetyMessage, type ScopeValidationResult, type SeasonStanding, type SenderType, type SignatureBlock, type StandingEntry, type StreamChunk, TOOL_LOA_REQUIREMENTS, type TrainingConsentRequestParams, type TransparencyMessage, TransportEncoding, TransportError, TrustAnchorCache, type V22DelegationHop, type V22MediaChunk, VERSION, type ValidationResult, type WorkUnitStatus, addDelegationHop, addMediaInline, addMediaRef, addPQSignature, assertClockSynced, authorityAccessFromWire, authorityAccessToWire, canonicalManifestJson, checkClockSync, checkRevocation, clientAllowsTool, decodeBleFrames, decodeCompact, decodeHybridSig, decodeMinimal, decodeMlDsaPublicKeyJwk, encodeBleFrames, encodeCompact, encodeHybridSig, encodeMinimal, encodeMlDsaPublicKeyJwk, extractIdentityFromJwt, extractLoaFromJwt, extractRoleFromJwt, fetchCanonicalSchema, fetchRRFRevocations, generateMlDsaKeypair, isAuthorityRequestValid, isM2mTrustedRevoked, isPreemptedBy, isSafetyMessage, makeCloudRelayMessage, makeCompetitionEnter, makeCompetitionScore, makeConfigUpdate, makeConsentDeny, makeConsentGrant, makeConsentRequest, makeContributeCancel, makeContributeRequest, makeContributeResult, makeEstopMessage, makeEstopWithQoS, makeFaultReport, makeFederationSync, makeKeyRotationMessage, makePersonalResearchResult, makeResumeMessage, makeRevocationBroadcast, makeSeasonStanding, makeStopMessage, makeStreamChunk, makeTrainingConsentDeny, makeTrainingConsentGrant, makeTrainingConsentRequest, makeTrainingDataMessage, makeTransparencyMessage, manifestFromWire, manifestToWire, parseM2mPeerToken, parseM2mTrustedToken, roleFromJwtLevel, selectTransport, signHybrid, signMessage, signMlDsa, validateAuthorityAccess, validateCompetitionScope, validateConfig, validateConfigAgainstSchema, validateConfigUpdate, validateConsentMessage, validateContributeScope, validateCrossRegistryCommand, validateDelegationChain$1 as validateDelegationChain, validateLoaForScope, validateManifest, validateMediaChunks, validateMessage, validateNodeAgainstSchema, validateReplay, validateRoleForScope, validateSafetyMessage, validateTrainingDataMessage, validateURI, validateDelegationChain as validateV22DelegationChain, validateVersionCompat, verifyHybrid, verifyM2mTrustedToken, verifyM2mTrustedTokenClaims, verifyMessage, verifyMlDsa, verifyPQSignature, verifyMediaChunkHash as verifyV22MediaChunkHash };