@brightchain/brightchain-lib 0.19.0 → 0.21.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/package.json +6 -2
- package/src/lib/documents/member/memberProfileHydration.d.ts.map +1 -1
- package/src/lib/documents/member/memberProfileHydration.js +6 -0
- package/src/lib/documents/member/memberProfileHydration.js.map +1 -1
- package/src/lib/enumerations/brightChainStrings.d.ts +39 -0
- package/src/lib/enumerations/brightChainStrings.d.ts.map +1 -1
- package/src/lib/enumerations/brightChainStrings.js +47 -0
- package/src/lib/enumerations/brightChainStrings.js.map +1 -1
- package/src/lib/enumerations/identityValidationErrorType.d.ts +11 -0
- package/src/lib/enumerations/identityValidationErrorType.d.ts.map +1 -0
- package/src/lib/enumerations/identityValidationErrorType.js +15 -0
- package/src/lib/enumerations/identityValidationErrorType.js.map +1 -0
- package/src/lib/enumerations/index.d.ts +4 -0
- package/src/lib/enumerations/index.d.ts.map +1 -1
- package/src/lib/enumerations/index.js +5 -0
- package/src/lib/enumerations/index.js.map +1 -1
- package/src/lib/enumerations/memberStatusType.d.ts +2 -1
- package/src/lib/enumerations/memberStatusType.d.ts.map +1 -1
- package/src/lib/enumerations/memberStatusType.js +1 -0
- package/src/lib/enumerations/memberStatusType.js.map +1 -1
- package/src/lib/enumerations/proposalActionType.d.ts +22 -0
- package/src/lib/enumerations/proposalActionType.d.ts.map +1 -0
- package/src/lib/enumerations/proposalActionType.js +26 -0
- package/src/lib/enumerations/proposalActionType.js.map +1 -0
- package/src/lib/enumerations/proposalStatus.d.ts +14 -0
- package/src/lib/enumerations/proposalStatus.d.ts.map +1 -0
- package/src/lib/enumerations/proposalStatus.js +18 -0
- package/src/lib/enumerations/proposalStatus.js.map +1 -0
- package/src/lib/enumerations/quorumErrorType.d.ts +30 -1
- package/src/lib/enumerations/quorumErrorType.d.ts.map +1 -1
- package/src/lib/enumerations/quorumErrorType.js +37 -0
- package/src/lib/enumerations/quorumErrorType.js.map +1 -1
- package/src/lib/enumerations/quorumOperationalMode.d.ts +16 -0
- package/src/lib/enumerations/quorumOperationalMode.d.ts.map +1 -0
- package/src/lib/enumerations/quorumOperationalMode.js +20 -0
- package/src/lib/enumerations/quorumOperationalMode.js.map +1 -0
- package/src/lib/enumerations/sealingErrorType.d.ts +3 -1
- package/src/lib/enumerations/sealingErrorType.d.ts.map +1 -1
- package/src/lib/enumerations/sealingErrorType.js +2 -0
- package/src/lib/enumerations/sealingErrorType.js.map +1 -1
- package/src/lib/errors/identityValidationError.d.ts +8 -0
- package/src/lib/errors/identityValidationError.d.ts.map +1 -0
- package/src/lib/errors/identityValidationError.js +26 -0
- package/src/lib/errors/identityValidationError.js.map +1 -0
- package/src/lib/errors/index.d.ts +4 -0
- package/src/lib/errors/index.d.ts.map +1 -1
- package/src/lib/errors/index.js +7 -0
- package/src/lib/errors/index.js.map +1 -1
- package/src/lib/errors/quorumError.d.ts.map +1 -1
- package/src/lib/errors/quorumError.js +37 -0
- package/src/lib/errors/quorumError.js.map +1 -1
- package/src/lib/errors/sealingError.d.ts.map +1 -1
- package/src/lib/errors/sealingError.js +2 -0
- package/src/lib/errors/sealingError.js.map +1 -1
- package/src/lib/i18n/strings/englishUs.d.ts.map +1 -1
- package/src/lib/i18n/strings/englishUs.js +45 -0
- package/src/lib/i18n/strings/englishUs.js.map +1 -1
- package/src/lib/i18n/strings/french.d.ts.map +1 -1
- package/src/lib/i18n/strings/french.js +37 -0
- package/src/lib/i18n/strings/french.js.map +1 -1
- package/src/lib/i18n/strings/german.d.ts.map +1 -1
- package/src/lib/i18n/strings/german.js +37 -0
- package/src/lib/i18n/strings/german.js.map +1 -1
- package/src/lib/i18n/strings/japanese.d.ts.map +1 -1
- package/src/lib/i18n/strings/japanese.js +37 -0
- package/src/lib/i18n/strings/japanese.js.map +1 -1
- package/src/lib/i18n/strings/mandarin.d.ts.map +1 -1
- package/src/lib/i18n/strings/mandarin.js +37 -0
- package/src/lib/i18n/strings/mandarin.js.map +1 -1
- package/src/lib/i18n/strings/spanish.d.ts.map +1 -1
- package/src/lib/i18n/strings/spanish.js +37 -0
- package/src/lib/i18n/strings/spanish.js.map +1 -1
- package/src/lib/i18n/strings/ukrainian.d.ts.map +1 -1
- package/src/lib/i18n/strings/ukrainian.js +37 -0
- package/src/lib/i18n/strings/ukrainian.js.map +1 -1
- package/src/lib/interfaces/aliasRecord.d.ts +34 -0
- package/src/lib/interfaces/aliasRecord.d.ts.map +1 -0
- package/src/lib/interfaces/aliasRecord.js +11 -0
- package/src/lib/interfaces/aliasRecord.js.map +1 -0
- package/src/lib/interfaces/api/index.d.ts +2 -0
- package/src/lib/interfaces/api/index.d.ts.map +1 -0
- package/src/lib/interfaces/api/index.js +5 -0
- package/src/lib/interfaces/api/index.js.map +1 -0
- package/src/lib/interfaces/api/quorumApi.d.ts +97 -0
- package/src/lib/interfaces/api/quorumApi.d.ts.map +1 -0
- package/src/lib/interfaces/api/quorumApi.js +12 -0
- package/src/lib/interfaces/api/quorumApi.js.map +1 -0
- package/src/lib/interfaces/auditLogEntry.d.ts +34 -0
- package/src/lib/interfaces/auditLogEntry.d.ts.map +1 -0
- package/src/lib/interfaces/auditLogEntry.js +10 -0
- package/src/lib/interfaces/auditLogEntry.js.map +1 -0
- package/src/lib/interfaces/availability/gossipService.d.ts +116 -2
- package/src/lib/interfaces/availability/gossipService.d.ts.map +1 -1
- package/src/lib/interfaces/availability/gossipService.js +62 -0
- package/src/lib/interfaces/availability/gossipService.js.map +1 -1
- package/src/lib/interfaces/chainedAuditLogEntry.d.ts +27 -0
- package/src/lib/interfaces/chainedAuditLogEntry.d.ts.map +1 -0
- package/src/lib/interfaces/chainedAuditLogEntry.js +12 -0
- package/src/lib/interfaces/chainedAuditLogEntry.js.map +1 -0
- package/src/lib/interfaces/contentWithIdentity.d.ts +39 -0
- package/src/lib/interfaces/contentWithIdentity.d.ts.map +1 -0
- package/src/lib/interfaces/contentWithIdentity.js +24 -0
- package/src/lib/interfaces/contentWithIdentity.js.map +1 -0
- package/src/lib/interfaces/energyAccount.d.ts +3 -1
- package/src/lib/interfaces/energyAccount.d.ts.map +1 -1
- package/src/lib/interfaces/identityRecoveryRecord.d.ts +41 -0
- package/src/lib/interfaces/identityRecoveryRecord.d.ts.map +1 -0
- package/src/lib/interfaces/identityRecoveryRecord.js +11 -0
- package/src/lib/interfaces/identityRecoveryRecord.js.map +1 -0
- package/src/lib/interfaces/index.d.ts +16 -0
- package/src/lib/interfaces/index.d.ts.map +1 -1
- package/src/lib/interfaces/index.js +4 -0
- package/src/lib/interfaces/index.js.map +1 -1
- package/src/lib/interfaces/initResult.d.ts +6 -6
- package/src/lib/interfaces/initResult.d.ts.map +1 -1
- package/src/lib/interfaces/member/brightChainBaseInitResult.d.ts +4 -1
- package/src/lib/interfaces/member/brightChainBaseInitResult.d.ts.map +1 -1
- package/src/lib/interfaces/member/brightChainInitResult.d.ts +1 -1
- package/src/lib/interfaces/member/brightChainInitResult.d.ts.map +1 -1
- package/src/lib/interfaces/member/memberData.d.ts +3 -0
- package/src/lib/interfaces/member/memberData.d.ts.map +1 -1
- package/src/lib/interfaces/member/profileStorage.d.ts +5 -0
- package/src/lib/interfaces/member/profileStorage.d.ts.map +1 -1
- package/src/lib/interfaces/operationalState.d.ts +20 -0
- package/src/lib/interfaces/operationalState.d.ts.map +1 -0
- package/src/lib/interfaces/operationalState.js +10 -0
- package/src/lib/interfaces/operationalState.js.map +1 -0
- package/src/lib/interfaces/proposal.d.ts +59 -0
- package/src/lib/interfaces/proposal.d.ts.map +1 -0
- package/src/lib/interfaces/proposal.js +10 -0
- package/src/lib/interfaces/proposal.js.map +1 -0
- package/src/lib/interfaces/quorumDocumentMetadata.d.ts +20 -0
- package/src/lib/interfaces/quorumDocumentMetadata.d.ts.map +1 -0
- package/src/lib/interfaces/quorumDocumentMetadata.js +10 -0
- package/src/lib/interfaces/quorumDocumentMetadata.js.map +1 -0
- package/src/lib/interfaces/quorumEpoch.d.ts +33 -0
- package/src/lib/interfaces/quorumEpoch.d.ts.map +1 -0
- package/src/lib/interfaces/quorumEpoch.js +11 -0
- package/src/lib/interfaces/quorumEpoch.js.map +1 -0
- package/src/lib/interfaces/quorumMetrics.d.ts +49 -0
- package/src/lib/interfaces/quorumMetrics.d.ts.map +1 -0
- package/src/lib/interfaces/quorumMetrics.js +10 -0
- package/src/lib/interfaces/quorumMetrics.js.map +1 -0
- package/src/lib/interfaces/redistributionJournalEntry.d.ts +25 -0
- package/src/lib/interfaces/redistributionJournalEntry.d.ts.map +1 -0
- package/src/lib/interfaces/redistributionJournalEntry.js +11 -0
- package/src/lib/interfaces/redistributionJournalEntry.js.map +1 -0
- package/src/lib/interfaces/responses/backupCodesResponseData.d.ts +3 -5
- package/src/lib/interfaces/responses/backupCodesResponseData.d.ts.map +1 -1
- package/src/lib/interfaces/responses/challengeResponseData.d.ts +5 -0
- package/src/lib/interfaces/responses/challengeResponseData.d.ts.map +1 -1
- package/src/lib/interfaces/responses/codeCountResponseData.d.ts +3 -5
- package/src/lib/interfaces/responses/codeCountResponseData.d.ts.map +1 -1
- package/src/lib/interfaces/responses/index.d.ts +4 -2
- package/src/lib/interfaces/responses/index.d.ts.map +1 -1
- package/src/lib/interfaces/responses/passwordChangeResponse.d.ts +2 -0
- package/src/lib/interfaces/responses/passwordChangeResponse.d.ts.map +1 -0
- package/src/lib/interfaces/responses/passwordChangeResponse.js +3 -0
- package/src/lib/interfaces/responses/passwordChangeResponse.js.map +1 -0
- package/src/lib/interfaces/responses/recoveryResponse.d.ts +2 -0
- package/src/lib/interfaces/responses/recoveryResponse.d.ts.map +1 -0
- package/src/lib/interfaces/responses/recoveryResponse.js +3 -0
- package/src/lib/interfaces/responses/recoveryResponse.js.map +1 -0
- package/src/lib/interfaces/responses/registrationResponseData.d.ts +2 -2
- package/src/lib/interfaces/responses/registrationResponseData.d.ts.map +1 -1
- package/src/lib/interfaces/services/contentIngestion.d.ts +61 -0
- package/src/lib/interfaces/services/contentIngestion.d.ts.map +1 -0
- package/src/lib/interfaces/services/contentIngestion.js +12 -0
- package/src/lib/interfaces/services/contentIngestion.js.map +1 -0
- package/src/lib/interfaces/services/expirationScheduler.d.ts +55 -0
- package/src/lib/interfaces/services/expirationScheduler.d.ts.map +1 -0
- package/src/lib/interfaces/services/expirationScheduler.js +11 -0
- package/src/lib/interfaces/services/expirationScheduler.js.map +1 -0
- package/src/lib/interfaces/services/identitySealingPipeline.d.ts +56 -0
- package/src/lib/interfaces/services/identitySealingPipeline.d.ts.map +1 -0
- package/src/lib/interfaces/services/identitySealingPipeline.js +12 -0
- package/src/lib/interfaces/services/identitySealingPipeline.js.map +1 -0
- package/src/lib/interfaces/services/identityValidator.d.ts +44 -0
- package/src/lib/interfaces/services/identityValidator.d.ts.map +1 -0
- package/src/lib/interfaces/services/identityValidator.js +11 -0
- package/src/lib/interfaces/services/identityValidator.js.map +1 -0
- package/src/lib/interfaces/services/index.d.ts +9 -0
- package/src/lib/interfaces/services/index.d.ts.map +1 -1
- package/src/lib/interfaces/services/membershipProof.d.ts +40 -0
- package/src/lib/interfaces/services/membershipProof.d.ts.map +1 -0
- package/src/lib/interfaces/services/membershipProof.js +11 -0
- package/src/lib/interfaces/services/membershipProof.js.map +1 -0
- package/src/lib/interfaces/services/operatorPrompt.d.ts +68 -0
- package/src/lib/interfaces/services/operatorPrompt.d.ts.map +1 -0
- package/src/lib/interfaces/services/operatorPrompt.js +11 -0
- package/src/lib/interfaces/services/operatorPrompt.js.map +1 -0
- package/src/lib/interfaces/services/quorumDatabase.d.ts +207 -0
- package/src/lib/interfaces/services/quorumDatabase.d.ts.map +1 -0
- package/src/lib/interfaces/services/quorumDatabase.js +13 -0
- package/src/lib/interfaces/services/quorumDatabase.js.map +1 -0
- package/src/lib/interfaces/services/quorumService.d.ts +3 -0
- package/src/lib/interfaces/services/quorumService.d.ts.map +1 -1
- package/src/lib/interfaces/services/quorumStateMachine.d.ts +128 -0
- package/src/lib/interfaces/services/quorumStateMachine.d.ts.map +1 -0
- package/src/lib/interfaces/services/quorumStateMachine.js +12 -0
- package/src/lib/interfaces/services/quorumStateMachine.js.map +1 -0
- package/src/lib/interfaces/services/redistributionConfig.d.ts +20 -0
- package/src/lib/interfaces/services/redistributionConfig.d.ts.map +1 -0
- package/src/lib/interfaces/services/redistributionConfig.js +10 -0
- package/src/lib/interfaces/services/redistributionConfig.js.map +1 -0
- package/src/lib/interfaces/statuteConfig.d.ts +22 -0
- package/src/lib/interfaces/statuteConfig.d.ts.map +1 -0
- package/src/lib/interfaces/statuteConfig.js +18 -0
- package/src/lib/interfaces/statuteConfig.js.map +1 -0
- package/src/lib/interfaces/storage/documentStore.d.ts +46 -24
- package/src/lib/interfaces/storage/documentStore.d.ts.map +1 -1
- package/src/lib/interfaces/storage/documentStore.js +6 -2
- package/src/lib/interfaces/storage/documentStore.js.map +1 -1
- package/src/lib/interfaces/userManagement.d.ts +49 -0
- package/src/lib/interfaces/userManagement.d.ts.map +1 -0
- package/src/lib/interfaces/userManagement.js +9 -0
- package/src/lib/interfaces/userManagement.js.map +1 -0
- package/src/lib/interfaces/vote.d.ts +45 -0
- package/src/lib/interfaces/vote.d.ts.map +1 -0
- package/src/lib/interfaces/vote.js +10 -0
- package/src/lib/interfaces/vote.js.map +1 -0
- package/src/lib/quorumDataRecord.d.ts +7 -1
- package/src/lib/quorumDataRecord.d.ts.map +1 -1
- package/src/lib/quorumDataRecord.js +12 -4
- package/src/lib/quorumDataRecord.js.map +1 -1
- package/src/lib/quorumDataRecordDto.d.ts +6 -0
- package/src/lib/quorumDataRecordDto.d.ts.map +1 -1
- package/src/lib/services/aliasRegistry.d.ts +77 -0
- package/src/lib/services/aliasRegistry.d.ts.map +1 -0
- package/src/lib/services/aliasRegistry.js +138 -0
- package/src/lib/services/aliasRegistry.js.map +1 -0
- package/src/lib/services/auditLogService.d.ts +100 -0
- package/src/lib/services/auditLogService.d.ts.map +1 -0
- package/src/lib/services/auditLogService.js +223 -0
- package/src/lib/services/auditLogService.js.map +1 -0
- package/src/lib/services/blockService.d.ts +2 -1
- package/src/lib/services/blockService.d.ts.map +1 -1
- package/src/lib/services/blockService.js +7 -2
- package/src/lib/services/blockService.js.map +1 -1
- package/src/lib/services/identitySealingPipeline.d.ts +120 -0
- package/src/lib/services/identitySealingPipeline.d.ts.map +1 -0
- package/src/lib/services/identitySealingPipeline.js +288 -0
- package/src/lib/services/identitySealingPipeline.js.map +1 -0
- package/src/lib/services/identityValidator.d.ts +75 -0
- package/src/lib/services/identityValidator.d.ts.map +1 -0
- package/src/lib/services/identityValidator.js +202 -0
- package/src/lib/services/identityValidator.js.map +1 -0
- package/src/lib/services/index.d.ts +6 -0
- package/src/lib/services/index.d.ts.map +1 -1
- package/src/lib/services/index.js +6 -0
- package/src/lib/services/index.js.map +1 -1
- package/src/lib/services/member/memberCblService.d.ts.map +1 -1
- package/src/lib/services/member/memberCblService.js +12 -1
- package/src/lib/services/member/memberCblService.js.map +1 -1
- package/src/lib/services/memberStore.d.ts.map +1 -1
- package/src/lib/services/memberStore.js +2 -0
- package/src/lib/services/memberStore.js.map +1 -1
- package/src/lib/services/membershipProofService.d.ts +90 -0
- package/src/lib/services/membershipProofService.d.ts.map +1 -0
- package/src/lib/services/membershipProofService.js +361 -0
- package/src/lib/services/membershipProofService.js.map +1 -0
- package/src/lib/services/quorumStateMachine.d.ts +336 -0
- package/src/lib/services/quorumStateMachine.d.ts.map +1 -0
- package/src/lib/services/quorumStateMachine.js +1396 -0
- package/src/lib/services/quorumStateMachine.js.map +1 -0
- package/src/lib/services/sealing.service.d.ts +80 -0
- package/src/lib/services/sealing.service.d.ts.map +1 -1
- package/src/lib/services/sealing.service.js +192 -0
- package/src/lib/services/sealing.service.js.map +1 -1
- package/src/lib/stores/energyAccountStore.d.ts +13 -11
- package/src/lib/stores/energyAccountStore.d.ts.map +1 -1
- package/src/lib/stores/energyAccountStore.js +18 -20
- package/src/lib/stores/energyAccountStore.js.map +1 -1
- package/brightchain-lib/BLOCK_COVERAGE_AUDIT.md +0 -169
- package/brightchain-lib/BROWSER_COMPAT.md +0 -54
- package/brightchain-lib/DEPRECATIONS.md +0 -454
- package/brightchain-lib/DEPRECATIONS_REMOVED.md +0 -160
- package/brightchain-lib/MIGRATION.md +0 -801
- package/brightchain-lib/NAMING_AUDIT.md +0 -233
- package/brightchain-lib/NAMING_CONVENTIONS.md +0 -346
- package/brightchain-lib/README.md +0 -611
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview IdentitySealingPipeline — orchestrates the brokered anonymity flow.
|
|
4
|
+
*
|
|
5
|
+
* Captures real identity, generates Shamir shards, replaces identity field,
|
|
6
|
+
* distributes encrypted shards, stores IdentityRecoveryRecord, and discards plaintext.
|
|
7
|
+
*
|
|
8
|
+
* @see Requirements 14
|
|
9
|
+
* @see Design: IdentitySealingPipeline (Section 6)
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.IdentitySealingPipeline = exports.ANONYMOUS_ID = void 0;
|
|
13
|
+
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
14
|
+
const quorumErrorType_1 = require("../enumerations/quorumErrorType");
|
|
15
|
+
const quorumError_1 = require("../errors/quorumError");
|
|
16
|
+
const contentWithIdentity_1 = require("../interfaces/contentWithIdentity");
|
|
17
|
+
/**
|
|
18
|
+
* Anonymous_ID: an all-zeroes 16-byte Uint8Array used as the creatorId
|
|
19
|
+
* when content is posted with no identity attribution.
|
|
20
|
+
*/
|
|
21
|
+
exports.ANONYMOUS_ID = new Uint8Array(16);
|
|
22
|
+
/**
|
|
23
|
+
* Wipe a Uint8Array buffer by filling it with zeroes.
|
|
24
|
+
* Best-effort memory cleanup for sensitive data.
|
|
25
|
+
*/
|
|
26
|
+
function wipeBuffer(buffer) {
|
|
27
|
+
buffer.fill(0);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* IdentitySealingPipeline orchestrates the brokered anonymity flow:
|
|
31
|
+
*
|
|
32
|
+
* 1. Captures the real creator identity before publication
|
|
33
|
+
* 2. Generates Shamir shards from the identity bytes
|
|
34
|
+
* 3. Replaces the identity field based on mode (real/alias/anonymous)
|
|
35
|
+
* 4. Encrypts each shard with the corresponding quorum member's public key via ECIES
|
|
36
|
+
* 5. Verifies shards correctly reconstruct before distributing
|
|
37
|
+
* 6. Stores the IdentityRecoveryRecord in the QuorumDatabase
|
|
38
|
+
* 7. Attaches the recovery record ID to the content metadata
|
|
39
|
+
* 8. Discards the original plaintext identity from memory
|
|
40
|
+
*
|
|
41
|
+
* @template TID - Platform ID type for frontend/backend DTO compatibility
|
|
42
|
+
*/
|
|
43
|
+
class IdentitySealingPipeline {
|
|
44
|
+
constructor(db, sealingService, eciesService, currentEpoch, statuteConfig) {
|
|
45
|
+
this.db = db;
|
|
46
|
+
this.sealingService = sealingService;
|
|
47
|
+
this.eciesService = eciesService;
|
|
48
|
+
this.currentEpoch = currentEpoch;
|
|
49
|
+
this.statuteConfig = statuteConfig;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get the enhanced ID provider from the sealing service for TID ↔ bytes conversion.
|
|
53
|
+
*/
|
|
54
|
+
get enhancedProvider() {
|
|
55
|
+
return this.sealingService.enhancedProviderRef;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Convert a TID to its byte representation.
|
|
59
|
+
*/
|
|
60
|
+
tidToBytes(id) {
|
|
61
|
+
return this.enhancedProvider.toBytes(id);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Convert bytes back to a TID.
|
|
65
|
+
*/
|
|
66
|
+
bytesToTid(bytes) {
|
|
67
|
+
return this.enhancedProvider.fromBytes(bytes);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Compute the expiration date for an identity recovery record
|
|
71
|
+
* based on the statute of limitations configuration.
|
|
72
|
+
*/
|
|
73
|
+
async computeExpiresAt(contentType, createdAt) {
|
|
74
|
+
const config = await this.statuteConfig();
|
|
75
|
+
let durationMs;
|
|
76
|
+
if (config) {
|
|
77
|
+
const typeDuration = config.defaultDurations.get(contentType);
|
|
78
|
+
durationMs = typeDuration ?? config.fallbackDurationMs;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// Default: 7 years in milliseconds
|
|
82
|
+
durationMs = 7 * 365.25 * 24 * 60 * 60 * 1000;
|
|
83
|
+
}
|
|
84
|
+
return new Date(createdAt.getTime() + durationMs);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Process content through the identity sealing pipeline.
|
|
88
|
+
*
|
|
89
|
+
* Steps:
|
|
90
|
+
* 1. Capture the real identity (creatorId) from the content
|
|
91
|
+
* 2. Convert identity to hex for Shamir splitting
|
|
92
|
+
* 3. Generate Shamir shards using current epoch threshold/members
|
|
93
|
+
* 4. Verify shards reconstruct correctly before distributing (Task 15.3)
|
|
94
|
+
* 5. Replace identity field based on mode (Task 15.4)
|
|
95
|
+
* 6. Encrypt each shard with the corresponding member's public key via ECIES
|
|
96
|
+
* 7. Store the IdentityRecoveryRecord
|
|
97
|
+
* 8. Attach recovery record ID to content
|
|
98
|
+
* 9. Wipe plaintext identity from memory
|
|
99
|
+
*
|
|
100
|
+
* @param content - The content with real identity to seal
|
|
101
|
+
* @param mode - The identity mode (real, alias, or anonymous)
|
|
102
|
+
* @param aliasName - Required when mode is Alias
|
|
103
|
+
* @returns The modified content and recovery record ID
|
|
104
|
+
* @throws QuorumError with IdentitySealingFailed if shard generation or distribution fails
|
|
105
|
+
* @throws QuorumError with ShardVerificationFailed if shard verification fails
|
|
106
|
+
*/
|
|
107
|
+
async sealIdentity(content, mode, aliasName) {
|
|
108
|
+
// 1. Capture the real identity
|
|
109
|
+
const realIdentityBytes = this.tidToBytes(content.creatorId);
|
|
110
|
+
// Make a copy so we can wipe the original reference later
|
|
111
|
+
const identityCopy = new Uint8Array(realIdentityBytes);
|
|
112
|
+
let plaintextShares = [];
|
|
113
|
+
try {
|
|
114
|
+
// 2. Convert identity bytes to hex for Shamir splitting
|
|
115
|
+
const identityHex = (0, ecies_lib_1.uint8ArrayToHex)(identityCopy);
|
|
116
|
+
// Get current epoch for threshold and member list
|
|
117
|
+
const epoch = await this.currentEpoch();
|
|
118
|
+
const memberCount = epoch.memberIds.length;
|
|
119
|
+
const threshold = epoch.threshold;
|
|
120
|
+
if (memberCount < 1) {
|
|
121
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.IdentitySealingFailed);
|
|
122
|
+
}
|
|
123
|
+
// 3. Generate Shamir shards via SealingService
|
|
124
|
+
try {
|
|
125
|
+
plaintextShares = this.sealingService.shamirSplit(identityHex, memberCount, threshold);
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
if (err instanceof quorumError_1.QuorumError)
|
|
129
|
+
throw err;
|
|
130
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.IdentitySealingFailed);
|
|
131
|
+
}
|
|
132
|
+
// 4. Verify shards reconstruct correctly before distributing (Task 15.3)
|
|
133
|
+
this.verifyShards(plaintextShares, threshold, identityHex, memberCount);
|
|
134
|
+
// 5. Replace identity field based on mode (Task 15.4)
|
|
135
|
+
const modifiedContent = this.replaceIdentity(content, mode, aliasName);
|
|
136
|
+
// 6. Encrypt each shard with the corresponding member's public key via ECIES
|
|
137
|
+
const encryptedShardsByMemberId = new Map();
|
|
138
|
+
const encoder = new TextEncoder();
|
|
139
|
+
for (let i = 0; i < memberCount; i++) {
|
|
140
|
+
const memberId = epoch.memberIds[i];
|
|
141
|
+
const memberRecord = await this.db.getMember(memberId);
|
|
142
|
+
if (!memberRecord) {
|
|
143
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.IdentitySealingFailed);
|
|
144
|
+
}
|
|
145
|
+
// Encode the share string as UTF-8 bytes for ECIES encryption
|
|
146
|
+
// (Shamir shares include a structured prefix and may have odd hex length)
|
|
147
|
+
const shareBytes = encoder.encode(plaintextShares[i]);
|
|
148
|
+
const encryptedShard = await this.eciesService.encryptWithLength(memberRecord.publicKey, shareBytes);
|
|
149
|
+
encryptedShardsByMemberId.set(memberId, encryptedShard);
|
|
150
|
+
}
|
|
151
|
+
// 7. Store the IdentityRecoveryRecord
|
|
152
|
+
const now = new Date();
|
|
153
|
+
const expiresAt = await this.computeExpiresAt(content.contentType, now);
|
|
154
|
+
const recordId = (0, ecies_lib_1.uint8ArrayToHex)(this.enhancedProvider.toBytes(this.enhancedProvider.generateTyped()));
|
|
155
|
+
const recoveryRecord = {
|
|
156
|
+
id: recordId,
|
|
157
|
+
contentId: content.contentId,
|
|
158
|
+
contentType: content.contentType,
|
|
159
|
+
encryptedShardsByMemberId,
|
|
160
|
+
memberIds: [...epoch.memberIds],
|
|
161
|
+
threshold,
|
|
162
|
+
epochNumber: epoch.epochNumber,
|
|
163
|
+
expiresAt,
|
|
164
|
+
createdAt: now,
|
|
165
|
+
identityMode: mode,
|
|
166
|
+
aliasName: mode === contentWithIdentity_1.IdentityMode.Alias ? aliasName : undefined,
|
|
167
|
+
};
|
|
168
|
+
await this.db.saveIdentityRecord(recoveryRecord);
|
|
169
|
+
// 8. Attach recovery record ID to content
|
|
170
|
+
modifiedContent.identityRecoveryRecordId = recordId;
|
|
171
|
+
return {
|
|
172
|
+
modifiedContent,
|
|
173
|
+
recoveryRecordId: recordId,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
if (error instanceof quorumError_1.QuorumError) {
|
|
178
|
+
throw error;
|
|
179
|
+
}
|
|
180
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.IdentitySealingFailed);
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
// 9. Wipe plaintext identity from memory
|
|
184
|
+
wipeBuffer(identityCopy);
|
|
185
|
+
for (let i = 0; i < plaintextShares.length; i++) {
|
|
186
|
+
plaintextShares[i] = '';
|
|
187
|
+
}
|
|
188
|
+
plaintextShares.length = 0;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Recover a sealed identity given sufficient decrypted shares.
|
|
193
|
+
*
|
|
194
|
+
* Retrieves the IdentityRecoveryRecord, validates share count,
|
|
195
|
+
* reconstructs the identity using Shamir's combine, and returns the TID.
|
|
196
|
+
*
|
|
197
|
+
* @param recoveryRecordId - The ID of the identity recovery record
|
|
198
|
+
* @param decryptedShares - Map of member ID to decrypted share hex string
|
|
199
|
+
* @returns The recovered real identity
|
|
200
|
+
* @throws QuorumError with InsufficientSharesForReconstruction if not enough shares
|
|
201
|
+
* @throws QuorumError with IdentityPermanentlyUnrecoverable if record not found
|
|
202
|
+
*/
|
|
203
|
+
async recoverIdentity(recoveryRecordId, decryptedShares) {
|
|
204
|
+
const record = await this.db.getIdentityRecord(recoveryRecordId);
|
|
205
|
+
if (!record) {
|
|
206
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.IdentityPermanentlyUnrecoverable);
|
|
207
|
+
}
|
|
208
|
+
if (decryptedShares.size < record.threshold) {
|
|
209
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.InsufficientSharesForReconstruction);
|
|
210
|
+
}
|
|
211
|
+
const shareValues = Array.from(decryptedShares.values());
|
|
212
|
+
let reconstructedHex;
|
|
213
|
+
try {
|
|
214
|
+
reconstructedHex = this.sealingService.shamirCombine(shareValues, record.memberIds.length);
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.InsufficientSharesForReconstruction);
|
|
218
|
+
}
|
|
219
|
+
try {
|
|
220
|
+
const identityBytes = (0, ecies_lib_1.hexToUint8Array)(reconstructedHex);
|
|
221
|
+
return this.bytesToTid(identityBytes);
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
// Wipe the reconstructed hex — best-effort for strings
|
|
225
|
+
reconstructedHex = '';
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Verify that Shamir shards correctly reconstruct the original identity
|
|
230
|
+
* before distributing them to members.
|
|
231
|
+
*
|
|
232
|
+
* Takes a subset of shares (threshold count) and verifies they
|
|
233
|
+
* reconstruct to the original identity hex.
|
|
234
|
+
*
|
|
235
|
+
* @param shares - The plaintext Shamir shares
|
|
236
|
+
* @param threshold - The number of shares needed to reconstruct
|
|
237
|
+
* @param originalHex - The original identity hex string
|
|
238
|
+
* @param totalShares - Total number of shares generated
|
|
239
|
+
* @throws QuorumError with ShardVerificationFailed if verification fails
|
|
240
|
+
*/
|
|
241
|
+
verifyShards(shares, threshold, originalHex, totalShares) {
|
|
242
|
+
const verificationSubset = shares.slice(0, threshold);
|
|
243
|
+
let reconstructed;
|
|
244
|
+
try {
|
|
245
|
+
reconstructed = this.sealingService.shamirCombine(verificationSubset, totalShares);
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.ShardVerificationFailed);
|
|
249
|
+
}
|
|
250
|
+
if (reconstructed !== originalHex) {
|
|
251
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.ShardVerificationFailed);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Replace the identity field on content based on the selected mode.
|
|
256
|
+
*
|
|
257
|
+
* - Real: keep creatorId as-is
|
|
258
|
+
* - Alias: replace creatorId with the alias name encoded as TID
|
|
259
|
+
* - Anonymous: replace creatorId with ANONYMOUS_ID (all-zeroes)
|
|
260
|
+
*
|
|
261
|
+
* Returns a shallow copy of the content with the identity replaced.
|
|
262
|
+
*/
|
|
263
|
+
replaceIdentity(content, mode, aliasName) {
|
|
264
|
+
const modified = { ...content };
|
|
265
|
+
switch (mode) {
|
|
266
|
+
case contentWithIdentity_1.IdentityMode.Real:
|
|
267
|
+
// Keep creatorId as-is
|
|
268
|
+
break;
|
|
269
|
+
case contentWithIdentity_1.IdentityMode.Alias: {
|
|
270
|
+
if (!aliasName) {
|
|
271
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.IdentitySealingFailed);
|
|
272
|
+
}
|
|
273
|
+
// Generate a deterministic alias ID using a fresh GUID.
|
|
274
|
+
// The actual alias-to-identity mapping is stored in the recovery record.
|
|
275
|
+
// In production, this would be the alias's registered public key ID.
|
|
276
|
+
modified.creatorId = this.enhancedProvider.generateTyped();
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
case contentWithIdentity_1.IdentityMode.Anonymous:
|
|
280
|
+
// Replace with all-zeroes Anonymous_ID
|
|
281
|
+
modified.creatorId = this.bytesToTid(new Uint8Array(exports.ANONYMOUS_ID));
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
return modified;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
exports.IdentitySealingPipeline = IdentitySealingPipeline;
|
|
288
|
+
//# sourceMappingURL=identitySealingPipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identitySealingPipeline.js","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/services/identitySealingPipeline.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,0DAOoC;AACpC,qEAAkE;AAClE,uDAAoD;AACpD,2EAG2C;AAW3C;;;GAGG;AACU,QAAA,YAAY,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AAE/C;;;GAGG;AACH,SAAS,UAAU,CAAC,MAAkB;IACpC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAa,uBAAuB;IAGlC,YACmB,EAAwB,EACxB,cAAmC,EACnC,YAA+B,EAC/B,YAA6C,EAC7C,aAA+D;QAJ/D,OAAE,GAAF,EAAE,CAAsB;QACxB,mBAAc,GAAd,cAAc,CAAqB;QACnC,iBAAY,GAA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CAAC,KAAK,CAAC,CAAC,CAAC;gBACxB,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,MAAM,IAAI,yBAAW,CAAC,iCAAe,CAAC,qBAAqB,CAAC,CAAC;gBAC/D,CAAC;gBACD,wDAAwD;gBACxD,yEAAyE;gBACzE,qEAAqE;gBACrE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,CAAC;gBAC3D,MAAM;YACR,CAAC;YAED,KAAK,kCAAY,CAAC,SAAS;gBACzB,uCAAuC;gBACvC,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,oBAAY,CAAC,CAAC,CAAC;gBACnE,MAAM;QACV,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AArTD,0DAqTC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview IdentityValidator — node-side identity validation on content ingestion.
|
|
3
|
+
*
|
|
4
|
+
* Validates content identity before acceptance into the block store:
|
|
5
|
+
* - Real identity: verifies signature matches public key, checks not banned/suspended
|
|
6
|
+
* - Alias identity: looks up alias, verifies active, verifies signature matches alias key, checks owner not banned
|
|
7
|
+
* - Anonymous identity: verifies Membership_Proof present and valid, content-bound
|
|
8
|
+
*
|
|
9
|
+
* @see Requirements 16
|
|
10
|
+
* @see Design: IdentityValidator (Section 8)
|
|
11
|
+
*/
|
|
12
|
+
import { ECIESService, PlatformID } from '@digitaldefiance/ecies-lib';
|
|
13
|
+
import { ContentWithIdentity } from '../interfaces/contentWithIdentity';
|
|
14
|
+
import { IIdentityValidator, IdentityValidationResult } from '../interfaces/services/identityValidator';
|
|
15
|
+
import { IMembershipProofService } from '../interfaces/services/membershipProof';
|
|
16
|
+
import { IQuorumDatabase } from '../interfaces/services/quorumDatabase';
|
|
17
|
+
/**
|
|
18
|
+
* IdentityValidator validates content identity before ingestion into the block store.
|
|
19
|
+
*
|
|
20
|
+
* Dispatches to one of three validation paths based on the creatorId:
|
|
21
|
+
* 1. Anonymous (all-zeroes GuidV4) → verify membership proof
|
|
22
|
+
* 2. Alias (linked via identityRecoveryRecordId) → verify alias active + signature + owner not banned
|
|
23
|
+
* 3. Real identity → verify signature + not banned/suspended
|
|
24
|
+
*
|
|
25
|
+
* @template TID - Platform ID type for frontend/backend DTO compatibility
|
|
26
|
+
*/
|
|
27
|
+
export declare class IdentityValidator<TID extends PlatformID = Uint8Array> implements IIdentityValidator<TID> {
|
|
28
|
+
private readonly db;
|
|
29
|
+
private readonly eciesService;
|
|
30
|
+
private readonly membershipProofService;
|
|
31
|
+
constructor(db: IQuorumDatabase<TID>, eciesService: ECIESService<TID>, membershipProofService: IMembershipProofService<TID>);
|
|
32
|
+
/**
|
|
33
|
+
* Validate content identity before ingestion.
|
|
34
|
+
*
|
|
35
|
+
* Detection logic:
|
|
36
|
+
* - creatorId is all-zeroes → Anonymous mode
|
|
37
|
+
* - identityRecoveryRecordId links to an alias record → Alias mode
|
|
38
|
+
* - Otherwise → Real identity mode
|
|
39
|
+
*/
|
|
40
|
+
validateContent(content: ContentWithIdentity<TID>): Promise<IdentityValidationResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Validate real identity content.
|
|
43
|
+
*
|
|
44
|
+
* 1. Look up member by creatorId
|
|
45
|
+
* 2. Check member is not banned or suspended
|
|
46
|
+
* 3. Verify content signature against member's public key
|
|
47
|
+
*/
|
|
48
|
+
private validateRealIdentity;
|
|
49
|
+
/**
|
|
50
|
+
* Validate alias identity content.
|
|
51
|
+
*
|
|
52
|
+
* 1. Look up alias by name
|
|
53
|
+
* 2. Verify alias is active
|
|
54
|
+
* 3. Verify content signature against alias public key
|
|
55
|
+
* 4. Check alias owner is not banned/suspended
|
|
56
|
+
*/
|
|
57
|
+
private validateAliasIdentity;
|
|
58
|
+
/**
|
|
59
|
+
* Validate anonymous identity content.
|
|
60
|
+
*
|
|
61
|
+
* 1. Verify membership proof is present
|
|
62
|
+
* 2. Verify membership proof is valid against current member set
|
|
63
|
+
* 3. Verify proof is content-bound (uses content hash)
|
|
64
|
+
*/
|
|
65
|
+
private validateAnonymous;
|
|
66
|
+
/**
|
|
67
|
+
* Check member status and throw if banned or suspended.
|
|
68
|
+
*/
|
|
69
|
+
private checkMemberStatus;
|
|
70
|
+
/**
|
|
71
|
+
* Convert a TID to Uint8Array bytes.
|
|
72
|
+
*/
|
|
73
|
+
private toBytes;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=identityValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identityValidator.d.ts","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/services/identityValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,YAAY,EACZ,UAAU,EAIX,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EACL,mBAAmB,EAEpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AA2BxE;;;;;;;;;GASG;AACH,qBAAa,iBAAiB,CAC5B,GAAG,SAAS,UAAU,GAAG,UAAU,CACnC,YAAW,kBAAkB,CAAC,GAAG,CAAC;IAEhC,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,sBAAsB;gBAFtB,EAAE,EAAE,eAAe,CAAC,GAAG,CAAC,EACxB,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,EAC/B,sBAAsB,EAAE,uBAAuB,CAAC,GAAG,CAAC;IAGvE;;;;;;;OAOG;IACG,eAAe,CACnB,OAAO,EAAE,mBAAmB,CAAC,GAAG,CAAC,GAChC,OAAO,CAAC,wBAAwB,CAAC;IA4BpC;;;;;;OAMG;YACW,oBAAoB;IAoClC;;;;;;;OAOG;YACW,qBAAqB;IA6CnC;;;;;;OAMG;YACW,iBAAiB;IAwC/B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAWzB;;OAEG;IACH,OAAO,CAAC,OAAO;CAWhB"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview IdentityValidator — node-side identity validation on content ingestion.
|
|
4
|
+
*
|
|
5
|
+
* Validates content identity before acceptance into the block store:
|
|
6
|
+
* - Real identity: verifies signature matches public key, checks not banned/suspended
|
|
7
|
+
* - Alias identity: looks up alias, verifies active, verifies signature matches alias key, checks owner not banned
|
|
8
|
+
* - Anonymous identity: verifies Membership_Proof present and valid, content-bound
|
|
9
|
+
*
|
|
10
|
+
* @see Requirements 16
|
|
11
|
+
* @see Design: IdentityValidator (Section 8)
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.IdentityValidator = void 0;
|
|
15
|
+
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
16
|
+
const sha3_1 = require("@noble/hashes/sha3");
|
|
17
|
+
const identityValidationErrorType_1 = require("../enumerations/identityValidationErrorType");
|
|
18
|
+
const memberStatusType_1 = require("../enumerations/memberStatusType");
|
|
19
|
+
const identityValidationError_1 = require("../errors/identityValidationError");
|
|
20
|
+
const contentWithIdentity_1 = require("../interfaces/contentWithIdentity");
|
|
21
|
+
const identitySealingPipeline_1 = require("./identitySealingPipeline");
|
|
22
|
+
/**
|
|
23
|
+
* Check if a Uint8Array matches the all-zeroes ANONYMOUS_ID.
|
|
24
|
+
*/
|
|
25
|
+
function isAnonymousId(id) {
|
|
26
|
+
if (id.length !== identitySealingPipeline_1.ANONYMOUS_ID.length)
|
|
27
|
+
return false;
|
|
28
|
+
for (let i = 0; i < identitySealingPipeline_1.ANONYMOUS_ID.length; i++) {
|
|
29
|
+
if (id[i] !== 0)
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Compute a 32-byte hash from content fields for signature/proof verification.
|
|
36
|
+
* Uses SHA3-512 truncated to 32 bytes, consistent with MembershipProofService.
|
|
37
|
+
*/
|
|
38
|
+
function computeContentDigest(content) {
|
|
39
|
+
const encoder = new TextEncoder();
|
|
40
|
+
const data = encoder.encode(`${content.contentId}:${content.contentType}`);
|
|
41
|
+
const fullHash = (0, sha3_1.sha3_512)(data);
|
|
42
|
+
return fullHash.slice(0, 32);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* IdentityValidator validates content identity before ingestion into the block store.
|
|
46
|
+
*
|
|
47
|
+
* Dispatches to one of three validation paths based on the creatorId:
|
|
48
|
+
* 1. Anonymous (all-zeroes GuidV4) → verify membership proof
|
|
49
|
+
* 2. Alias (linked via identityRecoveryRecordId) → verify alias active + signature + owner not banned
|
|
50
|
+
* 3. Real identity → verify signature + not banned/suspended
|
|
51
|
+
*
|
|
52
|
+
* @template TID - Platform ID type for frontend/backend DTO compatibility
|
|
53
|
+
*/
|
|
54
|
+
class IdentityValidator {
|
|
55
|
+
constructor(db, eciesService, membershipProofService) {
|
|
56
|
+
this.db = db;
|
|
57
|
+
this.eciesService = eciesService;
|
|
58
|
+
this.membershipProofService = membershipProofService;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Validate content identity before ingestion.
|
|
62
|
+
*
|
|
63
|
+
* Detection logic:
|
|
64
|
+
* - creatorId is all-zeroes → Anonymous mode
|
|
65
|
+
* - identityRecoveryRecordId links to an alias record → Alias mode
|
|
66
|
+
* - Otherwise → Real identity mode
|
|
67
|
+
*/
|
|
68
|
+
async validateContent(content) {
|
|
69
|
+
// Convert creatorId to bytes for anonymous check
|
|
70
|
+
const creatorIdBytes = this.toBytes(content.creatorId);
|
|
71
|
+
// 1. Check for anonymous identity (all-zeroes)
|
|
72
|
+
if (isAnonymousId(creatorIdBytes)) {
|
|
73
|
+
return this.validateAnonymous(content);
|
|
74
|
+
}
|
|
75
|
+
// 2. Determine identity mode from recovery record if present
|
|
76
|
+
if (content.identityRecoveryRecordId) {
|
|
77
|
+
const record = await this.db.getIdentityRecord(content.identityRecoveryRecordId);
|
|
78
|
+
if (record &&
|
|
79
|
+
record.identityMode === contentWithIdentity_1.IdentityMode.Alias &&
|
|
80
|
+
record.aliasName) {
|
|
81
|
+
return this.validateAliasIdentity(content, record.aliasName);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// 3. Default: real identity validation
|
|
85
|
+
const creatorHex = (0, ecies_lib_1.uint8ArrayToHex)(creatorIdBytes);
|
|
86
|
+
return this.validateRealIdentity(content, creatorHex);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Validate real identity content.
|
|
90
|
+
*
|
|
91
|
+
* 1. Look up member by creatorId
|
|
92
|
+
* 2. Check member is not banned or suspended
|
|
93
|
+
* 3. Verify content signature against member's public key
|
|
94
|
+
*/
|
|
95
|
+
async validateRealIdentity(content, memberId) {
|
|
96
|
+
const member = await this.db.getMember(memberId);
|
|
97
|
+
if (!member || !member.isActive) {
|
|
98
|
+
throw new identityValidationError_1.IdentityValidationError(identityValidationErrorType_1.IdentityValidationErrorType.InvalidSignature);
|
|
99
|
+
}
|
|
100
|
+
// Check banned/suspended status
|
|
101
|
+
this.checkMemberStatus(member.status);
|
|
102
|
+
// Verify signature against member's public key
|
|
103
|
+
const contentBytes = computeContentDigest(content);
|
|
104
|
+
const isValid = this.eciesService.verifyMessage(member.publicKey, contentBytes, content.signature);
|
|
105
|
+
if (!isValid) {
|
|
106
|
+
throw new identityValidationError_1.IdentityValidationError(identityValidationErrorType_1.IdentityValidationErrorType.InvalidSignature);
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
valid: true,
|
|
110
|
+
identityMode: contentWithIdentity_1.IdentityMode.Real,
|
|
111
|
+
resolvedMemberId: memberId,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Validate alias identity content.
|
|
116
|
+
*
|
|
117
|
+
* 1. Look up alias by name
|
|
118
|
+
* 2. Verify alias is active
|
|
119
|
+
* 3. Verify content signature against alias public key
|
|
120
|
+
* 4. Check alias owner is not banned/suspended
|
|
121
|
+
*/
|
|
122
|
+
async validateAliasIdentity(content, aliasName) {
|
|
123
|
+
const alias = await this.db.getAlias(aliasName);
|
|
124
|
+
if (!alias) {
|
|
125
|
+
throw new identityValidationError_1.IdentityValidationError(identityValidationErrorType_1.IdentityValidationErrorType.UnregisteredAlias);
|
|
126
|
+
}
|
|
127
|
+
if (!alias.isActive) {
|
|
128
|
+
throw new identityValidationError_1.IdentityValidationError(identityValidationErrorType_1.IdentityValidationErrorType.InactiveAlias);
|
|
129
|
+
}
|
|
130
|
+
// Verify signature against alias public key
|
|
131
|
+
const contentBytes = computeContentDigest(content);
|
|
132
|
+
const isValid = this.eciesService.verifyMessage(alias.aliasPublicKey, contentBytes, content.signature);
|
|
133
|
+
if (!isValid) {
|
|
134
|
+
throw new identityValidationError_1.IdentityValidationError(identityValidationErrorType_1.IdentityValidationErrorType.InvalidSignature);
|
|
135
|
+
}
|
|
136
|
+
// Check alias owner is not banned/suspended
|
|
137
|
+
const owner = await this.db.getMember(alias.ownerMemberId);
|
|
138
|
+
if (owner) {
|
|
139
|
+
this.checkMemberStatus(owner.status);
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
valid: true,
|
|
143
|
+
identityMode: contentWithIdentity_1.IdentityMode.Alias,
|
|
144
|
+
resolvedMemberId: alias.ownerMemberId,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Validate anonymous identity content.
|
|
149
|
+
*
|
|
150
|
+
* 1. Verify membership proof is present
|
|
151
|
+
* 2. Verify membership proof is valid against current member set
|
|
152
|
+
* 3. Verify proof is content-bound (uses content hash)
|
|
153
|
+
*/
|
|
154
|
+
async validateAnonymous(content) {
|
|
155
|
+
if (!content.membershipProof || content.membershipProof.length === 0) {
|
|
156
|
+
throw new identityValidationError_1.IdentityValidationError(identityValidationErrorType_1.IdentityValidationErrorType.MissingMembershipProof);
|
|
157
|
+
}
|
|
158
|
+
// Get all active member public keys for ring signature verification
|
|
159
|
+
const activeMembers = await this.db.listActiveMembers();
|
|
160
|
+
const memberPublicKeys = activeMembers.map((m) => m.publicKey);
|
|
161
|
+
if (memberPublicKeys.length === 0) {
|
|
162
|
+
throw new identityValidationError_1.IdentityValidationError(identityValidationErrorType_1.IdentityValidationErrorType.InvalidMembershipProof);
|
|
163
|
+
}
|
|
164
|
+
// Compute content hash for proof verification (content-binding)
|
|
165
|
+
const contentHash = computeContentDigest(content);
|
|
166
|
+
const isValid = await this.membershipProofService.verifyProof(content.membershipProof, memberPublicKeys, contentHash);
|
|
167
|
+
if (!isValid) {
|
|
168
|
+
throw new identityValidationError_1.IdentityValidationError(identityValidationErrorType_1.IdentityValidationErrorType.InvalidMembershipProof);
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
valid: true,
|
|
172
|
+
identityMode: contentWithIdentity_1.IdentityMode.Anonymous,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Check member status and throw if banned or suspended.
|
|
177
|
+
*/
|
|
178
|
+
checkMemberStatus(status) {
|
|
179
|
+
if (status === memberStatusType_1.MemberStatusType.Banned) {
|
|
180
|
+
throw new identityValidationError_1.IdentityValidationError(identityValidationErrorType_1.IdentityValidationErrorType.BannedUser);
|
|
181
|
+
}
|
|
182
|
+
if (status === memberStatusType_1.MemberStatusType.Suspended) {
|
|
183
|
+
throw new identityValidationError_1.IdentityValidationError(identityValidationErrorType_1.IdentityValidationErrorType.SuspendedUser);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Convert a TID to Uint8Array bytes.
|
|
188
|
+
*/
|
|
189
|
+
toBytes(id) {
|
|
190
|
+
if (id instanceof Uint8Array) {
|
|
191
|
+
return id;
|
|
192
|
+
}
|
|
193
|
+
// For string-based IDs, encode as UTF-8
|
|
194
|
+
if (typeof id === 'string') {
|
|
195
|
+
return new TextEncoder().encode(id);
|
|
196
|
+
}
|
|
197
|
+
// For other types, try to get bytes from the object
|
|
198
|
+
return new Uint8Array(Buffer.from(String(id)));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.IdentityValidator = IdentityValidator;
|
|
202
|
+
//# sourceMappingURL=identityValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identityValidator.js","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/services/identityValidator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,0DAMoC;AACpC,6CAA8C;AAC9C,6FAA0F;AAC1F,uEAAoE;AACpE,+EAA4E;AAC5E,2EAG2C;AAO3C,uEAAyD;AAEzD;;GAEG;AACH,SAAS,aAAa,CAAC,EAAc;IACnC,IAAI,EAAE,CAAC,MAAM,KAAK,sCAAY,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,sCAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;IAChC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,SAAS,oBAAoB,CAC3B,OAAwC;IAExC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3E,MAAM,QAAQ,GAAG,IAAA,eAAQ,EAAC,IAAI,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AAW,CAC3D,OAAO,CAAC,eAAe,EACvB,gBAAgB,EAChB,WAAW,CACZ,CAAC;QAEF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,iDAAuB,CAC/B,yDAA2B,CAAC,sBAAsB,CACnD,CAAC;QACJ,CAAC;QAED,OAAO;YACL,KAAK,EAAE,IAAI;YACX,YAAY,EAAE,kCAAY,CAAC,SAAS;SACrC,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,iBAAiB,CAAC,MAAyB;QACjD,IAAI,MAAM,KAAK,mCAAgB,CAAC,MAAM,EAAE,CAAC;YACvC,MAAM,IAAI,iDAAuB,CAAC,yDAA2B,CAAC,UAAU,CAAC,CAAC;QAC5E,CAAC;QACD,IAAI,MAAM,KAAK,mCAAgB,CAAC,SAAS,EAAE,CAAC;YAC1C,MAAM,IAAI,iDAAuB,CAC/B,yDAA2B,CAAC,aAAa,CAC1C,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACK,OAAO,CAAC,EAAO;QACrB,IAAI,EAAE,YAAY,UAAU,EAAE,CAAC;YAC7B,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,wCAAwC;QACxC,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;YAC3B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACtC,CAAC;QACD,oDAAoD;QACpD,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;CACF;AA1ND,8CA0NC"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
export * from './aliasRegistry';
|
|
2
|
+
export * from './auditLogService';
|
|
1
3
|
export * from './blockCapacity.service';
|
|
2
4
|
export * from './blockService';
|
|
3
5
|
export * from './cblService';
|
|
4
6
|
export * from './checksum.service';
|
|
5
7
|
export * from './crypto';
|
|
6
8
|
export * from './fec.service';
|
|
9
|
+
export * from './identitySealingPipeline';
|
|
10
|
+
export * from './identityValidator';
|
|
7
11
|
export * from './member';
|
|
12
|
+
export * from './membershipProofService';
|
|
8
13
|
export * from './memberStore';
|
|
9
14
|
export * from './messaging';
|
|
10
15
|
export * from './quorumService';
|
|
16
|
+
export * from './quorumStateMachine';
|
|
11
17
|
export * from './sealing.service';
|
|
12
18
|
export * from './service.provider';
|
|
13
19
|
export * from './serviceLocator';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AAGtB,cAAc,cAAc,CAAC;AAG7B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AAGtB,cAAc,cAAc,CAAC;AAG7B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,YAAY,CAAC"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./aliasRegistry"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./auditLogService"), exports);
|
|
4
6
|
tslib_1.__exportStar(require("./blockCapacity.service"), exports);
|
|
5
7
|
tslib_1.__exportStar(require("./blockService"), exports);
|
|
6
8
|
tslib_1.__exportStar(require("./cblService"), exports);
|
|
7
9
|
tslib_1.__exportStar(require("./checksum.service"), exports);
|
|
8
10
|
tslib_1.__exportStar(require("./crypto"), exports);
|
|
9
11
|
tslib_1.__exportStar(require("./fec.service"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./identitySealingPipeline"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./identityValidator"), exports);
|
|
10
14
|
tslib_1.__exportStar(require("./member"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./membershipProofService"), exports);
|
|
11
16
|
tslib_1.__exportStar(require("./memberStore"), exports);
|
|
12
17
|
tslib_1.__exportStar(require("./messaging"), exports);
|
|
13
18
|
tslib_1.__exportStar(require("./quorumService"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./quorumStateMachine"), exports);
|
|
14
20
|
tslib_1.__exportStar(require("./sealing.service"), exports);
|
|
15
21
|
tslib_1.__exportStar(require("./service.provider"), exports);
|
|
16
22
|
tslib_1.__exportStar(require("./serviceLocator"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/services/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC;AACxC,yDAA+B;AAC/B,uDAA6B;AAC7B,6DAAmC;AACnC,mDAAyB;AACzB,wDAA8B;AAC9B,mDAAyB;AACzB,wDAA8B;AAC9B,sDAA4B;AAC5B,0DAAgC;AAChC,4DAAkC;AAClC,6DAAmC;AACnC,2DAAiC;AACjC,8DAAoC;AACpC,0DAAgC;AAChC,gEAAsC;AACtC,wDAA8B;AAC9B,gDAAsB;AAEtB,4CAA4C;AAC5C,uDAA6B;AAE7B,8DAA8D;AAC9D,0DAAgC;AAEhC,6DAA6D;AAC7D,qDAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/services/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,4DAAkC;AAClC,kEAAwC;AACxC,yDAA+B;AAC/B,uDAA6B;AAC7B,6DAAmC;AACnC,mDAAyB;AACzB,wDAA8B;AAC9B,oEAA0C;AAC1C,8DAAoC;AACpC,mDAAyB;AACzB,mEAAyC;AACzC,wDAA8B;AAC9B,sDAA4B;AAC5B,0DAAgC;AAChC,+DAAqC;AACrC,4DAAkC;AAClC,6DAAmC;AACnC,2DAAiC;AACjC,8DAAoC;AACpC,0DAAgC;AAChC,gEAAsC;AACtC,wDAA8B;AAC9B,gDAAsB;AAEtB,4CAA4C;AAC5C,uDAA6B;AAE7B,8DAA8D;AAC9D,0DAAgC;AAEhC,6DAA6D;AAC7D,qDAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memberCblService.d.ts","sourceRoot":"","sources":["../../../../../../brightchain-lib/src/lib/services/member/memberCblService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAa7D,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"memberCblService.d.ts","sourceRoot":"","sources":["../../../../../../brightchain-lib/src/lib/services/member/memberCblService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAa7D,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAgBlE;;GAEG;AACH,qBAAa,gBAAgB,CAAC,GAAG,SAAS,UAAU,GAAG,UAAU;IAC/D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAc;gBAE7B,UAAU,EAAE,WAAW;IAInC;;OAEG;IACU,eAAe,CAC1B,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,EACnB,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,GACnB,OAAO,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC;IAmN1C;;;;;;;;OAQG;IACU,aAAa,CACxB,GAAG,EAAE,yBAAyB,CAAC,GAAG,CAAC,GAClC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IA0IvB;;OAEG;IACI,aAAa,IAAI,WAAW;CAGpC"}
|