@continuonai/rcan-ts 1.1.0 → 1.2.1
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 +66 -4
- package/dist/browser.mjs +143 -4
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +66 -4
- package/dist/index.d.ts +66 -4
- package/dist/index.js +149 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +143 -4
- package/dist/index.mjs.map +1 -1
- package/dist/rcan-validate.js +6 -2
- package/dist/rcan.iife.js +16 -3
- package/package.json +30 -4
package/dist/index.d.mts
CHANGED
|
@@ -109,8 +109,15 @@ interface DelegationHop {
|
|
|
109
109
|
scope: string;
|
|
110
110
|
signature: string;
|
|
111
111
|
}
|
|
112
|
+
/** RCAN v2.2: ML-DSA-65 is the only valid alg ("ml-dsa-65"). Ed25519 is deprecated. */
|
|
112
113
|
interface SignatureBlock {
|
|
113
|
-
alg:
|
|
114
|
+
alg: "ml-dsa-65";
|
|
115
|
+
kid: string;
|
|
116
|
+
sig: string;
|
|
117
|
+
}
|
|
118
|
+
/** v2.2: Post-quantum (ML-DSA-65) signature block */
|
|
119
|
+
interface PQSignatureBlock {
|
|
120
|
+
alg: "ml-dsa-65";
|
|
114
121
|
kid: string;
|
|
115
122
|
sig: string;
|
|
116
123
|
}
|
|
@@ -152,6 +159,8 @@ interface RCANMessageData {
|
|
|
152
159
|
firmwareHash?: string;
|
|
153
160
|
/** v2.1: URI to sender's SBOM attestation endpoint (envelope field 14). Required at L2+. */
|
|
154
161
|
attestationRef?: string;
|
|
162
|
+
/** v2.2: ML-DSA-65 post-quantum signature block (field 16, FIPS 204). Hybrid mode alongside Ed25519. */
|
|
163
|
+
pqSig?: PQSignatureBlock | undefined;
|
|
155
164
|
[key: string]: unknown;
|
|
156
165
|
}
|
|
157
166
|
declare class RCANMessageError extends Error {
|
|
@@ -188,6 +197,8 @@ declare class RCANMessage {
|
|
|
188
197
|
readonly firmwareHash: string | undefined;
|
|
189
198
|
/** v2.1: URI to sender's SBOM attestation endpoint */
|
|
190
199
|
readonly attestationRef: string | undefined;
|
|
200
|
+
/** v2.2: ML-DSA-65 post-quantum signature (field 16, FIPS 204). Hybrid alongside Ed25519. */
|
|
201
|
+
readonly pqSig: PQSignatureBlock | undefined;
|
|
191
202
|
constructor(data: RCANMessageData);
|
|
192
203
|
/** Whether this message has a signature block */
|
|
193
204
|
get isSigned(): boolean;
|
|
@@ -755,9 +766,9 @@ declare function makeTransparencyMessage(ruri: string, disclosure: string, deleg
|
|
|
755
766
|
* §3.5 — Protocol Version Compatibility
|
|
756
767
|
*/
|
|
757
768
|
/** The RCAN spec version this SDK implements. */
|
|
758
|
-
declare const SPEC_VERSION = "2.
|
|
769
|
+
declare const SPEC_VERSION = "2.2.0";
|
|
759
770
|
/** The SDK release version. */
|
|
760
|
-
declare const SDK_VERSION = "1.1
|
|
771
|
+
declare const SDK_VERSION = "1.2.1";
|
|
761
772
|
/**
|
|
762
773
|
* Validate version compatibility.
|
|
763
774
|
*
|
|
@@ -1852,6 +1863,57 @@ declare function verifyM2mTrustedToken(token: string, targetRrn: string, options
|
|
|
1852
1863
|
skipRevocationCheck?: boolean;
|
|
1853
1864
|
}): Promise<M2MTrustedClaims>;
|
|
1854
1865
|
|
|
1866
|
+
/**
|
|
1867
|
+
* RCAN v2.2 ML-DSA-65 Signing (NIST FIPS 204)
|
|
1868
|
+
*
|
|
1869
|
+
* Ed25519 is deprecated. ML-DSA-65 is the ONLY signing algorithm.
|
|
1870
|
+
* All signed messages carry a ``signature`` block with ``alg: "ml-dsa-65"``.
|
|
1871
|
+
*
|
|
1872
|
+
* Requires: @noble/post-quantum (npm install @noble/post-quantum)
|
|
1873
|
+
*
|
|
1874
|
+
* Spec: https://rcan.dev/spec/v2.2#section-7-2
|
|
1875
|
+
*/
|
|
1876
|
+
|
|
1877
|
+
interface MLDSAKeyPairData {
|
|
1878
|
+
publicKey: Uint8Array;
|
|
1879
|
+
secretKey?: Uint8Array;
|
|
1880
|
+
keyId: string;
|
|
1881
|
+
}
|
|
1882
|
+
/**
|
|
1883
|
+
* An ML-DSA-65 (CRYSTALS-Dilithium, NIST FIPS 204) key pair.
|
|
1884
|
+
*
|
|
1885
|
+
* This is the ONLY signing key type in RCAN v2.2+. Ed25519 is deprecated.
|
|
1886
|
+
*/
|
|
1887
|
+
declare class MLDSAKeyPair {
|
|
1888
|
+
readonly keyId: string;
|
|
1889
|
+
readonly publicKey: Uint8Array;
|
|
1890
|
+
readonly secretKey: Uint8Array | undefined;
|
|
1891
|
+
private constructor();
|
|
1892
|
+
static generate(): Promise<MLDSAKeyPair>;
|
|
1893
|
+
static fromPublicKey(publicKey: Uint8Array): Promise<MLDSAKeyPair>;
|
|
1894
|
+
static fromKeyMaterial(publicKey: Uint8Array, secretKey: Uint8Array): Promise<MLDSAKeyPair>;
|
|
1895
|
+
get hasPrivateKey(): boolean;
|
|
1896
|
+
signBytes(data: Uint8Array): Promise<Uint8Array>;
|
|
1897
|
+
verifyBytes(data: Uint8Array, signature: Uint8Array): Promise<void>;
|
|
1898
|
+
toString(): string;
|
|
1899
|
+
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Sign an RCANMessage with ML-DSA-65 (the only signing algorithm in RCAN v2.2).
|
|
1902
|
+
*
|
|
1903
|
+
* Sets msg.signature = { alg: "ml-dsa-65", kid, sig }.
|
|
1904
|
+
*/
|
|
1905
|
+
declare function signMessage(msg: RCANMessage, keypair: MLDSAKeyPair): Promise<RCANMessage>;
|
|
1906
|
+
/**
|
|
1907
|
+
* Verify the ML-DSA-65 signature on an RCANMessage.
|
|
1908
|
+
*
|
|
1909
|
+
* @throws {Error} if signature is missing, alg is not ml-dsa-65, key not found, or invalid.
|
|
1910
|
+
*/
|
|
1911
|
+
declare function verifyMessage(msg: RCANMessage, trustedKeys: MLDSAKeyPair[]): Promise<void>;
|
|
1912
|
+
/** @deprecated Use signMessage() — Ed25519 is removed in RCAN v2.2 */
|
|
1913
|
+
declare const addPQSignature: typeof signMessage;
|
|
1914
|
+
/** @deprecated Use verifyMessage() — Ed25519 is removed in RCAN v2.2 */
|
|
1915
|
+
declare function verifyPQSignature(msg: RCANMessage, trustedKeys: MLDSAKeyPair[], _requirePQ?: boolean): Promise<void>;
|
|
1916
|
+
|
|
1855
1917
|
/**
|
|
1856
1918
|
* rcan-ts — Official TypeScript SDK for RCAN v1.6
|
|
1857
1919
|
* Robot Communication and Accountability Network
|
|
@@ -1864,4 +1926,4 @@ declare const VERSION = "0.6.0";
|
|
|
1864
1926
|
/** @deprecated Use SPEC_VERSION from ./version instead */
|
|
1865
1927
|
declare const RCAN_VERSION = "1.6";
|
|
1866
1928
|
|
|
1867
|
-
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, 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, 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, validateAuthorityAccess, validateCompetitionScope, validateConfig, validateConfigAgainstSchema, validateConfigUpdate, validateConsentMessage, validateContributeScope, validateCrossRegistryCommand, validateDelegationChain, validateLoaForScope, validateManifest, validateMediaChunks, validateMessage, validateNodeAgainstSchema, validateReplay, validateRoleForScope, validateSafetyMessage, validateTrainingDataMessage, validateURI, validateVersionCompat, verifyM2mTrustedToken, verifyM2mTrustedTokenClaims };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -109,8 +109,15 @@ interface DelegationHop {
|
|
|
109
109
|
scope: string;
|
|
110
110
|
signature: string;
|
|
111
111
|
}
|
|
112
|
+
/** RCAN v2.2: ML-DSA-65 is the only valid alg ("ml-dsa-65"). Ed25519 is deprecated. */
|
|
112
113
|
interface SignatureBlock {
|
|
113
|
-
alg:
|
|
114
|
+
alg: "ml-dsa-65";
|
|
115
|
+
kid: string;
|
|
116
|
+
sig: string;
|
|
117
|
+
}
|
|
118
|
+
/** v2.2: Post-quantum (ML-DSA-65) signature block */
|
|
119
|
+
interface PQSignatureBlock {
|
|
120
|
+
alg: "ml-dsa-65";
|
|
114
121
|
kid: string;
|
|
115
122
|
sig: string;
|
|
116
123
|
}
|
|
@@ -152,6 +159,8 @@ interface RCANMessageData {
|
|
|
152
159
|
firmwareHash?: string;
|
|
153
160
|
/** v2.1: URI to sender's SBOM attestation endpoint (envelope field 14). Required at L2+. */
|
|
154
161
|
attestationRef?: string;
|
|
162
|
+
/** v2.2: ML-DSA-65 post-quantum signature block (field 16, FIPS 204). Hybrid mode alongside Ed25519. */
|
|
163
|
+
pqSig?: PQSignatureBlock | undefined;
|
|
155
164
|
[key: string]: unknown;
|
|
156
165
|
}
|
|
157
166
|
declare class RCANMessageError extends Error {
|
|
@@ -188,6 +197,8 @@ declare class RCANMessage {
|
|
|
188
197
|
readonly firmwareHash: string | undefined;
|
|
189
198
|
/** v2.1: URI to sender's SBOM attestation endpoint */
|
|
190
199
|
readonly attestationRef: string | undefined;
|
|
200
|
+
/** v2.2: ML-DSA-65 post-quantum signature (field 16, FIPS 204). Hybrid alongside Ed25519. */
|
|
201
|
+
readonly pqSig: PQSignatureBlock | undefined;
|
|
191
202
|
constructor(data: RCANMessageData);
|
|
192
203
|
/** Whether this message has a signature block */
|
|
193
204
|
get isSigned(): boolean;
|
|
@@ -755,9 +766,9 @@ declare function makeTransparencyMessage(ruri: string, disclosure: string, deleg
|
|
|
755
766
|
* §3.5 — Protocol Version Compatibility
|
|
756
767
|
*/
|
|
757
768
|
/** The RCAN spec version this SDK implements. */
|
|
758
|
-
declare const SPEC_VERSION = "2.
|
|
769
|
+
declare const SPEC_VERSION = "2.2.0";
|
|
759
770
|
/** The SDK release version. */
|
|
760
|
-
declare const SDK_VERSION = "1.1
|
|
771
|
+
declare const SDK_VERSION = "1.2.1";
|
|
761
772
|
/**
|
|
762
773
|
* Validate version compatibility.
|
|
763
774
|
*
|
|
@@ -1852,6 +1863,57 @@ declare function verifyM2mTrustedToken(token: string, targetRrn: string, options
|
|
|
1852
1863
|
skipRevocationCheck?: boolean;
|
|
1853
1864
|
}): Promise<M2MTrustedClaims>;
|
|
1854
1865
|
|
|
1866
|
+
/**
|
|
1867
|
+
* RCAN v2.2 ML-DSA-65 Signing (NIST FIPS 204)
|
|
1868
|
+
*
|
|
1869
|
+
* Ed25519 is deprecated. ML-DSA-65 is the ONLY signing algorithm.
|
|
1870
|
+
* All signed messages carry a ``signature`` block with ``alg: "ml-dsa-65"``.
|
|
1871
|
+
*
|
|
1872
|
+
* Requires: @noble/post-quantum (npm install @noble/post-quantum)
|
|
1873
|
+
*
|
|
1874
|
+
* Spec: https://rcan.dev/spec/v2.2#section-7-2
|
|
1875
|
+
*/
|
|
1876
|
+
|
|
1877
|
+
interface MLDSAKeyPairData {
|
|
1878
|
+
publicKey: Uint8Array;
|
|
1879
|
+
secretKey?: Uint8Array;
|
|
1880
|
+
keyId: string;
|
|
1881
|
+
}
|
|
1882
|
+
/**
|
|
1883
|
+
* An ML-DSA-65 (CRYSTALS-Dilithium, NIST FIPS 204) key pair.
|
|
1884
|
+
*
|
|
1885
|
+
* This is the ONLY signing key type in RCAN v2.2+. Ed25519 is deprecated.
|
|
1886
|
+
*/
|
|
1887
|
+
declare class MLDSAKeyPair {
|
|
1888
|
+
readonly keyId: string;
|
|
1889
|
+
readonly publicKey: Uint8Array;
|
|
1890
|
+
readonly secretKey: Uint8Array | undefined;
|
|
1891
|
+
private constructor();
|
|
1892
|
+
static generate(): Promise<MLDSAKeyPair>;
|
|
1893
|
+
static fromPublicKey(publicKey: Uint8Array): Promise<MLDSAKeyPair>;
|
|
1894
|
+
static fromKeyMaterial(publicKey: Uint8Array, secretKey: Uint8Array): Promise<MLDSAKeyPair>;
|
|
1895
|
+
get hasPrivateKey(): boolean;
|
|
1896
|
+
signBytes(data: Uint8Array): Promise<Uint8Array>;
|
|
1897
|
+
verifyBytes(data: Uint8Array, signature: Uint8Array): Promise<void>;
|
|
1898
|
+
toString(): string;
|
|
1899
|
+
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Sign an RCANMessage with ML-DSA-65 (the only signing algorithm in RCAN v2.2).
|
|
1902
|
+
*
|
|
1903
|
+
* Sets msg.signature = { alg: "ml-dsa-65", kid, sig }.
|
|
1904
|
+
*/
|
|
1905
|
+
declare function signMessage(msg: RCANMessage, keypair: MLDSAKeyPair): Promise<RCANMessage>;
|
|
1906
|
+
/**
|
|
1907
|
+
* Verify the ML-DSA-65 signature on an RCANMessage.
|
|
1908
|
+
*
|
|
1909
|
+
* @throws {Error} if signature is missing, alg is not ml-dsa-65, key not found, or invalid.
|
|
1910
|
+
*/
|
|
1911
|
+
declare function verifyMessage(msg: RCANMessage, trustedKeys: MLDSAKeyPair[]): Promise<void>;
|
|
1912
|
+
/** @deprecated Use signMessage() — Ed25519 is removed in RCAN v2.2 */
|
|
1913
|
+
declare const addPQSignature: typeof signMessage;
|
|
1914
|
+
/** @deprecated Use verifyMessage() — Ed25519 is removed in RCAN v2.2 */
|
|
1915
|
+
declare function verifyPQSignature(msg: RCANMessage, trustedKeys: MLDSAKeyPair[], _requirePQ?: boolean): Promise<void>;
|
|
1916
|
+
|
|
1855
1917
|
/**
|
|
1856
1918
|
* rcan-ts — Official TypeScript SDK for RCAN v1.6
|
|
1857
1919
|
* Robot Communication and Accountability Network
|
|
@@ -1864,4 +1926,4 @@ declare const VERSION = "0.6.0";
|
|
|
1864
1926
|
/** @deprecated Use SPEC_VERSION from ./version instead */
|
|
1865
1927
|
declare const RCAN_VERSION = "1.6";
|
|
1866
1928
|
|
|
1867
|
-
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, 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, 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, validateAuthorityAccess, validateCompetitionScope, validateConfig, validateConfigAgainstSchema, validateConfigUpdate, validateConsentMessage, validateContributeScope, validateCrossRegistryCommand, validateDelegationChain, validateLoaForScope, validateManifest, validateMediaChunks, validateMessage, validateNodeAgainstSchema, validateReplay, validateRoleForScope, validateSafetyMessage, validateTrainingDataMessage, validateURI, validateVersionCompat, verifyM2mTrustedToken, verifyM2mTrustedTokenClaims };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
LevelOfAssurance: () => LevelOfAssurance,
|
|
51
51
|
M2MAuthError: () => M2MAuthError,
|
|
52
52
|
M2M_TRUSTED_ISSUER: () => M2M_TRUSTED_ISSUER,
|
|
53
|
+
MLDSAKeyPair: () => MLDSAKeyPair,
|
|
53
54
|
MediaEncoding: () => MediaEncoding,
|
|
54
55
|
MessageType: () => MessageType,
|
|
55
56
|
NodeClient: () => NodeClient,
|
|
@@ -96,6 +97,7 @@ __export(index_exports, {
|
|
|
96
97
|
addDelegationHop: () => addDelegationHop,
|
|
97
98
|
addMediaInline: () => addMediaInline,
|
|
98
99
|
addMediaRef: () => addMediaRef,
|
|
100
|
+
addPQSignature: () => addPQSignature,
|
|
99
101
|
assertClockSynced: () => assertClockSynced,
|
|
100
102
|
authorityAccessFromWire: () => authorityAccessFromWire,
|
|
101
103
|
authorityAccessToWire: () => authorityAccessToWire,
|
|
@@ -149,6 +151,7 @@ __export(index_exports, {
|
|
|
149
151
|
parseM2mTrustedToken: () => parseM2mTrustedToken,
|
|
150
152
|
roleFromJwtLevel: () => roleFromJwtLevel,
|
|
151
153
|
selectTransport: () => selectTransport,
|
|
154
|
+
signMessage: () => signMessage,
|
|
152
155
|
validateAuthorityAccess: () => validateAuthorityAccess,
|
|
153
156
|
validateCompetitionScope: () => validateCompetitionScope,
|
|
154
157
|
validateConfig: () => validateConfig,
|
|
@@ -170,7 +173,9 @@ __export(index_exports, {
|
|
|
170
173
|
validateURI: () => validateURI,
|
|
171
174
|
validateVersionCompat: () => validateVersionCompat,
|
|
172
175
|
verifyM2mTrustedToken: () => verifyM2mTrustedToken,
|
|
173
|
-
verifyM2mTrustedTokenClaims: () => verifyM2mTrustedTokenClaims
|
|
176
|
+
verifyM2mTrustedTokenClaims: () => verifyM2mTrustedTokenClaims,
|
|
177
|
+
verifyMessage: () => verifyMessage,
|
|
178
|
+
verifyPQSignature: () => verifyPQSignature
|
|
174
179
|
});
|
|
175
180
|
module.exports = __toCommonJS(index_exports);
|
|
176
181
|
|
|
@@ -265,8 +270,8 @@ var RobotURI = class _RobotURI {
|
|
|
265
270
|
};
|
|
266
271
|
|
|
267
272
|
// src/version.ts
|
|
268
|
-
var SPEC_VERSION = "2.
|
|
269
|
-
var SDK_VERSION = "1.1
|
|
273
|
+
var SPEC_VERSION = "2.2.0";
|
|
274
|
+
var SDK_VERSION = "1.2.1";
|
|
270
275
|
function validateVersionCompat(incomingVersion, localVersion = SPEC_VERSION) {
|
|
271
276
|
const parseParts = (v) => {
|
|
272
277
|
const parts = v.split(".");
|
|
@@ -364,6 +369,8 @@ var RCANMessage = class _RCANMessage {
|
|
|
364
369
|
firmwareHash;
|
|
365
370
|
/** v2.1: URI to sender's SBOM attestation endpoint */
|
|
366
371
|
attestationRef;
|
|
372
|
+
/** v2.2: ML-DSA-65 post-quantum signature (field 16, FIPS 204). Hybrid alongside Ed25519. */
|
|
373
|
+
pqSig;
|
|
367
374
|
constructor(data) {
|
|
368
375
|
if (!data.cmd || data.cmd.trim() === "") {
|
|
369
376
|
throw new RCANMessageError("'cmd' is required");
|
|
@@ -394,6 +401,7 @@ var RCANMessage = class _RCANMessage {
|
|
|
394
401
|
this.mediaChunks = data.mediaChunks;
|
|
395
402
|
this.firmwareHash = data.firmwareHash;
|
|
396
403
|
this.attestationRef = data.attestationRef;
|
|
404
|
+
this.pqSig = data.pqSig;
|
|
397
405
|
if (this.signature !== void 0 && this.signature["sig"] === "pending") {
|
|
398
406
|
throw new RCANMessageError(
|
|
399
407
|
"signature.sig:'pending' is not valid in RCAN v2.1. Sign the message before sending."
|
|
@@ -486,7 +494,8 @@ var RCANMessage = class _RCANMessage {
|
|
|
486
494
|
transportEncoding: obj.transportEncoding,
|
|
487
495
|
mediaChunks: obj.mediaChunks,
|
|
488
496
|
firmwareHash: obj.firmwareHash,
|
|
489
|
-
attestationRef: obj.attestationRef
|
|
497
|
+
attestationRef: obj.attestationRef,
|
|
498
|
+
pqSig: obj.pqSig
|
|
490
499
|
});
|
|
491
500
|
}
|
|
492
501
|
};
|
|
@@ -3253,6 +3262,136 @@ async function verifyM2mTrustedToken(token, targetRrn, options) {
|
|
|
3253
3262
|
return claims;
|
|
3254
3263
|
}
|
|
3255
3264
|
|
|
3265
|
+
// src/pqSigning.ts
|
|
3266
|
+
function toBase64url(bytes) {
|
|
3267
|
+
let binary = "";
|
|
3268
|
+
for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
|
|
3269
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
3270
|
+
}
|
|
3271
|
+
function fromBase64url(b64) {
|
|
3272
|
+
const padded = b64.replace(/-/g, "+").replace(/_/g, "/");
|
|
3273
|
+
const binary = atob(padded);
|
|
3274
|
+
const bytes = new Uint8Array(binary.length);
|
|
3275
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
3276
|
+
return bytes;
|
|
3277
|
+
}
|
|
3278
|
+
async function sha256hex(data) {
|
|
3279
|
+
if (typeof crypto !== "undefined" && crypto.subtle) {
|
|
3280
|
+
const buf = await crypto.subtle.digest("SHA-256", data.buffer);
|
|
3281
|
+
return Array.from(new Uint8Array(buf)).map((b) => b.toString(16).padStart(2, "0")).join("").slice(0, 8);
|
|
3282
|
+
}
|
|
3283
|
+
const { createHash } = require("crypto");
|
|
3284
|
+
return createHash("sha256").update(data).digest("hex").slice(0, 8);
|
|
3285
|
+
}
|
|
3286
|
+
var _mlDsaModule;
|
|
3287
|
+
async function requireMlDsa() {
|
|
3288
|
+
if (_mlDsaModule) return _mlDsaModule;
|
|
3289
|
+
if (typeof require !== "undefined") {
|
|
3290
|
+
try {
|
|
3291
|
+
_mlDsaModule = require("@noble/post-quantum/ml-dsa.js");
|
|
3292
|
+
return _mlDsaModule;
|
|
3293
|
+
} catch {
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
try {
|
|
3297
|
+
_mlDsaModule = await import("@noble/post-quantum/ml-dsa.js");
|
|
3298
|
+
return _mlDsaModule;
|
|
3299
|
+
} catch {
|
|
3300
|
+
throw new Error(
|
|
3301
|
+
"ML-DSA-65 signing requires @noble/post-quantum. Install with: npm install @noble/post-quantum"
|
|
3302
|
+
);
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
var MLDSAKeyPair = class _MLDSAKeyPair {
|
|
3306
|
+
keyId;
|
|
3307
|
+
publicKey;
|
|
3308
|
+
secretKey;
|
|
3309
|
+
constructor(data) {
|
|
3310
|
+
this.keyId = data.keyId;
|
|
3311
|
+
this.publicKey = data.publicKey;
|
|
3312
|
+
this.secretKey = data.secretKey;
|
|
3313
|
+
}
|
|
3314
|
+
static async generate() {
|
|
3315
|
+
const m = await requireMlDsa();
|
|
3316
|
+
const kp = m.ml_dsa65.keygen();
|
|
3317
|
+
const keyId = await sha256hex(kp.publicKey);
|
|
3318
|
+
return new _MLDSAKeyPair({ publicKey: kp.publicKey, secretKey: kp.secretKey, keyId });
|
|
3319
|
+
}
|
|
3320
|
+
static async fromPublicKey(publicKey) {
|
|
3321
|
+
const keyId = await sha256hex(publicKey);
|
|
3322
|
+
return new _MLDSAKeyPair({ publicKey, keyId });
|
|
3323
|
+
}
|
|
3324
|
+
static async fromKeyMaterial(publicKey, secretKey) {
|
|
3325
|
+
const keyId = await sha256hex(publicKey);
|
|
3326
|
+
return new _MLDSAKeyPair({ publicKey, secretKey, keyId });
|
|
3327
|
+
}
|
|
3328
|
+
get hasPrivateKey() {
|
|
3329
|
+
return this.secretKey !== void 0;
|
|
3330
|
+
}
|
|
3331
|
+
async signBytes(data) {
|
|
3332
|
+
if (!this.secretKey) throw new Error("Cannot sign: MLDSAKeyPair has no private key (verify-only)");
|
|
3333
|
+
const m = await requireMlDsa();
|
|
3334
|
+
return m.ml_dsa65.sign(data, this.secretKey);
|
|
3335
|
+
}
|
|
3336
|
+
async verifyBytes(data, signature) {
|
|
3337
|
+
const m = await requireMlDsa();
|
|
3338
|
+
const ok = m.ml_dsa65.verify(signature, data, this.publicKey);
|
|
3339
|
+
if (!ok) throw new Error("ML-DSA-65 signature verification failed");
|
|
3340
|
+
}
|
|
3341
|
+
toString() {
|
|
3342
|
+
return `MLDSAKeyPair(keyId=${this.keyId}, alg=ML-DSA-65, ${this.hasPrivateKey ? "private+public" : "public-only"})`;
|
|
3343
|
+
}
|
|
3344
|
+
};
|
|
3345
|
+
function canonicalMessageBytes(msg) {
|
|
3346
|
+
const payload = {
|
|
3347
|
+
rcan: msg.rcan,
|
|
3348
|
+
msg_id: msg["msgId"] ?? "",
|
|
3349
|
+
timestamp: msg.timestamp,
|
|
3350
|
+
cmd: msg.cmd,
|
|
3351
|
+
target: msg.target,
|
|
3352
|
+
params: msg.params
|
|
3353
|
+
};
|
|
3354
|
+
return new TextEncoder().encode(
|
|
3355
|
+
JSON.stringify(Object.fromEntries(Object.entries(payload).sort()))
|
|
3356
|
+
);
|
|
3357
|
+
}
|
|
3358
|
+
async function signMessage(msg, keypair) {
|
|
3359
|
+
const payload = canonicalMessageBytes(msg);
|
|
3360
|
+
const rawSig = await keypair.signBytes(payload);
|
|
3361
|
+
msg["signature"] = {
|
|
3362
|
+
alg: "ml-dsa-65",
|
|
3363
|
+
kid: keypair.keyId,
|
|
3364
|
+
sig: toBase64url(rawSig)
|
|
3365
|
+
};
|
|
3366
|
+
return msg;
|
|
3367
|
+
}
|
|
3368
|
+
async function verifyMessage(msg, trustedKeys) {
|
|
3369
|
+
const sig = msg.signature;
|
|
3370
|
+
if (!sig) throw new Error("Message is unsigned \u2014 signature field missing");
|
|
3371
|
+
if (sig.alg !== "ml-dsa-65") {
|
|
3372
|
+
throw new Error(
|
|
3373
|
+
`Unsupported signature algorithm: ${sig.alg}. RCAN v2.2 requires ml-dsa-65 (Ed25519 is deprecated).`
|
|
3374
|
+
);
|
|
3375
|
+
}
|
|
3376
|
+
const matched = trustedKeys.find((k) => k.keyId === sig.kid);
|
|
3377
|
+
if (!matched) {
|
|
3378
|
+
throw new Error(
|
|
3379
|
+
`No trusted ML-DSA-65 key with kid=${sig.kid}. Known kids: [${trustedKeys.map((k) => k.keyId).join(", ")}]`
|
|
3380
|
+
);
|
|
3381
|
+
}
|
|
3382
|
+
let rawSig;
|
|
3383
|
+
try {
|
|
3384
|
+
rawSig = fromBase64url(sig.sig);
|
|
3385
|
+
} catch (e) {
|
|
3386
|
+
throw new Error(`Invalid base64url sig: ${e}`);
|
|
3387
|
+
}
|
|
3388
|
+
await matched.verifyBytes(canonicalMessageBytes(msg), rawSig);
|
|
3389
|
+
}
|
|
3390
|
+
var addPQSignature = signMessage;
|
|
3391
|
+
async function verifyPQSignature(msg, trustedKeys, _requirePQ = true) {
|
|
3392
|
+
return verifyMessage(msg, trustedKeys);
|
|
3393
|
+
}
|
|
3394
|
+
|
|
3256
3395
|
// src/index.ts
|
|
3257
3396
|
var VERSION = "0.6.0";
|
|
3258
3397
|
var RCAN_VERSION = "1.6";
|
|
@@ -3278,6 +3417,7 @@ var RCAN_VERSION = "1.6";
|
|
|
3278
3417
|
LevelOfAssurance,
|
|
3279
3418
|
M2MAuthError,
|
|
3280
3419
|
M2M_TRUSTED_ISSUER,
|
|
3420
|
+
MLDSAKeyPair,
|
|
3281
3421
|
MediaEncoding,
|
|
3282
3422
|
MessageType,
|
|
3283
3423
|
NodeClient,
|
|
@@ -3324,6 +3464,7 @@ var RCAN_VERSION = "1.6";
|
|
|
3324
3464
|
addDelegationHop,
|
|
3325
3465
|
addMediaInline,
|
|
3326
3466
|
addMediaRef,
|
|
3467
|
+
addPQSignature,
|
|
3327
3468
|
assertClockSynced,
|
|
3328
3469
|
authorityAccessFromWire,
|
|
3329
3470
|
authorityAccessToWire,
|
|
@@ -3377,6 +3518,7 @@ var RCAN_VERSION = "1.6";
|
|
|
3377
3518
|
parseM2mTrustedToken,
|
|
3378
3519
|
roleFromJwtLevel,
|
|
3379
3520
|
selectTransport,
|
|
3521
|
+
signMessage,
|
|
3380
3522
|
validateAuthorityAccess,
|
|
3381
3523
|
validateCompetitionScope,
|
|
3382
3524
|
validateConfig,
|
|
@@ -3398,6 +3540,8 @@ var RCAN_VERSION = "1.6";
|
|
|
3398
3540
|
validateURI,
|
|
3399
3541
|
validateVersionCompat,
|
|
3400
3542
|
verifyM2mTrustedToken,
|
|
3401
|
-
verifyM2mTrustedTokenClaims
|
|
3543
|
+
verifyM2mTrustedTokenClaims,
|
|
3544
|
+
verifyMessage,
|
|
3545
|
+
verifyPQSignature
|
|
3402
3546
|
});
|
|
3403
3547
|
//# sourceMappingURL=index.js.map
|