@veridid/signing 0.0.0-stage → 1.0.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/LICENSE +202 -0
- package/README.md +39 -2
- package/build/SigningApi.d.mts +368 -0
- package/build/SigningApi.d.mts.map +1 -0
- package/build/SigningApi.mjs +516 -0
- package/build/SigningApi.mjs.map +1 -0
- package/build/SigningEvents.d.mts +71 -0
- package/build/SigningEvents.d.mts.map +1 -0
- package/build/SigningEvents.mjs +16 -0
- package/build/SigningEvents.mjs.map +1 -0
- package/build/SigningModule.d.mts +42 -0
- package/build/SigningModule.d.mts.map +1 -0
- package/build/SigningModule.mjs +91 -0
- package/build/SigningModule.mjs.map +1 -0
- package/build/SigningRole.d.mts +25 -0
- package/build/SigningRole.d.mts.map +1 -0
- package/build/SigningRole.mjs +27 -0
- package/build/SigningRole.mjs.map +1 -0
- package/build/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs +10 -0
- package/build/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.mjs +7 -0
- package/build/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateParam.mjs +9 -0
- package/build/compat.d.mts +24 -0
- package/build/compat.d.mts.map +1 -0
- package/build/compat.mjs +26 -0
- package/build/compat.mjs.map +1 -0
- package/build/delivery/ArtifactDeliveryStrategy.d.mts +74 -0
- package/build/delivery/ArtifactDeliveryStrategy.d.mts.map +1 -0
- package/build/delivery/InlineBase64Strategy.d.mts +50 -0
- package/build/delivery/InlineBase64Strategy.d.mts.map +1 -0
- package/build/delivery/InlineBase64Strategy.mjs +80 -0
- package/build/delivery/InlineBase64Strategy.mjs.map +1 -0
- package/build/delivery/index.mjs +1 -0
- package/build/errors/ArtifactTooLargeError.d.mts +12 -0
- package/build/errors/ArtifactTooLargeError.d.mts.map +1 -0
- package/build/errors/ArtifactTooLargeError.mjs +15 -0
- package/build/errors/ArtifactTooLargeError.mjs.map +1 -0
- package/build/errors/DigestMismatchError.d.mts +12 -0
- package/build/errors/DigestMismatchError.d.mts.map +1 -0
- package/build/errors/DigestMismatchError.mjs +15 -0
- package/build/errors/DigestMismatchError.mjs.map +1 -0
- package/build/errors/IdempotencyConflictError.d.mts +12 -0
- package/build/errors/IdempotencyConflictError.d.mts.map +1 -0
- package/build/errors/IdempotencyConflictError.mjs +15 -0
- package/build/errors/IdempotencyConflictError.mjs.map +1 -0
- package/build/errors/InvalidStateError.d.mts +14 -0
- package/build/errors/InvalidStateError.d.mts.map +1 -0
- package/build/errors/InvalidStateError.mjs +16 -0
- package/build/errors/InvalidStateError.mjs.map +1 -0
- package/build/errors/PolicyEnforcementError.d.mts +12 -0
- package/build/errors/PolicyEnforcementError.d.mts.map +1 -0
- package/build/errors/PolicyEnforcementError.mjs +15 -0
- package/build/errors/PolicyEnforcementError.mjs.map +1 -0
- package/build/errors/SigningError.d.mts +16 -0
- package/build/errors/SigningError.d.mts.map +1 -0
- package/build/errors/SigningError.mjs +16 -0
- package/build/errors/SigningError.mjs.map +1 -0
- package/build/errors/ThresholdNotMetError.d.mts +12 -0
- package/build/errors/ThresholdNotMetError.d.mts.map +1 -0
- package/build/errors/ThresholdNotMetError.mjs +15 -0
- package/build/errors/ThresholdNotMetError.mjs.map +1 -0
- package/build/errors/UnsupportedCanonicalizerError.d.mts +12 -0
- package/build/errors/UnsupportedCanonicalizerError.d.mts.map +1 -0
- package/build/errors/UnsupportedCanonicalizerError.mjs +16 -0
- package/build/errors/UnsupportedCanonicalizerError.mjs.map +1 -0
- package/build/errors/UnsupportedSuiteError.d.mts +12 -0
- package/build/errors/UnsupportedSuiteError.d.mts.map +1 -0
- package/build/errors/UnsupportedSuiteError.mjs +16 -0
- package/build/errors/UnsupportedSuiteError.mjs.map +1 -0
- package/build/errors/index.d.mts +9 -0
- package/build/errors/index.mjs +9 -0
- package/build/handlers/CombineMessageHandler.d.mts +22 -0
- package/build/handlers/CombineMessageHandler.d.mts.map +1 -0
- package/build/handlers/CombineMessageHandler.mjs +25 -0
- package/build/handlers/CombineMessageHandler.mjs.map +1 -0
- package/build/handlers/ConsentMessageHandler.d.mts +19 -0
- package/build/handlers/ConsentMessageHandler.d.mts.map +1 -0
- package/build/handlers/ConsentMessageHandler.mjs +21 -0
- package/build/handlers/ConsentMessageHandler.mjs.map +1 -0
- package/build/handlers/DeclineMessageHandler.d.mts +19 -0
- package/build/handlers/DeclineMessageHandler.d.mts.map +1 -0
- package/build/handlers/DeclineMessageHandler.mjs +21 -0
- package/build/handlers/DeclineMessageHandler.mjs.map +1 -0
- package/build/handlers/PartialSignatureMessageHandler.d.mts +19 -0
- package/build/handlers/PartialSignatureMessageHandler.d.mts.map +1 -0
- package/build/handlers/PartialSignatureMessageHandler.mjs +21 -0
- package/build/handlers/PartialSignatureMessageHandler.mjs.map +1 -0
- package/build/handlers/ProposeSigningMessageHandler.d.mts +19 -0
- package/build/handlers/ProposeSigningMessageHandler.d.mts.map +1 -0
- package/build/handlers/ProposeSigningMessageHandler.mjs +21 -0
- package/build/handlers/ProposeSigningMessageHandler.mjs.map +1 -0
- package/build/handlers/ProvideArtifactsMessageHandler.d.mts +19 -0
- package/build/handlers/ProvideArtifactsMessageHandler.d.mts.map +1 -0
- package/build/handlers/ProvideArtifactsMessageHandler.mjs +21 -0
- package/build/handlers/ProvideArtifactsMessageHandler.mjs.map +1 -0
- package/build/handlers/RequestSigningMessageHandler.d.mts +19 -0
- package/build/handlers/RequestSigningMessageHandler.d.mts.map +1 -0
- package/build/handlers/RequestSigningMessageHandler.mjs +21 -0
- package/build/handlers/RequestSigningMessageHandler.mjs.map +1 -0
- package/build/handlers/SigningAckMessageHandler.d.mts +22 -0
- package/build/handlers/SigningAckMessageHandler.d.mts.map +1 -0
- package/build/handlers/SigningAckMessageHandler.mjs +25 -0
- package/build/handlers/SigningAckMessageHandler.mjs.map +1 -0
- package/build/handlers/SigningProblemReportMessageHandler.d.mts +19 -0
- package/build/handlers/SigningProblemReportMessageHandler.d.mts.map +1 -0
- package/build/handlers/SigningProblemReportMessageHandler.mjs +21 -0
- package/build/handlers/SigningProblemReportMessageHandler.mjs.map +1 -0
- package/build/handlers/index.d.mts +9 -0
- package/build/handlers/index.mjs +9 -0
- package/build/index.d.mts +75 -0
- package/build/index.mjs +63 -0
- package/build/messages/CombineMessage.d.mts +32 -0
- package/build/messages/CombineMessage.d.mts.map +1 -0
- package/build/messages/CombineMessage.mjs +47 -0
- package/build/messages/CombineMessage.mjs.map +1 -0
- package/build/messages/ConsentMessage.d.mts +32 -0
- package/build/messages/ConsentMessage.d.mts.map +1 -0
- package/build/messages/ConsentMessage.mjs +46 -0
- package/build/messages/ConsentMessage.mjs.map +1 -0
- package/build/messages/DeclineMessage.d.mts +26 -0
- package/build/messages/DeclineMessage.d.mts.map +1 -0
- package/build/messages/DeclineMessage.mjs +47 -0
- package/build/messages/DeclineMessage.mjs.map +1 -0
- package/build/messages/PartialSignatureMessage.d.mts +36 -0
- package/build/messages/PartialSignatureMessage.d.mts.map +1 -0
- package/build/messages/PartialSignatureMessage.mjs +72 -0
- package/build/messages/PartialSignatureMessage.mjs.map +1 -0
- package/build/messages/ProposeSigningMessage.d.mts +27 -0
- package/build/messages/ProposeSigningMessage.d.mts.map +1 -0
- package/build/messages/ProposeSigningMessage.mjs +41 -0
- package/build/messages/ProposeSigningMessage.mjs.map +1 -0
- package/build/messages/ProvideArtifactsMessage.d.mts +62 -0
- package/build/messages/ProvideArtifactsMessage.d.mts.map +1 -0
- package/build/messages/ProvideArtifactsMessage.mjs +40 -0
- package/build/messages/ProvideArtifactsMessage.mjs.map +1 -0
- package/build/messages/RequestSigningMessage.d.mts +38 -0
- package/build/messages/RequestSigningMessage.d.mts.map +1 -0
- package/build/messages/RequestSigningMessage.mjs +62 -0
- package/build/messages/RequestSigningMessage.mjs.map +1 -0
- package/build/messages/SigningAckMessage.d.mts +26 -0
- package/build/messages/SigningAckMessage.d.mts.map +1 -0
- package/build/messages/SigningAckMessage.mjs +46 -0
- package/build/messages/SigningAckMessage.mjs.map +1 -0
- package/build/messages/SigningProblemReportMessage.d.mts +44 -0
- package/build/messages/SigningProblemReportMessage.d.mts.map +1 -0
- package/build/messages/SigningProblemReportMessage.mjs +65 -0
- package/build/messages/SigningProblemReportMessage.mjs.map +1 -0
- package/build/messages/index.d.mts +9 -0
- package/build/messages/index.mjs +9 -0
- package/build/models/AggregationResult.d.mts +85 -0
- package/build/models/AggregationResult.d.mts.map +1 -0
- package/build/models/ArtifactMetadata.d.mts +37 -0
- package/build/models/ArtifactMetadata.d.mts.map +1 -0
- package/build/models/AuthzArtifact.d.mts +178 -0
- package/build/models/AuthzArtifact.d.mts.map +1 -0
- package/build/models/Capabilities.d.mts +109 -0
- package/build/models/Capabilities.d.mts.map +1 -0
- package/build/models/JoinToken.d.mts +344 -0
- package/build/models/JoinToken.d.mts.map +1 -0
- package/build/models/JoinToken.mjs +14 -0
- package/build/models/JoinToken.mjs.map +1 -0
- package/build/models/PartialSignature.d.mts +82 -0
- package/build/models/PartialSignature.d.mts.map +1 -0
- package/build/models/PolicyContext.d.mts +55 -0
- package/build/models/PolicyContext.d.mts.map +1 -0
- package/build/models/RouterAttestation.d.mts +186 -0
- package/build/models/RouterAttestation.d.mts.map +1 -0
- package/build/models/Session.d.mts +62 -0
- package/build/models/Session.d.mts.map +1 -0
- package/build/models/Session.mjs +19 -0
- package/build/models/Session.mjs.map +1 -0
- package/build/models/SignableObject.d.mts +71 -0
- package/build/models/SignableObject.d.mts.map +1 -0
- package/build/models/SigningState.d.mts +21 -0
- package/build/models/SigningState.d.mts.map +1 -0
- package/build/models/SigningState.mjs +23 -0
- package/build/models/SigningState.mjs.map +1 -0
- package/build/models/Suite.d.mts +59 -0
- package/build/models/Suite.d.mts.map +1 -0
- package/build/models/index.d.mts +12 -0
- package/build/pdf/PdfUtils.d.mts +160 -0
- package/build/pdf/PdfUtils.d.mts.map +1 -0
- package/build/pdf/PdfUtils.mjs +283 -0
- package/build/pdf/PdfUtils.mjs.map +1 -0
- package/build/pdf/index.mjs +1 -0
- package/build/registry/aggregators/Aggregator.d.mts +85 -0
- package/build/registry/aggregators/Aggregator.d.mts.map +1 -0
- package/build/registry/aggregators/AggregatorRegistry.d.mts +55 -0
- package/build/registry/aggregators/AggregatorRegistry.d.mts.map +1 -0
- package/build/registry/aggregators/AggregatorRegistry.mjs +76 -0
- package/build/registry/aggregators/AggregatorRegistry.mjs.map +1 -0
- package/build/registry/aggregators/BundleNoneAggregator.d.mts +43 -0
- package/build/registry/aggregators/BundleNoneAggregator.d.mts.map +1 -0
- package/build/registry/aggregators/BundleNoneAggregator.mjs +65 -0
- package/build/registry/aggregators/BundleNoneAggregator.mjs.map +1 -0
- package/build/registry/aggregators/index.d.mts +3 -0
- package/build/registry/aggregators/index.mjs +2 -0
- package/build/registry/canonicalizers/Canonicalizer.d.mts +67 -0
- package/build/registry/canonicalizers/Canonicalizer.d.mts.map +1 -0
- package/build/registry/canonicalizers/CanonicalizerRegistry.d.mts +55 -0
- package/build/registry/canonicalizers/CanonicalizerRegistry.d.mts.map +1 -0
- package/build/registry/canonicalizers/CanonicalizerRegistry.mjs +78 -0
- package/build/registry/canonicalizers/CanonicalizerRegistry.mjs.map +1 -0
- package/build/registry/canonicalizers/PdfIncrementalUpdateCanonicalizer.d.mts +126 -0
- package/build/registry/canonicalizers/PdfIncrementalUpdateCanonicalizer.d.mts.map +1 -0
- package/build/registry/canonicalizers/PdfIncrementalUpdateCanonicalizer.mjs +143 -0
- package/build/registry/canonicalizers/PdfIncrementalUpdateCanonicalizer.mjs.map +1 -0
- package/build/registry/canonicalizers/RawBytesCanonicalizer.d.mts +34 -0
- package/build/registry/canonicalizers/RawBytesCanonicalizer.d.mts.map +1 -0
- package/build/registry/canonicalizers/RawBytesCanonicalizer.mjs +55 -0
- package/build/registry/canonicalizers/RawBytesCanonicalizer.mjs.map +1 -0
- package/build/registry/canonicalizers/index.d.mts +4 -0
- package/build/registry/canonicalizers/index.mjs +3 -0
- package/build/registry/index.d.mts +18 -0
- package/build/registry/index.mjs +14 -0
- package/build/registry/policies/Policy.d.mts +62 -0
- package/build/registry/policies/Policy.d.mts.map +1 -0
- package/build/registry/policies/PolicyRegistry.d.mts +54 -0
- package/build/registry/policies/PolicyRegistry.d.mts.map +1 -0
- package/build/registry/policies/PolicyRegistry.mjs +73 -0
- package/build/registry/policies/PolicyRegistry.mjs.map +1 -0
- package/build/registry/policies/TimeWindowPolicy.d.mts +85 -0
- package/build/registry/policies/TimeWindowPolicy.d.mts.map +1 -0
- package/build/registry/policies/TimeWindowPolicy.mjs +111 -0
- package/build/registry/policies/TimeWindowPolicy.mjs.map +1 -0
- package/build/registry/policies/index.d.mts +3 -0
- package/build/registry/policies/index.mjs +2 -0
- package/build/registry/suites/JwsEd25519Suite.d.mts +47 -0
- package/build/registry/suites/JwsEd25519Suite.d.mts.map +1 -0
- package/build/registry/suites/JwsEd25519Suite.mjs +101 -0
- package/build/registry/suites/JwsEd25519Suite.mjs.map +1 -0
- package/build/registry/suites/PadesBLtaSuite.d.mts +106 -0
- package/build/registry/suites/PadesBLtaSuite.d.mts.map +1 -0
- package/build/registry/suites/PadesBLtaSuite.mjs +122 -0
- package/build/registry/suites/PadesBLtaSuite.mjs.map +1 -0
- package/build/registry/suites/SignatureSuite.d.mts +128 -0
- package/build/registry/suites/SignatureSuite.d.mts.map +1 -0
- package/build/registry/suites/SignatureSuiteRegistry.d.mts +62 -0
- package/build/registry/suites/SignatureSuiteRegistry.d.mts.map +1 -0
- package/build/registry/suites/SignatureSuiteRegistry.mjs +87 -0
- package/build/registry/suites/SignatureSuiteRegistry.mjs.map +1 -0
- package/build/registry/suites/index.d.mts +4 -0
- package/build/registry/suites/index.mjs +3 -0
- package/build/repository/CounterRecord.d.mts +84 -0
- package/build/repository/CounterRecord.d.mts.map +1 -0
- package/build/repository/CounterRecord.mjs +82 -0
- package/build/repository/CounterRecord.mjs.map +1 -0
- package/build/repository/CounterRepository.d.mts +22 -0
- package/build/repository/CounterRepository.d.mts.map +1 -0
- package/build/repository/CounterRepository.mjs +51 -0
- package/build/repository/CounterRepository.mjs.map +1 -0
- package/build/repository/SigningSessionRecord.d.mts +102 -0
- package/build/repository/SigningSessionRecord.d.mts.map +1 -0
- package/build/repository/SigningSessionRecord.mjs +96 -0
- package/build/repository/SigningSessionRecord.mjs.map +1 -0
- package/build/repository/SigningSessionRepository.d.mts +30 -0
- package/build/repository/SigningSessionRepository.d.mts.map +1 -0
- package/build/repository/SigningSessionRepository.mjs +52 -0
- package/build/repository/SigningSessionRepository.mjs.map +1 -0
- package/build/repository/index.d.mts +4 -0
- package/build/repository/index.mjs +4 -0
- package/build/services/CounterService.d.mts +121 -0
- package/build/services/CounterService.d.mts.map +1 -0
- package/build/services/CounterService.mjs +176 -0
- package/build/services/CounterService.mjs.map +1 -0
- package/build/services/HPKEService.d.mts +174 -0
- package/build/services/HPKEService.d.mts.map +1 -0
- package/build/services/HPKEService.mjs +195 -0
- package/build/services/HPKEService.mjs.map +1 -0
- package/build/services/SigningService.d.mts +387 -0
- package/build/services/SigningService.d.mts.map +1 -0
- package/build/services/SigningService.mjs +1104 -0
- package/build/services/SigningService.mjs.map +1 -0
- package/build/services/index.d.mts +3 -0
- package/build/services/index.mjs +3 -0
- package/package.json +44 -3
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
//#region src/models/JoinToken.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Join Token Models for Group Messaging Protocol
|
|
4
|
+
*
|
|
5
|
+
* Implements replay-proof join tokens with HPKE envelopes as defined in:
|
|
6
|
+
* - Signing Protocol v1.0 Sealed Secret Profile (Lines 997-1317)
|
|
7
|
+
* - Group Messaging Protocol Section 5 (Lines 45-46, 119-172)
|
|
8
|
+
*
|
|
9
|
+
* Join tokens provide secure, one-time-use credentials for joining rooms with:
|
|
10
|
+
* - Replay protection via monotonic counters
|
|
11
|
+
* - Device binding via HPKE encryption
|
|
12
|
+
* - Expiry enforcement
|
|
13
|
+
* - AAD binding to prevent envelope transplant attacks
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Signing Ticket - Server-signed authorization token
|
|
17
|
+
*
|
|
18
|
+
* The ticket contains all authorization metadata and is signed by the
|
|
19
|
+
* coordinator/admin to prove authenticity.
|
|
20
|
+
*/
|
|
21
|
+
interface SigningTicket {
|
|
22
|
+
/**
|
|
23
|
+
* Token type (always "signing-ticket" for join tokens)
|
|
24
|
+
*/
|
|
25
|
+
typ: 'signing-ticket';
|
|
26
|
+
/**
|
|
27
|
+
* Session identifier linking this token to a signing session
|
|
28
|
+
*/
|
|
29
|
+
session_id: string;
|
|
30
|
+
/**
|
|
31
|
+
* Authorization scope
|
|
32
|
+
* - "join": Join a room
|
|
33
|
+
* - "unlock": Unlock a resource
|
|
34
|
+
* - "sign": Authorize signing
|
|
35
|
+
* - "submit": Submit a transaction
|
|
36
|
+
*/
|
|
37
|
+
scope: 'join' | 'unlock' | 'sign' | 'submit' | string;
|
|
38
|
+
/**
|
|
39
|
+
* Device DID or key identifier this token is bound to
|
|
40
|
+
* @example "did:ex:alice#device1" or "z6Mkk..."
|
|
41
|
+
*/
|
|
42
|
+
device: string;
|
|
43
|
+
/**
|
|
44
|
+
* Monotonic counter for replay protection
|
|
45
|
+
*
|
|
46
|
+
* CRITICAL: Must be strictly monotonically increasing per device.
|
|
47
|
+
* Client MUST reject tokens with ctr <= last_seen_ctr(device).
|
|
48
|
+
*/
|
|
49
|
+
ctr: number;
|
|
50
|
+
/**
|
|
51
|
+
* Expiration timestamp (ISO 8601)
|
|
52
|
+
* @example "2025-10-23T16:00:00Z"
|
|
53
|
+
*/
|
|
54
|
+
exp: string;
|
|
55
|
+
/**
|
|
56
|
+
* Capacity - maximum number of uses (typically 1 for single-use)
|
|
57
|
+
*/
|
|
58
|
+
cap: number;
|
|
59
|
+
/**
|
|
60
|
+
* Optional: Intended audience DIDs
|
|
61
|
+
*/
|
|
62
|
+
aud?: string[];
|
|
63
|
+
/**
|
|
64
|
+
* Optional: Policy hash commitment
|
|
65
|
+
*/
|
|
66
|
+
policy_hash?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Optional: Nonce for additional replay protection
|
|
69
|
+
*/
|
|
70
|
+
nonce?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Token Signature
|
|
74
|
+
*
|
|
75
|
+
* Cryptographic signature over the ticket proving it was issued by
|
|
76
|
+
* an authorized coordinator/admin.
|
|
77
|
+
*/
|
|
78
|
+
interface TokenSignature {
|
|
79
|
+
/**
|
|
80
|
+
* Signature suite identifier
|
|
81
|
+
* @example "jws-ed25519@1"
|
|
82
|
+
*/
|
|
83
|
+
suite: string;
|
|
84
|
+
/**
|
|
85
|
+
* Key identifier (DID URL)
|
|
86
|
+
* @example "did:ex:coordinator#key1"
|
|
87
|
+
*/
|
|
88
|
+
kid?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Signature value (JWS compact or detached)
|
|
91
|
+
*/
|
|
92
|
+
value: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* HPKE Envelope - Hybrid Public Key Encryption envelope
|
|
96
|
+
*
|
|
97
|
+
* Encrypts the payload (e.g., MLS Welcome message) using HPKE (RFC 9180)
|
|
98
|
+
* with Additional Authenticated Data (AAD) binding to the token digest.
|
|
99
|
+
*/
|
|
100
|
+
interface HPKEEnvelope {
|
|
101
|
+
/**
|
|
102
|
+
* Envelope suite identifier
|
|
103
|
+
* - "envelope-hpke@1": RFC 9180 HPKE (REQUIRED)
|
|
104
|
+
* - "envelope-didcomm-auth@1": DIDComm v2 authcrypt (OPTIONAL)
|
|
105
|
+
*/
|
|
106
|
+
suite: 'envelope-hpke@1' | 'envelope-didcomm-auth@1';
|
|
107
|
+
/**
|
|
108
|
+
* Additional Authenticated Data
|
|
109
|
+
*
|
|
110
|
+
* MUST include ticket_digest to cryptographically bind the envelope
|
|
111
|
+
* to the specific token, preventing envelope transplant attacks.
|
|
112
|
+
*/
|
|
113
|
+
aad: {
|
|
114
|
+
/**
|
|
115
|
+
* SHA-256 digest of the ticket
|
|
116
|
+
* Format: "sha-256:base64..."
|
|
117
|
+
*
|
|
118
|
+
* CRITICAL: Must match sha256(serialize(token))
|
|
119
|
+
*/
|
|
120
|
+
ticket_digest: string;
|
|
121
|
+
/**
|
|
122
|
+
* Optional: Session ID for context
|
|
123
|
+
*/
|
|
124
|
+
session_id?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Optional: Device identifier for context
|
|
127
|
+
*/
|
|
128
|
+
device?: string;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Encrypted payload (base64 or hex encoded)
|
|
132
|
+
*
|
|
133
|
+
* Contains the secret being delivered (e.g., MLS Welcome message,
|
|
134
|
+
* database password, API key, etc.)
|
|
135
|
+
*/
|
|
136
|
+
ciphertext: string;
|
|
137
|
+
/**
|
|
138
|
+
* Encryption metadata
|
|
139
|
+
*
|
|
140
|
+
* Specifies the HPKE configuration used for encryption.
|
|
141
|
+
*/
|
|
142
|
+
enc: {
|
|
143
|
+
/**
|
|
144
|
+
* Key Encapsulation Mechanism
|
|
145
|
+
* MUST: "DHKEM-X25519-HKDF-SHA256" (X25519)
|
|
146
|
+
* MAY: Other KEMs from RFC 9180
|
|
147
|
+
*/
|
|
148
|
+
kem: string;
|
|
149
|
+
/**
|
|
150
|
+
* Key Derivation Function
|
|
151
|
+
* MUST: "HKDF-SHA256"
|
|
152
|
+
* MAY: "HKDF-SHA384", "HKDF-SHA512"
|
|
153
|
+
*/
|
|
154
|
+
kdf: string;
|
|
155
|
+
/**
|
|
156
|
+
* Authenticated Encryption with Associated Data algorithm
|
|
157
|
+
* MUST support at least one of:
|
|
158
|
+
* - "AES-128-GCM"
|
|
159
|
+
* - "AES-256-GCM"
|
|
160
|
+
* - "ChaCha20-Poly1305"
|
|
161
|
+
*/
|
|
162
|
+
aead: string;
|
|
163
|
+
/**
|
|
164
|
+
* Ephemeral public key (base64 or hex encoded)
|
|
165
|
+
*
|
|
166
|
+
* Generated during HPKE Seal operation, used for decryption.
|
|
167
|
+
*/
|
|
168
|
+
ek_pub: string;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Join Token - Complete replay-proof authorization token
|
|
173
|
+
*
|
|
174
|
+
* Combines a signed ticket with an HPKE-encrypted envelope to provide
|
|
175
|
+
* secure, one-time-use credentials for joining rooms.
|
|
176
|
+
*
|
|
177
|
+
* Security properties:
|
|
178
|
+
* - Replay protection: Monotonic counter (ctr)
|
|
179
|
+
* - Device binding: HPKE sealed to specific device key
|
|
180
|
+
* - Transplant resistance: AAD binds envelope to token digest
|
|
181
|
+
* - Single-use: cap = 1 + counter persistence
|
|
182
|
+
* - Short-lived: Expiry typically 30-120 seconds
|
|
183
|
+
* - Non-exportable: Device keys stored in TPM/SE/Keychain
|
|
184
|
+
*/
|
|
185
|
+
interface JoinToken {
|
|
186
|
+
/**
|
|
187
|
+
* The authorization ticket with metadata
|
|
188
|
+
*/
|
|
189
|
+
token: SigningTicket;
|
|
190
|
+
/**
|
|
191
|
+
* Cryptographic signature over the ticket
|
|
192
|
+
*/
|
|
193
|
+
sig: TokenSignature;
|
|
194
|
+
/**
|
|
195
|
+
* HPKE-encrypted envelope containing the secret payload
|
|
196
|
+
*/
|
|
197
|
+
envelope: HPKEEnvelope;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Options for creating a join token
|
|
201
|
+
*/
|
|
202
|
+
interface CreateJoinTokenOptions {
|
|
203
|
+
/**
|
|
204
|
+
* Session identifier
|
|
205
|
+
*/
|
|
206
|
+
sessionId: string;
|
|
207
|
+
/**
|
|
208
|
+
* Device DID or key identifier
|
|
209
|
+
*/
|
|
210
|
+
deviceDid: string;
|
|
211
|
+
/**
|
|
212
|
+
* Device public key for HPKE encryption (X25519)
|
|
213
|
+
* Should be a 32-byte Uint8Array
|
|
214
|
+
*/
|
|
215
|
+
devicePublicKey: Uint8Array;
|
|
216
|
+
/**
|
|
217
|
+
* Expiration time in seconds from now
|
|
218
|
+
* @default 120 (2 minutes)
|
|
219
|
+
*/
|
|
220
|
+
expiresIn?: number;
|
|
221
|
+
/**
|
|
222
|
+
* Capacity (max uses)
|
|
223
|
+
* @default 1
|
|
224
|
+
*/
|
|
225
|
+
capacity?: number;
|
|
226
|
+
/**
|
|
227
|
+
* Authorization scope
|
|
228
|
+
* @default "join"
|
|
229
|
+
*/
|
|
230
|
+
scope?: string;
|
|
231
|
+
/**
|
|
232
|
+
* Payload to encrypt in the envelope
|
|
233
|
+
* Typically: MLS Welcome message, group info, etc.
|
|
234
|
+
*/
|
|
235
|
+
payload: unknown;
|
|
236
|
+
/**
|
|
237
|
+
* Optional: Intended audience DIDs
|
|
238
|
+
*/
|
|
239
|
+
audience?: string[];
|
|
240
|
+
/**
|
|
241
|
+
* Optional: Policy hash
|
|
242
|
+
*/
|
|
243
|
+
policyHash?: string;
|
|
244
|
+
/**
|
|
245
|
+
* Optional: Nonce
|
|
246
|
+
*/
|
|
247
|
+
nonce?: string;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Options for verifying a join token
|
|
251
|
+
*/
|
|
252
|
+
interface VerifyJoinTokenOptions {
|
|
253
|
+
/**
|
|
254
|
+
* Device private key for HPKE decryption (X25519)
|
|
255
|
+
* Should be a 32-byte Uint8Array
|
|
256
|
+
*/
|
|
257
|
+
devicePrivateKey: Uint8Array;
|
|
258
|
+
/**
|
|
259
|
+
* Whether to enforce expiry checking
|
|
260
|
+
* @default true
|
|
261
|
+
*/
|
|
262
|
+
enforceExpiry?: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Whether to enforce counter checking
|
|
265
|
+
* @default true
|
|
266
|
+
*/
|
|
267
|
+
enforceCounter?: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Expected coordinator/admin DID for signature verification
|
|
270
|
+
*/
|
|
271
|
+
expectedCoordinator?: string;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Result of join token verification
|
|
275
|
+
*/
|
|
276
|
+
interface JoinTokenVerificationResult {
|
|
277
|
+
/**
|
|
278
|
+
* Whether the token is valid
|
|
279
|
+
*/
|
|
280
|
+
valid: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Reason for failure (if not valid)
|
|
283
|
+
*/
|
|
284
|
+
reason?: string;
|
|
285
|
+
/**
|
|
286
|
+
* Decrypted payload (if valid)
|
|
287
|
+
*/
|
|
288
|
+
payload?: unknown;
|
|
289
|
+
/**
|
|
290
|
+
* Token metadata
|
|
291
|
+
*/
|
|
292
|
+
metadata?: {
|
|
293
|
+
/**
|
|
294
|
+
* Counter value from the token
|
|
295
|
+
*/
|
|
296
|
+
counter?: number;
|
|
297
|
+
/**
|
|
298
|
+
* Device DID from the token
|
|
299
|
+
*/
|
|
300
|
+
device?: string;
|
|
301
|
+
/**
|
|
302
|
+
* Expiry timestamp
|
|
303
|
+
*/
|
|
304
|
+
expiry?: string;
|
|
305
|
+
/**
|
|
306
|
+
* Whether the token has expired
|
|
307
|
+
*/
|
|
308
|
+
expired?: boolean;
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* HPKE Configuration
|
|
313
|
+
*
|
|
314
|
+
* Defines the cryptographic parameters for HPKE operations.
|
|
315
|
+
* Per spec, MUST support these specific algorithms.
|
|
316
|
+
*/
|
|
317
|
+
interface HPKEConfig {
|
|
318
|
+
/**
|
|
319
|
+
* Key Encapsulation Mechanism
|
|
320
|
+
* MUST: DHKEM-X25519-HKDF-SHA256 (0x0020)
|
|
321
|
+
*/
|
|
322
|
+
kem: number;
|
|
323
|
+
/**
|
|
324
|
+
* Key Derivation Function
|
|
325
|
+
* MUST: HKDF-SHA256 (0x0001)
|
|
326
|
+
*/
|
|
327
|
+
kdf: number;
|
|
328
|
+
/**
|
|
329
|
+
* Authenticated Encryption with Associated Data
|
|
330
|
+
* MUST support at least one:
|
|
331
|
+
* - AES-128-GCM (0x0001)
|
|
332
|
+
* - AES-256-GCM (0x0002)
|
|
333
|
+
* - ChaCha20-Poly1305 (0x0003)
|
|
334
|
+
*/
|
|
335
|
+
aead: number;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Default HPKE configuration per spec
|
|
339
|
+
* Uses X25519, HKDF-SHA256, and AES-256-GCM
|
|
340
|
+
*/
|
|
341
|
+
declare const DEFAULT_HPKE_CONFIG: HPKEConfig;
|
|
342
|
+
//#endregion
|
|
343
|
+
export { CreateJoinTokenOptions, DEFAULT_HPKE_CONFIG, HPKEConfig, HPKEEnvelope, JoinToken, JoinTokenVerificationResult, SigningTicket, TokenSignature, VerifyJoinTokenOptions };
|
|
344
|
+
//# sourceMappingURL=JoinToken.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JoinToken.d.mts","names":[],"sources":["../../src/models/JoinToken.ts"],"mappings":";;AAoBA;;;;;;;;;;;;;;;;AAmEA;;UAnEiB,aAAA;EAmEc;;;EA/D7B,GAAA;EA+EK;;AASP;EAnFE,UAAA;;;;;;;;EASA,KAAA;EAyHA;;;;EAnHA,MAAA;EAgJQ;;AAkBV;;;;EA1JE,GAAA;EAwKU;;;;EAlKV,GAAA;EA6JA;;;EAxJA,GAAA;EA6JsB;;AAMxB;EA9JE,GAAA;;;;EAKA,WAAA;EAwKA;;;EAnKA,KAAA;AAAA;;;;;;;UASe,cAAA;EAuMsB;;;;EAlMrC,KAAA;EA6MA;;;;EAvMA,GAAA;EAwNe;;;EAnNf,KAAA;AAAA;;;;;;;UASe,YAAA;EAgPN;;AAUX;;;EApPE,KAAA;EAyPA;;;;;AAsBF;EAvQE,GAAA;IAuQgC;;;;;;IAhQ9B,aAAA;;;;IAKA,UAAA;;;;IAKA,MAAA;EAAA;;;;;;;EASF,UAAA;;;;;;EAOA,GAAA;;;;;;IAME,GAAA;;;;;;IAOA,GAAA;;;;;;;;IASA,IAAA;;;;;;IAOA,MAAA;EAAA;AAAA;;;;;;;;;;;;;;;UAkBa,SAAA;;;;EAIf,KAAA,EAAO,aAAA;;;;EAKP,GAAA,EAAK,cAAA;;;;EAKL,QAAA,EAAU,YAAA;AAAA;;;;UAMK,sBAAA;;;;EAIf,SAAA;;;;EAKA,SAAA;;;;;EAMA,eAAA,EAAiB,UAAA;;;;;EAMjB,SAAA;;;;;EAMA,QAAA;;;;;EAMA,KAAA;;;;;EAMA,OAAA;;;;EAKA,QAAA;;;;EAKA,UAAA;;;;EAKA,KAAA;AAAA;;;;UAMe,sBAAA;;;;;EAKf,gBAAA,EAAkB,UAAA;;;;;EAMlB,aAAA;;;;;EAMA,cAAA;;;;EAKA,mBAAA;AAAA;;;;UAMe,2BAAA;;;;EAIf,KAAA;;;;EAKA,MAAA;;;;EAKA,OAAA;;;;EAKA,QAAA;;;;IAIE,OAAA;;;;IAKA,MAAA;;;;IAKA,MAAA;;;;IAKA,OAAA;EAAA;AAAA;;;;;;;UAUa,UAAA;;;;;EAKf,GAAA;;;;;EAMA,GAAA;;;;;;;;EASA,IAAA;AAAA;;;;;cAOW,mBAAA,EAAqB,UAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/models/JoinToken.ts
|
|
2
|
+
/**
|
|
3
|
+
* Default HPKE configuration per spec
|
|
4
|
+
* Uses X25519, HKDF-SHA256, and AES-256-GCM
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_HPKE_CONFIG = {
|
|
7
|
+
kem: 32,
|
|
8
|
+
kdf: 1,
|
|
9
|
+
aead: 2
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { DEFAULT_HPKE_CONFIG };
|
|
14
|
+
//# sourceMappingURL=JoinToken.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JoinToken.mjs","names":[],"sources":["../../src/models/JoinToken.ts"],"sourcesContent":["/**\n * Join Token Models for Group Messaging Protocol\n *\n * Implements replay-proof join tokens with HPKE envelopes as defined in:\n * - Signing Protocol v1.0 Sealed Secret Profile (Lines 997-1317)\n * - Group Messaging Protocol Section 5 (Lines 45-46, 119-172)\n *\n * Join tokens provide secure, one-time-use credentials for joining rooms with:\n * - Replay protection via monotonic counters\n * - Device binding via HPKE encryption\n * - Expiry enforcement\n * - AAD binding to prevent envelope transplant attacks\n */\n\n/**\n * Signing Ticket - Server-signed authorization token\n *\n * The ticket contains all authorization metadata and is signed by the\n * coordinator/admin to prove authenticity.\n */\nexport interface SigningTicket {\n /**\n * Token type (always \"signing-ticket\" for join tokens)\n */\n typ: 'signing-ticket'\n\n /**\n * Session identifier linking this token to a signing session\n */\n session_id: string\n\n /**\n * Authorization scope\n * - \"join\": Join a room\n * - \"unlock\": Unlock a resource\n * - \"sign\": Authorize signing\n * - \"submit\": Submit a transaction\n */\n scope: 'join' | 'unlock' | 'sign' | 'submit' | string\n\n /**\n * Device DID or key identifier this token is bound to\n * @example \"did:ex:alice#device1\" or \"z6Mkk...\"\n */\n device: string\n\n /**\n * Monotonic counter for replay protection\n *\n * CRITICAL: Must be strictly monotonically increasing per device.\n * Client MUST reject tokens with ctr <= last_seen_ctr(device).\n */\n ctr: number\n\n /**\n * Expiration timestamp (ISO 8601)\n * @example \"2025-10-23T16:00:00Z\"\n */\n exp: string\n\n /**\n * Capacity - maximum number of uses (typically 1 for single-use)\n */\n cap: number\n\n /**\n * Optional: Intended audience DIDs\n */\n aud?: string[]\n\n /**\n * Optional: Policy hash commitment\n */\n policy_hash?: string\n\n /**\n * Optional: Nonce for additional replay protection\n */\n nonce?: string\n}\n\n/**\n * Token Signature\n *\n * Cryptographic signature over the ticket proving it was issued by\n * an authorized coordinator/admin.\n */\nexport interface TokenSignature {\n /**\n * Signature suite identifier\n * @example \"jws-ed25519@1\"\n */\n suite: string\n\n /**\n * Key identifier (DID URL)\n * @example \"did:ex:coordinator#key1\"\n */\n kid?: string\n\n /**\n * Signature value (JWS compact or detached)\n */\n value: string\n}\n\n/**\n * HPKE Envelope - Hybrid Public Key Encryption envelope\n *\n * Encrypts the payload (e.g., MLS Welcome message) using HPKE (RFC 9180)\n * with Additional Authenticated Data (AAD) binding to the token digest.\n */\nexport interface HPKEEnvelope {\n /**\n * Envelope suite identifier\n * - \"envelope-hpke@1\": RFC 9180 HPKE (REQUIRED)\n * - \"envelope-didcomm-auth@1\": DIDComm v2 authcrypt (OPTIONAL)\n */\n suite: 'envelope-hpke@1' | 'envelope-didcomm-auth@1'\n\n /**\n * Additional Authenticated Data\n *\n * MUST include ticket_digest to cryptographically bind the envelope\n * to the specific token, preventing envelope transplant attacks.\n */\n aad: {\n /**\n * SHA-256 digest of the ticket\n * Format: \"sha-256:base64...\"\n *\n * CRITICAL: Must match sha256(serialize(token))\n */\n ticket_digest: string\n\n /**\n * Optional: Session ID for context\n */\n session_id?: string\n\n /**\n * Optional: Device identifier for context\n */\n device?: string\n }\n\n /**\n * Encrypted payload (base64 or hex encoded)\n *\n * Contains the secret being delivered (e.g., MLS Welcome message,\n * database password, API key, etc.)\n */\n ciphertext: string\n\n /**\n * Encryption metadata\n *\n * Specifies the HPKE configuration used for encryption.\n */\n enc: {\n /**\n * Key Encapsulation Mechanism\n * MUST: \"DHKEM-X25519-HKDF-SHA256\" (X25519)\n * MAY: Other KEMs from RFC 9180\n */\n kem: string\n\n /**\n * Key Derivation Function\n * MUST: \"HKDF-SHA256\"\n * MAY: \"HKDF-SHA384\", \"HKDF-SHA512\"\n */\n kdf: string\n\n /**\n * Authenticated Encryption with Associated Data algorithm\n * MUST support at least one of:\n * - \"AES-128-GCM\"\n * - \"AES-256-GCM\"\n * - \"ChaCha20-Poly1305\"\n */\n aead: string\n\n /**\n * Ephemeral public key (base64 or hex encoded)\n *\n * Generated during HPKE Seal operation, used for decryption.\n */\n ek_pub: string\n }\n}\n\n/**\n * Join Token - Complete replay-proof authorization token\n *\n * Combines a signed ticket with an HPKE-encrypted envelope to provide\n * secure, one-time-use credentials for joining rooms.\n *\n * Security properties:\n * - Replay protection: Monotonic counter (ctr)\n * - Device binding: HPKE sealed to specific device key\n * - Transplant resistance: AAD binds envelope to token digest\n * - Single-use: cap = 1 + counter persistence\n * - Short-lived: Expiry typically 30-120 seconds\n * - Non-exportable: Device keys stored in TPM/SE/Keychain\n */\nexport interface JoinToken {\n /**\n * The authorization ticket with metadata\n */\n token: SigningTicket\n\n /**\n * Cryptographic signature over the ticket\n */\n sig: TokenSignature\n\n /**\n * HPKE-encrypted envelope containing the secret payload\n */\n envelope: HPKEEnvelope\n}\n\n/**\n * Options for creating a join token\n */\nexport interface CreateJoinTokenOptions {\n /**\n * Session identifier\n */\n sessionId: string\n\n /**\n * Device DID or key identifier\n */\n deviceDid: string\n\n /**\n * Device public key for HPKE encryption (X25519)\n * Should be a 32-byte Uint8Array\n */\n devicePublicKey: Uint8Array\n\n /**\n * Expiration time in seconds from now\n * @default 120 (2 minutes)\n */\n expiresIn?: number\n\n /**\n * Capacity (max uses)\n * @default 1\n */\n capacity?: number\n\n /**\n * Authorization scope\n * @default \"join\"\n */\n scope?: string\n\n /**\n * Payload to encrypt in the envelope\n * Typically: MLS Welcome message, group info, etc.\n */\n payload: unknown\n\n /**\n * Optional: Intended audience DIDs\n */\n audience?: string[]\n\n /**\n * Optional: Policy hash\n */\n policyHash?: string\n\n /**\n * Optional: Nonce\n */\n nonce?: string\n}\n\n/**\n * Options for verifying a join token\n */\nexport interface VerifyJoinTokenOptions {\n /**\n * Device private key for HPKE decryption (X25519)\n * Should be a 32-byte Uint8Array\n */\n devicePrivateKey: Uint8Array\n\n /**\n * Whether to enforce expiry checking\n * @default true\n */\n enforceExpiry?: boolean\n\n /**\n * Whether to enforce counter checking\n * @default true\n */\n enforceCounter?: boolean\n\n /**\n * Expected coordinator/admin DID for signature verification\n */\n expectedCoordinator?: string\n}\n\n/**\n * Result of join token verification\n */\nexport interface JoinTokenVerificationResult {\n /**\n * Whether the token is valid\n */\n valid: boolean\n\n /**\n * Reason for failure (if not valid)\n */\n reason?: string\n\n /**\n * Decrypted payload (if valid)\n */\n payload?: unknown\n\n /**\n * Token metadata\n */\n metadata?: {\n /**\n * Counter value from the token\n */\n counter?: number\n\n /**\n * Device DID from the token\n */\n device?: string\n\n /**\n * Expiry timestamp\n */\n expiry?: string\n\n /**\n * Whether the token has expired\n */\n expired?: boolean\n }\n}\n\n/**\n * HPKE Configuration\n *\n * Defines the cryptographic parameters for HPKE operations.\n * Per spec, MUST support these specific algorithms.\n */\nexport interface HPKEConfig {\n /**\n * Key Encapsulation Mechanism\n * MUST: DHKEM-X25519-HKDF-SHA256 (0x0020)\n */\n kem: number\n\n /**\n * Key Derivation Function\n * MUST: HKDF-SHA256 (0x0001)\n */\n kdf: number\n\n /**\n * Authenticated Encryption with Associated Data\n * MUST support at least one:\n * - AES-128-GCM (0x0001)\n * - AES-256-GCM (0x0002)\n * - ChaCha20-Poly1305 (0x0003)\n */\n aead: number\n}\n\n/**\n * Default HPKE configuration per spec\n * Uses X25519, HKDF-SHA256, and AES-256-GCM\n */\nexport const DEFAULT_HPKE_CONFIG: HPKEConfig = {\n kem: 0x0020, // DHKEM(X25519, HKDF-SHA256)\n kdf: 0x0001, // HKDF-SHA256\n aead: 0x0002, // AES-256-GCM\n}\n"],"mappings":";;;;;AAqYA,MAAa,sBAAkC;CAC7C,KAAK;CACL,KAAK;CACL,MAAM;CACP"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//#region src/models/PartialSignature.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Signature result from a signature suite
|
|
4
|
+
*/
|
|
5
|
+
interface SignatureResult {
|
|
6
|
+
/**
|
|
7
|
+
* Signature format
|
|
8
|
+
* @example "jws", "eip-712", "raw", "pades"
|
|
9
|
+
*/
|
|
10
|
+
format: string;
|
|
11
|
+
/**
|
|
12
|
+
* The signature value (encoding depends on format)
|
|
13
|
+
* @example "0x..." for EVM, base64 for JWS
|
|
14
|
+
*/
|
|
15
|
+
value: string;
|
|
16
|
+
/**
|
|
17
|
+
* Optional public key hint for verification
|
|
18
|
+
*/
|
|
19
|
+
publicKeyHint?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional metadata about the signature
|
|
22
|
+
*/
|
|
23
|
+
metadata?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Partial signature from one signer in a multi-sig session
|
|
27
|
+
*/
|
|
28
|
+
interface PartialSignature {
|
|
29
|
+
/**
|
|
30
|
+
* DID of the signer
|
|
31
|
+
*/
|
|
32
|
+
signer: string;
|
|
33
|
+
/**
|
|
34
|
+
* Suite used for signing
|
|
35
|
+
*/
|
|
36
|
+
suite: string;
|
|
37
|
+
/**
|
|
38
|
+
* Round number (for multi-round protocols like MuSig2)
|
|
39
|
+
*/
|
|
40
|
+
round?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Round-specific data (commitments, nonces, etc.)
|
|
43
|
+
*/
|
|
44
|
+
data?: unknown;
|
|
45
|
+
/**
|
|
46
|
+
* The actual signature (single-round) or undefined for intermediate rounds
|
|
47
|
+
*/
|
|
48
|
+
signature?: SignatureResult;
|
|
49
|
+
/**
|
|
50
|
+
* Timestamp when signature was created
|
|
51
|
+
*/
|
|
52
|
+
timestamp: Date;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Consent data with key binding proof
|
|
56
|
+
*/
|
|
57
|
+
interface ConsentData {
|
|
58
|
+
/**
|
|
59
|
+
* Signer DID
|
|
60
|
+
*/
|
|
61
|
+
signer: string;
|
|
62
|
+
/**
|
|
63
|
+
* Object ID being consented to
|
|
64
|
+
*/
|
|
65
|
+
objectId: string;
|
|
66
|
+
/**
|
|
67
|
+
* Key binding proof
|
|
68
|
+
*/
|
|
69
|
+
keyBindingProof: {
|
|
70
|
+
type: string;
|
|
71
|
+
kid: string;
|
|
72
|
+
payload: string;
|
|
73
|
+
signature: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Timestamp of consent
|
|
77
|
+
*/
|
|
78
|
+
timestamp: Date;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { ConsentData, PartialSignature, SignatureResult };
|
|
82
|
+
//# sourceMappingURL=PartialSignature.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PartialSignature.d.mts","names":[],"sources":["../../src/models/PartialSignature.ts"],"mappings":";;AAGA;;UAAiB,eAAA;EAqBE;;;;EAhBjB,MAAA;EAgBW;;;AAMb;EAhBE,KAAA;;;;EAKA,aAAA;EAyBA;;;EApBA,QAAA,GAAW,MAAA;AAAA;;;;UAMI,gBAAA;EAmCW;;;EA/B1B,MAAA;EAwCA;;;EAnCA,KAAA;EA2CE;;;EAtCF,KAAA;EA6Ce;;;EAxCf,IAAA;;;;EAKA,SAAA,GAAY,eAAA;;;;EAKZ,SAAA,EAAW,IAAA;AAAA;;;;UAMI,WAAA;;;;EAIf,MAAA;;;;EAKA,QAAA;;;;EAKA,eAAA;IACE,IAAA;IACA,GAAA;IACA,OAAA;IACA,SAAA;EAAA;;;;EAMF,SAAA,EAAW,IAAA;AAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { SignableObject } from "./SignableObject.mjs";
|
|
2
|
+
import { SuiteConfig } from "./Suite.mjs";
|
|
3
|
+
import { SigningSessionRecord } from "../repository/SigningSessionRecord.mjs";
|
|
4
|
+
import "../repository/index.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/models/PolicyContext.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Context passed to policy enforcement
|
|
9
|
+
*/
|
|
10
|
+
interface PolicyContext {
|
|
11
|
+
/**
|
|
12
|
+
* Signing session record
|
|
13
|
+
*/
|
|
14
|
+
session: SigningSessionRecord;
|
|
15
|
+
/**
|
|
16
|
+
* Object being signed
|
|
17
|
+
*/
|
|
18
|
+
object: SignableObject;
|
|
19
|
+
/**
|
|
20
|
+
* Suite configuration
|
|
21
|
+
*/
|
|
22
|
+
suite: SuiteConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Current signer (if applicable)
|
|
25
|
+
*/
|
|
26
|
+
currentSigner?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Current timestamp
|
|
29
|
+
*/
|
|
30
|
+
timestamp: Date;
|
|
31
|
+
/**
|
|
32
|
+
* Additional context data
|
|
33
|
+
*/
|
|
34
|
+
metadata?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Result of policy enforcement
|
|
38
|
+
*/
|
|
39
|
+
interface PolicyResult {
|
|
40
|
+
/**
|
|
41
|
+
* Whether the operation is allowed
|
|
42
|
+
*/
|
|
43
|
+
allowed: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Reason for denial (if not allowed)
|
|
46
|
+
*/
|
|
47
|
+
reason?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Additional metadata
|
|
50
|
+
*/
|
|
51
|
+
metadata?: Record<string, unknown>;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { PolicyContext, PolicyResult };
|
|
55
|
+
//# sourceMappingURL=PolicyContext.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PolicyContext.d.mts","names":[],"sources":["../../src/models/PolicyContext.ts"],"mappings":";;;;;;;;;UAOiB,aAAA;EAAa;;;EAI5B,OAAA,EAAS,oBAAA;EAUF;;;EALP,MAAA,EAAQ,cAAA;EAoBS;;;EAfjB,KAAA,EAAO,WAAA;EALC;;;EAUR,aAAA;EAKA;;;EAAA,SAAA,EAAW,IAAA;EAKM;;AAMnB;EANE,QAAA,GAAW,MAAA;AAAA;;;;UAMI,YAAA;EAcJ;;;EAVX,OAAA;;;;EAKA,MAAA;;;;EAKA,QAAA,GAAW,MAAA;AAAA"}
|