@continuonai/rcan-ts 1.2.2 → 1.2.3
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/browser.d.mts +86 -10
- package/dist/browser.mjs +66 -1
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +86 -10
- package/dist/index.d.ts +86 -10
- package/dist/index.js +72 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -1
- package/dist/index.mjs.map +1 -1
- package/dist/rcan.iife.js +2 -2
- package/package.json +1 -1
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,77 @@ 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
|
+
/**
|
|
1923
|
+
* rcan/mcp.ts — MCP integration types for RCAN v2.2 §22
|
|
1924
|
+
*
|
|
1925
|
+
* Provider-agnostic: LoA is tied to the token, not the model or AI provider.
|
|
1926
|
+
*/
|
|
1927
|
+
/** LoA → RCAN command scopes mapping (§22.4) */
|
|
1928
|
+
declare const LOA_TO_SCOPES: Record<number, string[]>;
|
|
1929
|
+
/** Required LoA for each MCP tool (§22.3) */
|
|
1930
|
+
declare const TOOL_LOA_REQUIREMENTS: Record<string, number>;
|
|
1931
|
+
/** MCP client entry stored in the RCAN yaml mcp_clients: block */
|
|
1932
|
+
interface McpClientConfig {
|
|
1933
|
+
name: string;
|
|
1934
|
+
token_hash: string;
|
|
1935
|
+
loa: number;
|
|
1936
|
+
}
|
|
1937
|
+
/** Full MCP server configuration extracted from the RCAN yaml */
|
|
1938
|
+
interface McpServerConfig {
|
|
1939
|
+
rrn: string;
|
|
1940
|
+
clients: McpClientConfig[];
|
|
1941
|
+
}
|
|
1942
|
+
/** Check if a client's LoA satisfies a tool's requirement */
|
|
1943
|
+
declare function clientAllowsTool(client: McpClientConfig, toolName: string): boolean;
|
|
1944
|
+
/** Tool call result shapes */
|
|
1945
|
+
interface RobotStatusResult {
|
|
1946
|
+
rrn: string;
|
|
1947
|
+
status: Record<string, unknown>;
|
|
1948
|
+
}
|
|
1949
|
+
interface FleetListResult {
|
|
1950
|
+
fleet: Record<string, unknown>[];
|
|
1951
|
+
}
|
|
1952
|
+
interface RrfLookupResult {
|
|
1953
|
+
entity_id: string;
|
|
1954
|
+
record: Record<string, unknown>;
|
|
1955
|
+
}
|
|
1956
|
+
interface RobotCommandResult {
|
|
1957
|
+
rrn: string;
|
|
1958
|
+
instruction: string;
|
|
1959
|
+
scope: string;
|
|
1960
|
+
result: Record<string, unknown>;
|
|
1961
|
+
}
|
|
1962
|
+
interface ComplianceReportResult {
|
|
1963
|
+
rrn: string;
|
|
1964
|
+
compliance: Record<string, unknown>;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
/**
|
|
1968
|
+
* RCAN v2.2 Delegation and Media envelope types.
|
|
1969
|
+
* Spec: https://robotregistryfoundation.org/docs/mcp/
|
|
1970
|
+
*/
|
|
1971
|
+
/** A single hop in a v2.2 delegation chain. */
|
|
1972
|
+
interface DelegationHop {
|
|
1973
|
+
robot_rrn: string;
|
|
1974
|
+
scope: string;
|
|
1975
|
+
issued_at: string;
|
|
1976
|
+
expires_at: string;
|
|
1977
|
+
sig?: string;
|
|
1978
|
+
}
|
|
1979
|
+
/** An inline or by-reference media attachment for v2.2 messages. */
|
|
1980
|
+
interface MediaChunk {
|
|
1981
|
+
chunk_id: string;
|
|
1982
|
+
mime_type: string;
|
|
1983
|
+
size_bytes: number;
|
|
1984
|
+
hash_sha256: string;
|
|
1985
|
+
data?: string;
|
|
1986
|
+
ref_url?: string;
|
|
1987
|
+
}
|
|
1988
|
+
declare function validateDelegationChain(chain: DelegationHop[]): void;
|
|
1989
|
+
declare function verifyMediaChunkHash(chunk: MediaChunk): void;
|
|
1990
|
+
type V22DelegationHop = DelegationHop;
|
|
1991
|
+
type V22MediaChunk = MediaChunk;
|
|
1992
|
+
|
|
1917
1993
|
/**
|
|
1918
1994
|
* rcan-ts — Official TypeScript SDK for RCAN v1.6
|
|
1919
1995
|
* Robot Communication and Accountability Network
|
|
@@ -1926,4 +2002,4 @@ declare const VERSION = "0.6.0";
|
|
|
1926
2002
|
/** @deprecated Use SPEC_VERSION from ./version instead */
|
|
1927
2003
|
declare const RCAN_VERSION = "1.6";
|
|
1928
2004
|
|
|
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 };
|
|
2005
|
+
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 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, 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, 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$1 as validateDelegationChain, validateLoaForScope, validateManifest, validateMediaChunks, validateMessage, validateNodeAgainstSchema, validateReplay, validateRoleForScope, validateSafetyMessage, validateTrainingDataMessage, validateURI, validateDelegationChain as validateV22DelegationChain, validateVersionCompat, verifyM2mTrustedToken, verifyM2mTrustedTokenClaims, verifyMessage, 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,77 @@ 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
|
+
/**
|
|
1923
|
+
* rcan/mcp.ts — MCP integration types for RCAN v2.2 §22
|
|
1924
|
+
*
|
|
1925
|
+
* Provider-agnostic: LoA is tied to the token, not the model or AI provider.
|
|
1926
|
+
*/
|
|
1927
|
+
/** LoA → RCAN command scopes mapping (§22.4) */
|
|
1928
|
+
declare const LOA_TO_SCOPES: Record<number, string[]>;
|
|
1929
|
+
/** Required LoA for each MCP tool (§22.3) */
|
|
1930
|
+
declare const TOOL_LOA_REQUIREMENTS: Record<string, number>;
|
|
1931
|
+
/** MCP client entry stored in the RCAN yaml mcp_clients: block */
|
|
1932
|
+
interface McpClientConfig {
|
|
1933
|
+
name: string;
|
|
1934
|
+
token_hash: string;
|
|
1935
|
+
loa: number;
|
|
1936
|
+
}
|
|
1937
|
+
/** Full MCP server configuration extracted from the RCAN yaml */
|
|
1938
|
+
interface McpServerConfig {
|
|
1939
|
+
rrn: string;
|
|
1940
|
+
clients: McpClientConfig[];
|
|
1941
|
+
}
|
|
1942
|
+
/** Check if a client's LoA satisfies a tool's requirement */
|
|
1943
|
+
declare function clientAllowsTool(client: McpClientConfig, toolName: string): boolean;
|
|
1944
|
+
/** Tool call result shapes */
|
|
1945
|
+
interface RobotStatusResult {
|
|
1946
|
+
rrn: string;
|
|
1947
|
+
status: Record<string, unknown>;
|
|
1948
|
+
}
|
|
1949
|
+
interface FleetListResult {
|
|
1950
|
+
fleet: Record<string, unknown>[];
|
|
1951
|
+
}
|
|
1952
|
+
interface RrfLookupResult {
|
|
1953
|
+
entity_id: string;
|
|
1954
|
+
record: Record<string, unknown>;
|
|
1955
|
+
}
|
|
1956
|
+
interface RobotCommandResult {
|
|
1957
|
+
rrn: string;
|
|
1958
|
+
instruction: string;
|
|
1959
|
+
scope: string;
|
|
1960
|
+
result: Record<string, unknown>;
|
|
1961
|
+
}
|
|
1962
|
+
interface ComplianceReportResult {
|
|
1963
|
+
rrn: string;
|
|
1964
|
+
compliance: Record<string, unknown>;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
/**
|
|
1968
|
+
* RCAN v2.2 Delegation and Media envelope types.
|
|
1969
|
+
* Spec: https://robotregistryfoundation.org/docs/mcp/
|
|
1970
|
+
*/
|
|
1971
|
+
/** A single hop in a v2.2 delegation chain. */
|
|
1972
|
+
interface DelegationHop {
|
|
1973
|
+
robot_rrn: string;
|
|
1974
|
+
scope: string;
|
|
1975
|
+
issued_at: string;
|
|
1976
|
+
expires_at: string;
|
|
1977
|
+
sig?: string;
|
|
1978
|
+
}
|
|
1979
|
+
/** An inline or by-reference media attachment for v2.2 messages. */
|
|
1980
|
+
interface MediaChunk {
|
|
1981
|
+
chunk_id: string;
|
|
1982
|
+
mime_type: string;
|
|
1983
|
+
size_bytes: number;
|
|
1984
|
+
hash_sha256: string;
|
|
1985
|
+
data?: string;
|
|
1986
|
+
ref_url?: string;
|
|
1987
|
+
}
|
|
1988
|
+
declare function validateDelegationChain(chain: DelegationHop[]): void;
|
|
1989
|
+
declare function verifyMediaChunkHash(chunk: MediaChunk): void;
|
|
1990
|
+
type V22DelegationHop = DelegationHop;
|
|
1991
|
+
type V22MediaChunk = MediaChunk;
|
|
1992
|
+
|
|
1917
1993
|
/**
|
|
1918
1994
|
* rcan-ts — Official TypeScript SDK for RCAN v1.6
|
|
1919
1995
|
* Robot Communication and Accountability Network
|
|
@@ -1926,4 +2002,4 @@ declare const VERSION = "0.6.0";
|
|
|
1926
2002
|
/** @deprecated Use SPEC_VERSION from ./version instead */
|
|
1927
2003
|
declare const RCAN_VERSION = "1.6";
|
|
1928
2004
|
|
|
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 };
|
|
2005
|
+
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 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, 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, 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$1 as validateDelegationChain, validateLoaForScope, validateManifest, validateMediaChunks, validateMessage, validateNodeAgainstSchema, validateReplay, validateRoleForScope, validateSafetyMessage, validateTrainingDataMessage, validateURI, validateDelegationChain as validateV22DelegationChain, validateVersionCompat, verifyM2mTrustedToken, verifyM2mTrustedTokenClaims, verifyMessage, verifyPQSignature, verifyMediaChunkHash as verifyV22MediaChunkHash };
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,7 @@ __export(index_exports, {
|
|
|
47
47
|
GateError: () => GateError,
|
|
48
48
|
HiTLGate: () => HiTLGate,
|
|
49
49
|
KeyStore: () => KeyStore,
|
|
50
|
+
LOA_TO_SCOPES: () => LOA_TO_SCOPES,
|
|
50
51
|
LevelOfAssurance: () => LevelOfAssurance,
|
|
51
52
|
M2MAuthError: () => M2MAuthError,
|
|
52
53
|
M2M_TRUSTED_ISSUER: () => M2M_TRUSTED_ISSUER,
|
|
@@ -90,6 +91,7 @@ __export(index_exports, {
|
|
|
90
91
|
SCOPE_MIN_ROLE: () => SCOPE_MIN_ROLE,
|
|
91
92
|
SDK_VERSION: () => SDK_VERSION,
|
|
92
93
|
SPEC_VERSION: () => SPEC_VERSION,
|
|
94
|
+
TOOL_LOA_REQUIREMENTS: () => TOOL_LOA_REQUIREMENTS,
|
|
93
95
|
TransportEncoding: () => TransportEncoding,
|
|
94
96
|
TransportError: () => TransportError,
|
|
95
97
|
TrustAnchorCache: () => TrustAnchorCache,
|
|
@@ -104,6 +106,7 @@ __export(index_exports, {
|
|
|
104
106
|
canonicalManifestJson: () => canonicalManifestJson,
|
|
105
107
|
checkClockSync: () => checkClockSync,
|
|
106
108
|
checkRevocation: () => checkRevocation,
|
|
109
|
+
clientAllowsTool: () => clientAllowsTool,
|
|
107
110
|
decodeBleFrames: () => decodeBleFrames,
|
|
108
111
|
decodeCompact: () => decodeCompact,
|
|
109
112
|
decodeMinimal: () => decodeMinimal,
|
|
@@ -171,11 +174,13 @@ __export(index_exports, {
|
|
|
171
174
|
validateSafetyMessage: () => validateSafetyMessage,
|
|
172
175
|
validateTrainingDataMessage: () => validateTrainingDataMessage,
|
|
173
176
|
validateURI: () => validateURI,
|
|
177
|
+
validateV22DelegationChain: () => validateDelegationChain2,
|
|
174
178
|
validateVersionCompat: () => validateVersionCompat,
|
|
175
179
|
verifyM2mTrustedToken: () => verifyM2mTrustedToken,
|
|
176
180
|
verifyM2mTrustedTokenClaims: () => verifyM2mTrustedTokenClaims,
|
|
177
181
|
verifyMessage: () => verifyMessage,
|
|
178
|
-
verifyPQSignature: () => verifyPQSignature
|
|
182
|
+
verifyPQSignature: () => verifyPQSignature,
|
|
183
|
+
verifyV22MediaChunkHash: () => verifyMediaChunkHash
|
|
179
184
|
});
|
|
180
185
|
module.exports = __toCommonJS(index_exports);
|
|
181
186
|
|
|
@@ -3392,6 +3397,66 @@ async function verifyPQSignature(msg, trustedKeys, _requirePQ = true) {
|
|
|
3392
3397
|
return verifyMessage(msg, trustedKeys);
|
|
3393
3398
|
}
|
|
3394
3399
|
|
|
3400
|
+
// src/mcp.ts
|
|
3401
|
+
var LOA_TO_SCOPES = {
|
|
3402
|
+
0: ["discover", "status", "transparency"],
|
|
3403
|
+
1: ["chat", "control", "system"],
|
|
3404
|
+
3: ["system", "safety"]
|
|
3405
|
+
};
|
|
3406
|
+
var TOOL_LOA_REQUIREMENTS = {
|
|
3407
|
+
// Tier 0 — read
|
|
3408
|
+
robot_ping: 0,
|
|
3409
|
+
robot_status: 0,
|
|
3410
|
+
robot_telemetry: 0,
|
|
3411
|
+
fleet_list: 0,
|
|
3412
|
+
rrf_lookup: 0,
|
|
3413
|
+
compliance_report: 0,
|
|
3414
|
+
// Tier 1 — operate
|
|
3415
|
+
robot_command: 1,
|
|
3416
|
+
harness_get: 1,
|
|
3417
|
+
research_run: 1,
|
|
3418
|
+
contribute_toggle: 1,
|
|
3419
|
+
components_list: 1,
|
|
3420
|
+
// Tier 3 — admin
|
|
3421
|
+
harness_set: 3,
|
|
3422
|
+
system_upgrade: 3,
|
|
3423
|
+
loa_enable: 3
|
|
3424
|
+
};
|
|
3425
|
+
function clientAllowsTool(client, toolName) {
|
|
3426
|
+
const required = TOOL_LOA_REQUIREMENTS[toolName] ?? 99;
|
|
3427
|
+
return client.loa >= required;
|
|
3428
|
+
}
|
|
3429
|
+
|
|
3430
|
+
// src/delegation.ts
|
|
3431
|
+
var MAX_DELEGATION_DEPTH = 3;
|
|
3432
|
+
function validateDelegationChain2(chain) {
|
|
3433
|
+
if (chain.length > MAX_DELEGATION_DEPTH) {
|
|
3434
|
+
throw new Error(
|
|
3435
|
+
`RCAN: delegation chain max depth is ${MAX_DELEGATION_DEPTH}, got ${chain.length}`
|
|
3436
|
+
);
|
|
3437
|
+
}
|
|
3438
|
+
}
|
|
3439
|
+
var _hashImpl;
|
|
3440
|
+
function verifyMediaChunkHash(chunk) {
|
|
3441
|
+
if (!chunk.data) return;
|
|
3442
|
+
let actual;
|
|
3443
|
+
if (_hashImpl) {
|
|
3444
|
+
actual = _hashImpl(chunk.data);
|
|
3445
|
+
} else {
|
|
3446
|
+
try {
|
|
3447
|
+
const m = typeof require !== "undefined" ? require : null;
|
|
3448
|
+
if (!m) return;
|
|
3449
|
+
const { createHash } = m("node:crypto");
|
|
3450
|
+
actual = "sha256:" + createHash("sha256").update(chunk.data).digest("hex");
|
|
3451
|
+
} catch {
|
|
3452
|
+
return;
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3455
|
+
if (actual !== chunk.hash_sha256) {
|
|
3456
|
+
throw new Error(`MediaChunk hash mismatch: expected ${chunk.hash_sha256}, got ${actual}`);
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
|
|
3395
3460
|
// src/index.ts
|
|
3396
3461
|
var VERSION = "0.6.0";
|
|
3397
3462
|
var RCAN_VERSION = "1.6";
|
|
@@ -3414,6 +3479,7 @@ var RCAN_VERSION = "1.6";
|
|
|
3414
3479
|
GateError,
|
|
3415
3480
|
HiTLGate,
|
|
3416
3481
|
KeyStore,
|
|
3482
|
+
LOA_TO_SCOPES,
|
|
3417
3483
|
LevelOfAssurance,
|
|
3418
3484
|
M2MAuthError,
|
|
3419
3485
|
M2M_TRUSTED_ISSUER,
|
|
@@ -3457,6 +3523,7 @@ var RCAN_VERSION = "1.6";
|
|
|
3457
3523
|
SCOPE_MIN_ROLE,
|
|
3458
3524
|
SDK_VERSION,
|
|
3459
3525
|
SPEC_VERSION,
|
|
3526
|
+
TOOL_LOA_REQUIREMENTS,
|
|
3460
3527
|
TransportEncoding,
|
|
3461
3528
|
TransportError,
|
|
3462
3529
|
TrustAnchorCache,
|
|
@@ -3471,6 +3538,7 @@ var RCAN_VERSION = "1.6";
|
|
|
3471
3538
|
canonicalManifestJson,
|
|
3472
3539
|
checkClockSync,
|
|
3473
3540
|
checkRevocation,
|
|
3541
|
+
clientAllowsTool,
|
|
3474
3542
|
decodeBleFrames,
|
|
3475
3543
|
decodeCompact,
|
|
3476
3544
|
decodeMinimal,
|
|
@@ -3538,10 +3606,12 @@ var RCAN_VERSION = "1.6";
|
|
|
3538
3606
|
validateSafetyMessage,
|
|
3539
3607
|
validateTrainingDataMessage,
|
|
3540
3608
|
validateURI,
|
|
3609
|
+
validateV22DelegationChain,
|
|
3541
3610
|
validateVersionCompat,
|
|
3542
3611
|
verifyM2mTrustedToken,
|
|
3543
3612
|
verifyM2mTrustedTokenClaims,
|
|
3544
3613
|
verifyMessage,
|
|
3545
|
-
verifyPQSignature
|
|
3614
|
+
verifyPQSignature,
|
|
3615
|
+
verifyV22MediaChunkHash
|
|
3546
3616
|
});
|
|
3547
3617
|
//# sourceMappingURL=index.js.map
|