@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,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared user management interfaces — used by both frontend and backend.
|
|
3
|
+
*
|
|
4
|
+
* TId is the ID type: `string` for frontend / REST responses,
|
|
5
|
+
* `Uint8Array` for backend internals.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Password change request body.
|
|
9
|
+
*/
|
|
10
|
+
export interface IPasswordChangeRequest {
|
|
11
|
+
currentPassword: string;
|
|
12
|
+
newPassword: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Password change response data.
|
|
16
|
+
*/
|
|
17
|
+
export interface IPasswordChangeResponse<TId = string> {
|
|
18
|
+
memberId: TId;
|
|
19
|
+
success: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Mnemonic-based account recovery request body.
|
|
23
|
+
*/
|
|
24
|
+
export interface IRecoveryRequest {
|
|
25
|
+
email: string;
|
|
26
|
+
mnemonic: string;
|
|
27
|
+
newPassword?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Mnemonic-based account recovery response data.
|
|
31
|
+
*/
|
|
32
|
+
export interface IRecoveryResponse<TId = string> {
|
|
33
|
+
token: string;
|
|
34
|
+
memberId: TId;
|
|
35
|
+
passwordReset: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A single stored backup code entry.
|
|
39
|
+
* The plaintext code is never persisted — only its bcrypt hash.
|
|
40
|
+
*/
|
|
41
|
+
export interface IStoredBackupCode {
|
|
42
|
+
/** bcrypt hash of the plaintext code */
|
|
43
|
+
hash: string;
|
|
44
|
+
/** true once the code has been consumed */
|
|
45
|
+
used: boolean;
|
|
46
|
+
/** epoch ms when the code was generated */
|
|
47
|
+
createdAt: number;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=userManagement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userManagement.d.ts","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/interfaces/userManagement.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB,CAAC,GAAG,GAAG,MAAM;IACnD,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,GAAG,GAAG,MAAM;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,GAAG,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,EAAE,OAAO,CAAC;IACd,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared user management interfaces — used by both frontend and backend.
|
|
4
|
+
*
|
|
5
|
+
* TId is the ID type: `string` for frontend / REST responses,
|
|
6
|
+
* `Uint8Array` for backend internals.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
//# sourceMappingURL=userManagement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userManagement.js","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/interfaces/userManagement.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Vote and VoteInput interfaces.
|
|
3
|
+
*
|
|
4
|
+
* Defines the structure of quorum votes and their input format.
|
|
5
|
+
*
|
|
6
|
+
* @see Requirements 6, 7
|
|
7
|
+
*/
|
|
8
|
+
import { PlatformID, ShortHexGuid } from '@digitaldefiance/ecies-lib';
|
|
9
|
+
/**
|
|
10
|
+
* A quorum member's response to a Proposal.
|
|
11
|
+
* @template TID - Platform ID type for frontend/backend DTO compatibility
|
|
12
|
+
*/
|
|
13
|
+
export interface Vote<TID extends PlatformID = Uint8Array> {
|
|
14
|
+
/** ID of the proposal being voted on */
|
|
15
|
+
proposalId: ShortHexGuid;
|
|
16
|
+
/** ID of the voting member */
|
|
17
|
+
voterMemberId: ShortHexGuid;
|
|
18
|
+
/** Vote decision */
|
|
19
|
+
decision: 'approve' | 'reject';
|
|
20
|
+
/** Optional comment, max 1024 characters */
|
|
21
|
+
comment?: string;
|
|
22
|
+
/** ECIES-encrypted share to proposer's public key, present only on approve */
|
|
23
|
+
encryptedShare?: Uint8Array;
|
|
24
|
+
/** Timestamp of vote creation */
|
|
25
|
+
createdAt: Date;
|
|
26
|
+
/** Generic marker for DTO compatibility */
|
|
27
|
+
_platformId?: TID;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Input format for submitting a vote.
|
|
31
|
+
* @template TID - Platform ID type for frontend/backend DTO compatibility
|
|
32
|
+
*/
|
|
33
|
+
export interface VoteInput<TID extends PlatformID = Uint8Array> {
|
|
34
|
+
/** ID of the proposal being voted on */
|
|
35
|
+
proposalId: ShortHexGuid;
|
|
36
|
+
/** ID of the voting member (optional — defaults to local node member) */
|
|
37
|
+
voterMemberId?: ShortHexGuid;
|
|
38
|
+
/** Vote decision */
|
|
39
|
+
decision: 'approve' | 'reject';
|
|
40
|
+
/** Optional comment */
|
|
41
|
+
comment?: string;
|
|
42
|
+
/** Generic marker for DTO compatibility */
|
|
43
|
+
_platformId?: TID;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=vote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vote.d.ts","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/interfaces/vote.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAEtE;;;GAGG;AACH,MAAM,WAAW,IAAI,CAAC,GAAG,SAAS,UAAU,GAAG,UAAU;IACvD,wCAAwC;IACxC,UAAU,EAAE,YAAY,CAAC;IACzB,8BAA8B;IAC9B,aAAa,EAAE,YAAY,CAAC;IAC5B,oBAAoB;IACpB,QAAQ,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,iCAAiC;IACjC,SAAS,EAAE,IAAI,CAAC;IAChB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,GAAG,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS,CAAC,GAAG,SAAS,UAAU,GAAG,UAAU;IAC5D,wCAAwC;IACxC,UAAU,EAAE,YAAY,CAAC;IACzB,yEAAyE;IACzE,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,oBAAoB;IACpB,QAAQ,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B,uBAAuB;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,GAAG,CAAC;CACnB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Vote and VoteInput interfaces.
|
|
4
|
+
*
|
|
5
|
+
* Defines the structure of quorum votes and their input format.
|
|
6
|
+
*
|
|
7
|
+
* @see Requirements 6, 7
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=vote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vote.js","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/interfaces/vote.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
|
|
@@ -19,7 +19,13 @@ export declare class QuorumDataRecord<TID extends PlatformID = Uint8Array> {
|
|
|
19
19
|
readonly sharesRequired: number;
|
|
20
20
|
readonly dateCreated: Date;
|
|
21
21
|
readonly dateUpdated: Date;
|
|
22
|
-
|
|
22
|
+
/** Epoch number at sealing time */
|
|
23
|
+
readonly epochNumber: number;
|
|
24
|
+
/** True if the document was sealed in bootstrap mode */
|
|
25
|
+
readonly sealedUnderBootstrap: boolean;
|
|
26
|
+
/** Link to identity recovery record if applicable */
|
|
27
|
+
readonly identityRecoveryRecordId?: ShortHexGuid;
|
|
28
|
+
constructor(creator: Member<TID>, memberIDs: TID[], sharesRequired: number, encryptedData: Uint8Array, encryptedSharesByMemberId: Map<ShortHexGuid, Uint8Array>, enhancedProvider: TypedIdProviderWrapper<TID>, checksum?: Checksum, signature?: SignatureUint8Array, id?: TID, dateCreated?: Date, dateUpdated?: Date, eciesService?: ECIESService<TID>, bootstrapMode?: boolean, epochNumber?: number, sealedUnderBootstrap?: boolean, identityRecoveryRecordId?: ShortHexGuid);
|
|
23
29
|
toDto(): QuorumDataRecordDto;
|
|
24
30
|
static fromDto<TID extends PlatformID = Uint8Array>(dto: QuorumDataRecordDto, fetchMember: (memberId: TID) => Member<TID>, enhancedProvider?: TypedIdProviderWrapper<TID>, eciesService?: ECIESService<TID>): QuorumDataRecord<TID>;
|
|
25
31
|
toJson(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quorumDataRecord.d.ts","sourceRoot":"","sources":["../../../../brightchain-lib/src/lib/quorumDataRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAGZ,MAAM,EACN,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,sBAAsB,EAEvB,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,qBAAa,gBAAgB,CAAC,GAAG,SAAS,UAAU,GAAG,UAAU;IAC/D,SAAgB,eAAe,EAAE,eAAe,CAAyB;IACzE,SAAgB,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,CAA6B;IAC5E,SAAgB,gBAAgB,EAAE,sBAAsB,CAAC,GAAG,CAAC,CAAC;IAE9D,SAAgB,EAAE,EAAE,GAAG,CAAC;IACxB,SAAgB,aAAa,EAAE,UAAU,CAAC;IAC1C,SAAgB,yBAAyB,EAAE,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACzE;;OAEG;IACH,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IACnC,SAAgB,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IACrC,SAAgB,SAAS,EAAE,mBAAmB,CAAC;IAC/C,SAAgB,SAAS,EAAE,GAAG,EAAE,CAAC;IACjC,SAAgB,cAAc,EAAE,MAAM,CAAC;IACvC,SAAgB,WAAW,EAAE,IAAI,CAAC;IAClC,SAAgB,WAAW,EAAE,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"quorumDataRecord.d.ts","sourceRoot":"","sources":["../../../../brightchain-lib/src/lib/quorumDataRec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,aAAa,EAAE,UAAU,EACzB,yBAAyB,EAAE,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,EACxD,gBAAgB,EAAE,sBAAsB,CAAC,GAAG,CAAC,EAC7C,QAAQ,CAAC,EAAE,QAAQ,EACnB,SAAS,CAAC,EAAE,mBAAmB,EAC/B,EAAE,CAAC,EAAE,GAAG,EACR,WAAW,CAAC,EAAE,IAAI,EAClB,WAAW,CAAC,EAAE,IAAI,EAClB,YAAY,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,EAChC,aAAa,CAAC,EAAE,OAAO,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,oBAAoB,CAAC,EAAE,OAAO,EAC9B,wBAAwB,CAAC,EAAE,YAAY;IAsElC,KAAK,IAAI,mBAAmB;WA8BrB,OAAO,CAAC,GAAG,SAAS,UAAU,GAAG,UAAU,EACvD,GAAG,EAAE,mBAAmB,EACxB,WAAW,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,EAC3C,gBAAgB,CAAC,EAAE,sBAAsB,CAAC,GAAG,CAAC,EAC9C,YAAY,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,GAC/B,gBAAgB,CAAC,GAAG,CAAC;IAoCjB,MAAM,IAAI,MAAM;WAGT,QAAQ,CAAC,GAAG,SAAS,UAAU,GAAG,UAAU,EACxD,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,EAC3C,gBAAgB,CAAC,EAAE,sBAAsB,CAAC,GAAG,CAAC,EAC9C,YAAY,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,GAC/B,gBAAgB,CAAC,GAAG,CAAC;CASzB"}
|
|
@@ -8,7 +8,7 @@ const translatableBrightChainError_1 = require("./errors/translatableBrightChain
|
|
|
8
8
|
const init_1 = require("./init");
|
|
9
9
|
const checksum_service_1 = require("./services/checksum.service");
|
|
10
10
|
class QuorumDataRecord {
|
|
11
|
-
constructor(creator, memberIDs, sharesRequired, encryptedData, encryptedSharesByMemberId, enhancedProvider, checksum, signature, id, dateCreated, dateUpdated, eciesService) {
|
|
11
|
+
constructor(creator, memberIDs, sharesRequired, encryptedData, encryptedSharesByMemberId, enhancedProvider, checksum, signature, id, dateCreated, dateUpdated, eciesService, bootstrapMode, epochNumber, sealedUnderBootstrap, identityRecoveryRecordId) {
|
|
12
12
|
this.checksumService = new checksum_service_1.ChecksumService();
|
|
13
13
|
this.eciesService = (0, browserConfig_1.createECIESService)();
|
|
14
14
|
this.enhancedProvider = enhancedProvider;
|
|
@@ -19,14 +19,14 @@ class QuorumDataRecord {
|
|
|
19
19
|
else {
|
|
20
20
|
this.id = this.enhancedProvider.generateTyped();
|
|
21
21
|
}
|
|
22
|
-
if (memberIDs.length != 0 && memberIDs.length < 2) {
|
|
22
|
+
if (!bootstrapMode && memberIDs.length != 0 && memberIDs.length < 2) {
|
|
23
23
|
throw new translatableBrightChainError_1.TranslatableBrightChainError(enumerations_1.BrightChainStrings.QuorumDataRecord_MustShareWithAtLeastTwoMembers);
|
|
24
24
|
}
|
|
25
25
|
this.memberIDs = memberIDs;
|
|
26
26
|
if (sharesRequired != -1 && sharesRequired > memberIDs.length) {
|
|
27
27
|
throw new translatableBrightChainError_1.TranslatableBrightChainError(enumerations_1.BrightChainStrings.QuorumDataRecord_SharesRequiredExceedsMembers);
|
|
28
28
|
}
|
|
29
|
-
if (sharesRequired != -1 && sharesRequired < 2) {
|
|
29
|
+
if (!bootstrapMode && sharesRequired != -1 && sharesRequired < 2) {
|
|
30
30
|
throw new translatableBrightChainError_1.TranslatableBrightChainError(enumerations_1.BrightChainStrings.QuorumDataRecord_SharesRequiredMustBeAtLeastTwo);
|
|
31
31
|
}
|
|
32
32
|
this.checksumService = new checksum_service_1.ChecksumService();
|
|
@@ -55,6 +55,10 @@ class QuorumDataRecord {
|
|
|
55
55
|
};
|
|
56
56
|
this.dateCreated = dateCreated ?? now();
|
|
57
57
|
this.dateUpdated = dateUpdated ?? now();
|
|
58
|
+
// Metadata fields
|
|
59
|
+
this.epochNumber = epochNumber ?? 0;
|
|
60
|
+
this.sealedUnderBootstrap = sealedUnderBootstrap ?? bootstrapMode ?? false;
|
|
61
|
+
this.identityRecoveryRecordId = identityRecoveryRecordId;
|
|
58
62
|
}
|
|
59
63
|
toDto() {
|
|
60
64
|
const encryptedSharesByMemberId = {};
|
|
@@ -72,6 +76,9 @@ class QuorumDataRecord {
|
|
|
72
76
|
sharesRequired: this.sharesRequired,
|
|
73
77
|
dateCreated: this.dateCreated,
|
|
74
78
|
dateUpdated: this.dateUpdated,
|
|
79
|
+
epochNumber: this.epochNumber,
|
|
80
|
+
sealedUnderBootstrap: this.sealedUnderBootstrap,
|
|
81
|
+
identityRecoveryRecordId: this.identityRecoveryRecordId,
|
|
75
82
|
};
|
|
76
83
|
}
|
|
77
84
|
static fromDto(dto, fetchMember, enhancedProvider, eciesService) {
|
|
@@ -82,7 +89,8 @@ class QuorumDataRecord {
|
|
|
82
89
|
Object.keys(dto.encryptedSharesByMemberId).forEach((k) => {
|
|
83
90
|
encryptedSharesByMemberId.set(k, (0, ecies_lib_1.hexToUint8Array)(dto.encryptedSharesByMemberId[k]));
|
|
84
91
|
});
|
|
85
|
-
return new QuorumDataRecord(fetchMember(enhancedProviderToUse.fromBytes((0, ecies_lib_1.hexToUint8Array)(dto.creatorId))), dto.memberIDs.map((id) => enhancedProviderToUse.fromBytes((0, ecies_lib_1.hexToUint8Array)(id))), dto.sharesRequired, (0, ecies_lib_1.hexToUint8Array)(dto.encryptedData), encryptedSharesByMemberId, enhancedProviderToUse, checksumService.hexStringToChecksum(dto.checksum), eciesServiceToUse.signatureStringToSignatureBuffer(dto.signature), enhancedProviderToUse.fromBytes((0, ecies_lib_1.hexToUint8Array)(dto.id)), dto.dateCreated, dto.dateUpdated, eciesServiceToUse
|
|
92
|
+
return new QuorumDataRecord(fetchMember(enhancedProviderToUse.fromBytes((0, ecies_lib_1.hexToUint8Array)(dto.creatorId))), dto.memberIDs.map((id) => enhancedProviderToUse.fromBytes((0, ecies_lib_1.hexToUint8Array)(id))), dto.sharesRequired, (0, ecies_lib_1.hexToUint8Array)(dto.encryptedData), encryptedSharesByMemberId, enhancedProviderToUse, checksumService.hexStringToChecksum(dto.checksum), eciesServiceToUse.signatureStringToSignatureBuffer(dto.signature), enhancedProviderToUse.fromBytes((0, ecies_lib_1.hexToUint8Array)(dto.id)), dto.dateCreated, dto.dateUpdated, eciesServiceToUse, dto.sealedUnderBootstrap, // bootstrapMode - use sealedUnderBootstrap to relax constraints on deserialization
|
|
93
|
+
dto.epochNumber, dto.sealedUnderBootstrap, dto.identityRecoveryRecordId);
|
|
86
94
|
}
|
|
87
95
|
toJson() {
|
|
88
96
|
return JSON.stringify(this.toDto());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quorumDataRecord.js","sourceRoot":"","sources":["../../../../brightchain-lib/src/lib/quorumDataRecord.ts"],"names":[],"mappings":";;;AAAA,0DAWoC;AACpC,mDAAqD;AACrD,iDAAoD;AACpD,wFAAqF;AACrF,iCAAkD;AAElD,kEAA8D;AAG9D,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"quorumDataRecord.js","sourceRoot":"","sources":["../../../../brightchain-lib/src/lib/quorumDataRecord.ts"],"names":[],"mappings":";;;AAAA,0DAWoC;AACpC,mDAAqD;AACrD,iDAAoD;AACpD,wFAAqF;AACrF,iCAAkD;AAElD,kEAA8D;AAG9D,MAAa,gBAAgB;IAyB3B,YACE,OAAoB,EACpB,SAAgB,EAChB,cAAsB,EACtB,aAAyB,EACzB,yBAAwD,EACxD,gBAA6C,EAC7C,QAAmB,EACnB,SAA+B,EAC/B,EAAQ,EACR,WAAkB,EAClB,WAAkB,EAClB,YAAgC,EAChC,aAAuB,EACvB,WAAoB,EACpB,oBAA8B,EAC9B,wBAAuC;QAxCzB,oBAAe,GAAoB,IAAI,kCAAe,EAAE,CAAC;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AAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAwB,CAAC;QACpD,OAAO,gBAAgB,CAAC,OAAO,CAC7B,GAAG,EACH,WAAW,EACX,gBAAgB,EAChB,YAAY,CACb,CAAC;IACJ,CAAC;CACF;AAvMD,4CAuMC"}
|
|
@@ -15,5 +15,11 @@ export interface QuorumDataRecordDto {
|
|
|
15
15
|
sharesRequired: number;
|
|
16
16
|
dateCreated: Date;
|
|
17
17
|
dateUpdated: Date;
|
|
18
|
+
/** Epoch number at sealing time */
|
|
19
|
+
epochNumber: number;
|
|
20
|
+
/** True if the document was sealed in bootstrap mode */
|
|
21
|
+
sealedUnderBootstrap: boolean;
|
|
22
|
+
/** Link to identity recovery record if applicable */
|
|
23
|
+
identityRecoveryRecordId?: ShortHexGuid;
|
|
18
24
|
}
|
|
19
25
|
//# sourceMappingURL=quorumDataRecordDto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quorumDataRecordDto.d.ts","sourceRoot":"","sources":["../../../../brightchain-lib/src/lib/quorumDataRecordDto.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,YAAY,EACZ,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,YAAY,CAAC;IACjB,SAAS,EAAE,YAAY,CAAC;IACxB,aAAa,EAAE,SAAS,CAAC;IACzB,yBAAyB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IACxD;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,EAAE,eAAe,CAAC;IAC3B,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,IAAI,CAAC;IAClB,WAAW,EAAE,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"quorumDataRecordDto.d.ts","sourceRoot":"","sources":["../../../../brightchain-lib/src/lib/quorumDataRecordDto.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,YAAY,EACZ,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,YAAY,CAAC;IACjB,SAAS,EAAE,YAAY,CAAC;IACxB,aAAa,EAAE,SAAS,CAAC;IACzB,yBAAyB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IACxD;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,EAAE,eAAe,CAAC;IAC3B,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,IAAI,CAAC;IAClB,WAAW,EAAE,IAAI,CAAC;IAClB,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,oBAAoB,EAAE,OAAO,CAAC;IAC9B,qDAAqD;IACrD,wBAAwB,CAAC,EAAE,YAAY,CAAC;CACzC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview AliasRegistry — manages pseudonymous alias registration,
|
|
3
|
+
* deregistration, and lookup.
|
|
4
|
+
*
|
|
5
|
+
* Aliases map back to a member's real identity through the quorum.
|
|
6
|
+
* The alias-to-identity mapping is sealed via IdentitySealingPipeline.
|
|
7
|
+
*
|
|
8
|
+
* @see Requirements 15
|
|
9
|
+
* @see Design: AliasRegistry (Section 5)
|
|
10
|
+
*/
|
|
11
|
+
import { ECIESService, PlatformID, ShortHexGuid } from '@digitaldefiance/ecies-lib';
|
|
12
|
+
import { AliasRecord } from '../interfaces/aliasRecord';
|
|
13
|
+
import { QuorumEpoch } from '../interfaces/quorumEpoch';
|
|
14
|
+
import { IQuorumDatabase } from '../interfaces/services/quorumDatabase';
|
|
15
|
+
import { IdentitySealingPipeline } from './identitySealingPipeline';
|
|
16
|
+
/**
|
|
17
|
+
* AliasRegistry manages pseudonymous alias registration, deregistration,
|
|
18
|
+
* and identity lookup for the quorum system.
|
|
19
|
+
*
|
|
20
|
+
* - Registration validates uniqueness, generates an alias keypair,
|
|
21
|
+
* seals the alias-to-identity mapping via IdentitySealingPipeline,
|
|
22
|
+
* and stores the AliasRecord.
|
|
23
|
+
* - Deregistration marks an alias as inactive.
|
|
24
|
+
* - Lookup recovers the real identity behind an alias given sufficient
|
|
25
|
+
* quorum shares.
|
|
26
|
+
*
|
|
27
|
+
* @template TID - Platform ID type for frontend/backend DTO compatibility
|
|
28
|
+
*/
|
|
29
|
+
export declare class AliasRegistry<TID extends PlatformID = Uint8Array> {
|
|
30
|
+
private readonly db;
|
|
31
|
+
private readonly identitySealingPipeline;
|
|
32
|
+
private readonly eciesService;
|
|
33
|
+
private readonly currentEpoch;
|
|
34
|
+
constructor(db: IQuorumDatabase<TID>, identitySealingPipeline: IdentitySealingPipeline<TID>, eciesService: ECIESService<TID>, currentEpoch: () => Promise<QuorumEpoch<TID>>);
|
|
35
|
+
/**
|
|
36
|
+
* Register a new alias for a quorum member.
|
|
37
|
+
*
|
|
38
|
+
* Steps:
|
|
39
|
+
* 1. Validate alias uniqueness via db.isAliasAvailable
|
|
40
|
+
* 2. Generate a new keypair for the alias using eciesService
|
|
41
|
+
* 3. Seal the alias-to-identity mapping via IdentitySealingPipeline
|
|
42
|
+
* (creates a ContentWithIdentity with the owner's real ID, sealed in Alias mode)
|
|
43
|
+
* 4. Store the AliasRecord with the recovery record ID
|
|
44
|
+
*
|
|
45
|
+
* @param aliasName - The unique pseudonym to register
|
|
46
|
+
* @param ownerMemberId - The real member ID of the alias owner
|
|
47
|
+
* @param ownerPublicKey - The owner's public key (used as creatorId for sealing)
|
|
48
|
+
* @returns The created AliasRecord
|
|
49
|
+
* @throws QuorumError with AliasAlreadyTaken if alias name is not available
|
|
50
|
+
* @throws QuorumError with IdentitySealingFailed if sealing fails
|
|
51
|
+
*/
|
|
52
|
+
registerAlias(aliasName: string, ownerMemberId: ShortHexGuid, ownerPublicKey: Uint8Array): Promise<AliasRecord<TID>>;
|
|
53
|
+
/**
|
|
54
|
+
* Deregister an alias by marking it as inactive.
|
|
55
|
+
*
|
|
56
|
+
* After deregistration, the alias cannot be used for further content publication.
|
|
57
|
+
*
|
|
58
|
+
* @param aliasName - The alias name to deregister
|
|
59
|
+
* @throws QuorumError with AliasNotFound if alias does not exist
|
|
60
|
+
* @throws QuorumError with AliasInactive if alias is already inactive
|
|
61
|
+
*/
|
|
62
|
+
deregisterAlias(aliasName: string): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Look up the real identity behind an alias given sufficient quorum shares.
|
|
65
|
+
*
|
|
66
|
+
* Uses the alias's identityRecoveryRecordId to recover the real identity
|
|
67
|
+
* via IdentitySealingPipeline.recoverIdentity().
|
|
68
|
+
*
|
|
69
|
+
* @param aliasName - The alias name to look up
|
|
70
|
+
* @param decryptedShares - Map of member ID to decrypted share string
|
|
71
|
+
* @returns The recovered real identity
|
|
72
|
+
* @throws QuorumError with AliasNotFound if alias does not exist
|
|
73
|
+
* @throws QuorumError with InsufficientSharesForReconstruction if not enough shares
|
|
74
|
+
*/
|
|
75
|
+
lookupAlias(aliasName: string, decryptedShares: Map<ShortHexGuid, string>): Promise<TID>;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=aliasRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aliasRegistry.d.ts","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/services/aliasRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,YAAY,EACZ,UAAU,EACV,YAAY,EAEb,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAa,CAAC,GAAG,SAAS,UAAU,GAAG,UAAU;IAE1D,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IACxC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAHZ,EAAE,EAAE,eAAe,CAAC,GAAG,CAAC,EACxB,uBAAuB,EAAE,uBAAuB,CAAC,GAAG,CAAC,EACrD,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,EAC/B,YAAY,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAGhE;;;;;;;;;;;;;;;;OAgBG;IACG,aAAa,CACjB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,YAAY,EAC3B,cAAc,EAAE,UAAU,GACzB,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAqD5B;;;;;;;;OAQG;IACG,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBvD;;;;;;;;;;;OAWG;IACG,WAAW,CACf,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,GACzC,OAAO,CAAC,GAAG,CAAC;CAWhB"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview AliasRegistry — manages pseudonymous alias registration,
|
|
4
|
+
* deregistration, and lookup.
|
|
5
|
+
*
|
|
6
|
+
* Aliases map back to a member's real identity through the quorum.
|
|
7
|
+
* The alias-to-identity mapping is sealed via IdentitySealingPipeline.
|
|
8
|
+
*
|
|
9
|
+
* @see Requirements 15
|
|
10
|
+
* @see Design: AliasRegistry (Section 5)
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.AliasRegistry = void 0;
|
|
14
|
+
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
15
|
+
const quorumErrorType_1 = require("../enumerations/quorumErrorType");
|
|
16
|
+
const quorumError_1 = require("../errors/quorumError");
|
|
17
|
+
const contentWithIdentity_1 = require("../interfaces/contentWithIdentity");
|
|
18
|
+
/**
|
|
19
|
+
* AliasRegistry manages pseudonymous alias registration, deregistration,
|
|
20
|
+
* and identity lookup for the quorum system.
|
|
21
|
+
*
|
|
22
|
+
* - Registration validates uniqueness, generates an alias keypair,
|
|
23
|
+
* seals the alias-to-identity mapping via IdentitySealingPipeline,
|
|
24
|
+
* and stores the AliasRecord.
|
|
25
|
+
* - Deregistration marks an alias as inactive.
|
|
26
|
+
* - Lookup recovers the real identity behind an alias given sufficient
|
|
27
|
+
* quorum shares.
|
|
28
|
+
*
|
|
29
|
+
* @template TID - Platform ID type for frontend/backend DTO compatibility
|
|
30
|
+
*/
|
|
31
|
+
class AliasRegistry {
|
|
32
|
+
constructor(db, identitySealingPipeline, eciesService, currentEpoch) {
|
|
33
|
+
this.db = db;
|
|
34
|
+
this.identitySealingPipeline = identitySealingPipeline;
|
|
35
|
+
this.eciesService = eciesService;
|
|
36
|
+
this.currentEpoch = currentEpoch;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Register a new alias for a quorum member.
|
|
40
|
+
*
|
|
41
|
+
* Steps:
|
|
42
|
+
* 1. Validate alias uniqueness via db.isAliasAvailable
|
|
43
|
+
* 2. Generate a new keypair for the alias using eciesService
|
|
44
|
+
* 3. Seal the alias-to-identity mapping via IdentitySealingPipeline
|
|
45
|
+
* (creates a ContentWithIdentity with the owner's real ID, sealed in Alias mode)
|
|
46
|
+
* 4. Store the AliasRecord with the recovery record ID
|
|
47
|
+
*
|
|
48
|
+
* @param aliasName - The unique pseudonym to register
|
|
49
|
+
* @param ownerMemberId - The real member ID of the alias owner
|
|
50
|
+
* @param ownerPublicKey - The owner's public key (used as creatorId for sealing)
|
|
51
|
+
* @returns The created AliasRecord
|
|
52
|
+
* @throws QuorumError with AliasAlreadyTaken if alias name is not available
|
|
53
|
+
* @throws QuorumError with IdentitySealingFailed if sealing fails
|
|
54
|
+
*/
|
|
55
|
+
async registerAlias(aliasName, ownerMemberId, ownerPublicKey) {
|
|
56
|
+
// 1. Validate alias uniqueness
|
|
57
|
+
const available = await this.db.isAliasAvailable(aliasName);
|
|
58
|
+
if (!available) {
|
|
59
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.AliasAlreadyTaken);
|
|
60
|
+
}
|
|
61
|
+
// 2. Generate a new keypair for the alias
|
|
62
|
+
const mnemonic = this.eciesService.generateNewMnemonic();
|
|
63
|
+
const aliasKeyPair = this.eciesService.mnemonicToSimpleKeyPair(mnemonic);
|
|
64
|
+
// 3. Seal the alias-to-identity mapping via IdentitySealingPipeline
|
|
65
|
+
// Create a ContentWithIdentity with the owner's real member ID as creatorId
|
|
66
|
+
const idProvider = this.eciesService.idProvider;
|
|
67
|
+
// Convert the owner member ID hex string to a TID for the creatorId
|
|
68
|
+
const ownerMemberIdBytes = new Uint8Array(Buffer.from(ownerMemberId, 'hex'));
|
|
69
|
+
const creatorId = idProvider.fromBytes(ownerMemberIdBytes);
|
|
70
|
+
const contentId = (0, ecies_lib_1.uint8ArrayToHex)(idProvider.generate());
|
|
71
|
+
const sealResult = await this.identitySealingPipeline.sealIdentity({
|
|
72
|
+
creatorId,
|
|
73
|
+
contentId,
|
|
74
|
+
contentType: 'alias',
|
|
75
|
+
signature: ownerPublicKey,
|
|
76
|
+
}, contentWithIdentity_1.IdentityMode.Alias, aliasName);
|
|
77
|
+
// 4. Store the AliasRecord
|
|
78
|
+
const epoch = await this.currentEpoch();
|
|
79
|
+
const now = new Date();
|
|
80
|
+
const aliasRecord = {
|
|
81
|
+
aliasName,
|
|
82
|
+
ownerMemberId,
|
|
83
|
+
aliasPublicKey: aliasKeyPair.publicKey,
|
|
84
|
+
identityRecoveryRecordId: sealResult.recoveryRecordId,
|
|
85
|
+
isActive: true,
|
|
86
|
+
registeredAt: now,
|
|
87
|
+
epochNumber: epoch.epochNumber,
|
|
88
|
+
};
|
|
89
|
+
await this.db.saveAlias(aliasRecord);
|
|
90
|
+
return aliasRecord;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Deregister an alias by marking it as inactive.
|
|
94
|
+
*
|
|
95
|
+
* After deregistration, the alias cannot be used for further content publication.
|
|
96
|
+
*
|
|
97
|
+
* @param aliasName - The alias name to deregister
|
|
98
|
+
* @throws QuorumError with AliasNotFound if alias does not exist
|
|
99
|
+
* @throws QuorumError with AliasInactive if alias is already inactive
|
|
100
|
+
*/
|
|
101
|
+
async deregisterAlias(aliasName) {
|
|
102
|
+
const alias = await this.db.getAlias(aliasName);
|
|
103
|
+
if (!alias) {
|
|
104
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.AliasNotFound);
|
|
105
|
+
}
|
|
106
|
+
if (!alias.isActive) {
|
|
107
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.AliasInactive);
|
|
108
|
+
}
|
|
109
|
+
// Mark as inactive and set deactivation timestamp
|
|
110
|
+
const updatedAlias = {
|
|
111
|
+
...alias,
|
|
112
|
+
isActive: false,
|
|
113
|
+
deactivatedAt: new Date(),
|
|
114
|
+
};
|
|
115
|
+
await this.db.saveAlias(updatedAlias);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Look up the real identity behind an alias given sufficient quorum shares.
|
|
119
|
+
*
|
|
120
|
+
* Uses the alias's identityRecoveryRecordId to recover the real identity
|
|
121
|
+
* via IdentitySealingPipeline.recoverIdentity().
|
|
122
|
+
*
|
|
123
|
+
* @param aliasName - The alias name to look up
|
|
124
|
+
* @param decryptedShares - Map of member ID to decrypted share string
|
|
125
|
+
* @returns The recovered real identity
|
|
126
|
+
* @throws QuorumError with AliasNotFound if alias does not exist
|
|
127
|
+
* @throws QuorumError with InsufficientSharesForReconstruction if not enough shares
|
|
128
|
+
*/
|
|
129
|
+
async lookupAlias(aliasName, decryptedShares) {
|
|
130
|
+
const alias = await this.db.getAlias(aliasName);
|
|
131
|
+
if (!alias) {
|
|
132
|
+
throw new quorumError_1.QuorumError(quorumErrorType_1.QuorumErrorType.AliasNotFound);
|
|
133
|
+
}
|
|
134
|
+
return this.identitySealingPipeline.recoverIdentity(alias.identityRecoveryRecordId, decryptedShares);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.AliasRegistry = AliasRegistry;
|
|
138
|
+
//# sourceMappingURL=aliasRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aliasRegistry.js","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/services/aliasRegistry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,0DAKoC;AACpC,qEAAkE;AAClE,uDAAoD;AAEpD,2EAAiE;AAKjE;;;;;;;;;;;;GAYG;AACH,MAAa,aAAa;IACxB,YACmB,EAAwB,EACxB,uBAAqD,EACrD,YAA+B,EAC/B,YAA6C;QAH7C,OAAE,GAAF,EAAE,CAAsB;QACxB,4BAAuB,GAAvB,uBAAuB,CAA8B;QACrD,iBAAY,GAAZ,YAAY,CAAmB;QAC/B,iBAAY,GAAZ,YAAY,CAAiC;IAC7D,CAAC;IAEJ;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,aAAa,CACjB,SAAiB,EACjB,aAA2B,EAC3B,cAA0B;QAE1B,+BAA+B;QAC/B,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,yBAAW,CAAC,iCAAe,CAAC,iBAAiB,CAAC,CAAC;QAC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B;QACrC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAChD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,yBAAW,CAAC,iCAAe,CAAC,aAAa,CAAC,CAAC;QACvD,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpB,MAAM,IAAI,yBAAW,CAAC,iCAAe,CAAC,aAAa,CAAC,CAAC;QACvD,CAAC;QAED,kDAAkD;QAClD,MAAM,YAAY,GAAqB;YACrC,GAAG,KAAK;YACR,QAAQ,EAAE,KAAK;YACf,aAAa,EAAE,IAAI,IAAI,EAAE;SAC1B,CAAC;QAEF,MAAM,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,WAAW,CACf,SAAiB,EACjB,eAA0C;QAE1C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAChD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,yBAAW,CAAC,iCAAe,CAAC,aAAa,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,CAAC,uBAAuB,CAAC,eAAe,CACjD,KAAK,CAAC,wBAAwB,EAC9B,eAAe,CAChB,CAAC;IACJ,CAAC;CACF;AAzID,sCAyIC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview AuditLogService — immutable chained audit log.
|
|
3
|
+
*
|
|
4
|
+
* Computes SHA-3 content hashes, links entries via previousEntryHash,
|
|
5
|
+
* signs with the node operator's key, and optionally persists to the
|
|
6
|
+
* block store via storeCBLWithWhitening.
|
|
7
|
+
*
|
|
8
|
+
* @see Design: Immutable Chained Audit Log
|
|
9
|
+
* @see Requirements 13.6, 13.7
|
|
10
|
+
*/
|
|
11
|
+
import { ECIESService, Member, PlatformID } from '@digitaldefiance/ecies-lib';
|
|
12
|
+
import { QuorumAuditLogEntry } from '../interfaces/auditLogEntry';
|
|
13
|
+
import { ChainedAuditLogEntry } from '../interfaces/chainedAuditLogEntry';
|
|
14
|
+
import { IQuorumDatabase } from '../interfaces/services/quorumDatabase';
|
|
15
|
+
import { CBLStorageResult } from '../interfaces/storage/cblWhitening';
|
|
16
|
+
/**
|
|
17
|
+
* Callback interface for persisting audit entries to the block store.
|
|
18
|
+
* Implementations live in brightchain-api-lib where the actual block store is available.
|
|
19
|
+
*/
|
|
20
|
+
export interface IAuditBlockStorePersistence {
|
|
21
|
+
/**
|
|
22
|
+
* Store serialized audit entry data via storeCBLWithWhitening.
|
|
23
|
+
* @param data - Serialized chained audit entry
|
|
24
|
+
* @returns The CBL storage result with blockId1 and blockId2
|
|
25
|
+
*/
|
|
26
|
+
storeCBLWithWhitening(data: Uint8Array): Promise<CBLStorageResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Retrieve a stored audit entry from the block store.
|
|
29
|
+
* @param blockId1 - First CBL block ID
|
|
30
|
+
* @param blockId2 - Second CBL block ID
|
|
31
|
+
* @returns The reconstructed data
|
|
32
|
+
*/
|
|
33
|
+
retrieveCBL(blockId1: string, blockId2: string): Promise<Uint8Array>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Serializes an audit log entry (excluding signature and blockIds) into
|
|
37
|
+
* a deterministic JSON string suitable for hashing.
|
|
38
|
+
*
|
|
39
|
+
* Fields are sorted alphabetically to ensure deterministic output.
|
|
40
|
+
* The `signature`, `blockId1`, and `blockId2` fields are excluded
|
|
41
|
+
* since they are computed after the content hash.
|
|
42
|
+
*/
|
|
43
|
+
export declare function serializeEntryForHashing(entry: QuorumAuditLogEntry & {
|
|
44
|
+
previousEntryHash?: string | null;
|
|
45
|
+
}): string;
|
|
46
|
+
/**
|
|
47
|
+
* Compute the SHA-3-512 content hash of a serialized entry string.
|
|
48
|
+
* Returns the hash as a hex string.
|
|
49
|
+
*/
|
|
50
|
+
export declare function computeContentHash(serialized: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* AuditLogService creates tamper-evident chained audit log entries.
|
|
53
|
+
*
|
|
54
|
+
* Each entry is:
|
|
55
|
+
* 1. Serialized deterministically (excluding signature/blockIds)
|
|
56
|
+
* 2. Hashed with SHA-3-512 to produce contentHash
|
|
57
|
+
* 3. Linked to the previous entry via previousEntryHash
|
|
58
|
+
* 4. Signed by the node operator's key
|
|
59
|
+
* 5. Optionally persisted to the block store via storeCBLWithWhitening
|
|
60
|
+
* 6. Stored in the database audit_log collection
|
|
61
|
+
*
|
|
62
|
+
* @template TID - Platform ID type for frontend/backend DTO compatibility
|
|
63
|
+
*/
|
|
64
|
+
export declare class AuditLogService<TID extends PlatformID = Uint8Array> {
|
|
65
|
+
private readonly db;
|
|
66
|
+
private readonly signingMember;
|
|
67
|
+
private readonly eciesService;
|
|
68
|
+
private readonly blockStore?;
|
|
69
|
+
constructor(db: IQuorumDatabase<TID>, signingMember: Member<TID>, eciesService: ECIESService, blockStore?: IAuditBlockStorePersistence | undefined);
|
|
70
|
+
/**
|
|
71
|
+
* Append an audit entry to the chained log.
|
|
72
|
+
*
|
|
73
|
+
* 1. Fetches the latest entry to get previousEntryHash
|
|
74
|
+
* 2. Computes contentHash = SHA-3(serialized entry excluding signature/blockIds)
|
|
75
|
+
* 3. Signs contentHash with the node operator key
|
|
76
|
+
* 4. Optionally stores via storeCBLWithWhitening
|
|
77
|
+
* 5. Persists the chained entry to the database
|
|
78
|
+
*
|
|
79
|
+
* @param entry - The base audit log entry to append
|
|
80
|
+
* @returns The fully chained audit log entry
|
|
81
|
+
*/
|
|
82
|
+
appendEntry(entry: QuorumAuditLogEntry): Promise<ChainedAuditLogEntry>;
|
|
83
|
+
/**
|
|
84
|
+
* Verify the integrity of the entire audit chain.
|
|
85
|
+
*
|
|
86
|
+
* Walks backward from the latest entry:
|
|
87
|
+
* 1. Recomputes contentHash from entry fields
|
|
88
|
+
* 2. Verifies signature against the signing node's public key
|
|
89
|
+
* 3. Optionally retrieves from block store and confirms match
|
|
90
|
+
* 4. Verifies previousEntryHash links
|
|
91
|
+
* 5. Detects tampering at any point
|
|
92
|
+
*
|
|
93
|
+
* @param signerPublicKey - The public key of the node that signed the entries
|
|
94
|
+
* @param entries - The full chain of entries to verify (ordered newest-first or oldest-first)
|
|
95
|
+
* @returns True if the chain is valid
|
|
96
|
+
* @throws QuorumError with AuditChainCorrupted if tampering is detected
|
|
97
|
+
*/
|
|
98
|
+
verifyChain(signerPublicKey: Uint8Array, entries: ChainedAuditLogEntry[]): Promise<boolean>;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=auditLogService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auditLogService.d.ts","sourceRoot":"","sources":["../../../../../brightchain-lib/src/lib/services/auditLogService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,YAAY,EACZ,MAAM,EACN,UAAU,EAEX,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;OAIG;IACH,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEnE;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACtE;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,mBAAmB,GAAG;IAAE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