@decaf-ts/for-fabric 0.1.43 → 0.1.44

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.
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FabricIdentityService = void 0;
7
+ const core_1 = require("@decaf-ts/core");
8
+ const fabric_ca_client_1 = __importDefault(require("fabric-ca-client"));
9
+ const db_decorators_1 = require("@decaf-ts/db-decorators");
10
+ const utils_1 = require("./../../shared/utils.cjs");
11
+ const errors_1 = require("./../../shared/errors.cjs");
12
+ const index_1 = require("./../../shared/index.cjs");
13
+ const crypto_1 = require("./../../shared/crypto.cjs");
14
+ class FabricIdentityService extends core_1.ClientBasedService {
15
+ constructor() {
16
+ super();
17
+ }
18
+ get rootClient() {
19
+ return this.client["_FabricCaServices"];
20
+ }
21
+ get user() {
22
+ if (!this._user)
23
+ throw new db_decorators_1.InternalError("Fabric identity service not properly setup: missing user");
24
+ return this._user;
25
+ }
26
+ get certificates() {
27
+ return this.rootClient.newCertificateService();
28
+ }
29
+ get affiliations() {
30
+ return this.client.newAffiliationService();
31
+ }
32
+ get identities() {
33
+ return this.client.newIdentityService();
34
+ }
35
+ async getUser(cfg, ctx) {
36
+ const log = ctx.logger.for(this.getUser);
37
+ const { caName, caCert, caKey, url, hsm } = cfg;
38
+ log.info(`Creating CA user for ${caName} at ${url}`);
39
+ log.verbose(`Retrieving CA certificate from ${caCert}`);
40
+ const certificate = await utils_1.CoreUtils.getFirstDirFileNameContent(caCert);
41
+ let key;
42
+ if (!hsm) {
43
+ if (!caKey) {
44
+ throw new db_decorators_1.InternalError(`Missing caKey configuration for CA ${caName}. Provide a key directory or configure HSM support.`);
45
+ }
46
+ log.debug(`Retrieving CA key from ${caKey}`);
47
+ key = await utils_1.CoreUtils.getFirstDirFileNameContent(caKey);
48
+ }
49
+ else {
50
+ log.debug(`Using HSM configuration for CA ${caName} with library ${hsm.library}`);
51
+ }
52
+ log.debug(`Loading Admin user for ca ${caName}`);
53
+ this._user = await utils_1.CoreUtils.getCAUser("admin", key, certificate, caName, {
54
+ hsm,
55
+ });
56
+ return this._user;
57
+ }
58
+ async initialize(...args) {
59
+ const { log, ctx } = await this.logCtx(args, this.initialize, true);
60
+ const [config] = args;
61
+ if (!config)
62
+ throw new db_decorators_1.InternalError("Missing Fabric CA configuration");
63
+ const { url, tls, caName } = config;
64
+ log.info(`Initializing CA Client for CA ${config.caName} at ${config.url}`);
65
+ const { trustedRoots, verify } = tls;
66
+ const root = trustedRoots[0];
67
+ log.debug(`Retrieving CA certificate from ${root}. cwd: ${process.cwd()}`);
68
+ const certificate = await utils_1.CoreUtils.getFileContent(root);
69
+ log.debug(`CA Certificate: ${certificate.toString()}`);
70
+ const client = new fabric_ca_client_1.default(url, {
71
+ trustedRoots: Buffer.from(certificate),
72
+ verify,
73
+ }, caName);
74
+ const user = await this.getUser(config, ctx);
75
+ log.debug(`CA user loaded: ${user.getName()}`);
76
+ return {
77
+ config,
78
+ client,
79
+ };
80
+ }
81
+ async getCertificates(request, doMap = true, ...args) {
82
+ if (request instanceof core_1.Context) {
83
+ args = [request];
84
+ doMap = true;
85
+ request = undefined;
86
+ }
87
+ else if (typeof request === "boolean") {
88
+ doMap = request;
89
+ request = undefined;
90
+ }
91
+ else if (typeof doMap !== "boolean") {
92
+ args = [doMap, ...args];
93
+ doMap = true;
94
+ }
95
+ const { log } = await this.logCtx(args, this.getCertificates, true);
96
+ log.debug(`Retrieving certificates${request ? ` for ${request.id}` : ""} for CA ${this.config.caName}`);
97
+ const response = (await this.certificates.getCertificates(request || {}, this.user)).result;
98
+ log.verbose(`Found ${response.certs.length} certificates`);
99
+ log.debug(response.certs);
100
+ return (doMap ? response.certs.map((c) => c.PEM) : response);
101
+ }
102
+ async getIdentities(ctx) {
103
+ const log = ctx.logger.for(this.getIdentities);
104
+ log.verbose(`Retrieving Identities under CA ${this.config.caName}`);
105
+ const response = (await this.identities.getAll(this.user))
106
+ .result;
107
+ log.verbose(`Found ${response.identities.length} Identities`);
108
+ log.debug(response.identities);
109
+ return response.identities;
110
+ }
111
+ /**
112
+ * @description Retrieve affiliations from the CA.
113
+ * @summary Queries the CA for the list of affiliations available under the configured CA.
114
+ * @return {string} The affiliations result payload.
115
+ */
116
+ async getAffiliations(ctx) {
117
+ const log = ctx.logger.for(this.getAffiliations);
118
+ log.verbose(`Retrieving Affiliations under CA ${this.config.caName}`);
119
+ const response = (await this.affiliations.getAll(this.user)).result;
120
+ log.verbose(`Found ${response.a.length} Affiliations`);
121
+ log.debug(JSON.stringify(response));
122
+ return response;
123
+ }
124
+ parseError(e) {
125
+ const regexp = /.*code:\s(\d+).*?message:\s["'](.+)["']/gs;
126
+ const match = regexp.exec(e.message);
127
+ if (!match)
128
+ return new errors_1.RegistrationError(e);
129
+ const [, code, message] = match;
130
+ switch (code) {
131
+ case "74":
132
+ case "71":
133
+ return new db_decorators_1.ConflictError(message);
134
+ case "20":
135
+ return new core_1.AuthorizationError(message);
136
+ default:
137
+ return new errors_1.RegistrationError(message);
138
+ }
139
+ }
140
+ /**
141
+ * @description Read identity details from the CA by enrollment ID.
142
+ * @summary Retrieves and validates a single identity, throwing NotFoundError when missing.
143
+ * @param {string} enrollmentId - Enrollment ID to lookup.
144
+ * @return {Promise<FabricIdentity>} The identity details stored in the CA.
145
+ */
146
+ async read(enrollmentId, ...args) {
147
+ const { log } = await this.logCtx(args, this.read, true);
148
+ log.verbose(`Retrieving identity with enrollment ID ${enrollmentId}`);
149
+ let result;
150
+ try {
151
+ result = await this.identities.getOne(enrollmentId, this.user);
152
+ }
153
+ catch (e) {
154
+ throw new db_decorators_1.NotFoundError(`Couldn't find enrollment with id ${enrollmentId}: ${e}`);
155
+ }
156
+ if (!result.success)
157
+ throw new db_decorators_1.NotFoundError(`Couldn't find enrollment with id ${enrollmentId}: ${result.errors.join("\n")}`);
158
+ return result.result;
159
+ }
160
+ /**
161
+ * @description Register a new identity with the CA.
162
+ * @summary Submits a registration request for a new enrollment ID, returning the enrollment secret upon success.
163
+ * @param {Credentials} model - Credentials containing userName and password for the new identity.
164
+ * @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
165
+ * @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
166
+ * @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
167
+ * @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
168
+ * @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
169
+ * @return {Promise<string>} The enrollment secret for the registered identity.
170
+ */
171
+ async register(model, isSuperUser = false, affiliation = "", userRole, attrs, maxEnrollments, ...args) {
172
+ const { log } = await this.logCtx(args, this.register, true);
173
+ let registration;
174
+ try {
175
+ const { userName, password } = model;
176
+ const props = {
177
+ enrollmentID: userName,
178
+ enrollmentSecret: password,
179
+ affiliation: affiliation,
180
+ userRole: userRole,
181
+ attrs: attrs,
182
+ maxEnrollments: maxEnrollments,
183
+ };
184
+ registration = await this.client.register(props, this.user);
185
+ log.info(`Registration for ${userName} created with user type ${userRole ?? "Undefined Role"} ${isSuperUser ? "as super user" : ""}`);
186
+ }
187
+ catch (e) {
188
+ throw this.parseError(e);
189
+ }
190
+ return registration;
191
+ }
192
+ static identityFromEnrollment(enrollment, mspId, ctx) {
193
+ const log = ctx.logger.for(this.identityFromEnrollment);
194
+ const { certificate, key, rootCertificate } = enrollment;
195
+ log.verbose(`Generating Identity from certificate ${certificate} in msp ${mspId}`);
196
+ const clientId = crypto_1.CryptoUtils.fabricIdFromCertificate(certificate);
197
+ const id = crypto_1.CryptoUtils.encode(clientId);
198
+ log.debug(`Identity ${clientId} and encodedId ${id}`);
199
+ return new index_1.Identity({
200
+ id: id,
201
+ credentials: {
202
+ id: id,
203
+ certificate: certificate,
204
+ privateKey: key.toBytes(),
205
+ rootCertificate: rootCertificate,
206
+ },
207
+ mspId: mspId,
208
+ });
209
+ }
210
+ /**
211
+ * @description Enroll an identity with the CA using a registration secret.
212
+ * @summary Exchanges the enrollment ID and secret for certificates, returning a constructed Identity model.
213
+ * @param {string} enrollmentId - Enrollment ID to enroll.
214
+ * @param {string} registration - Enrollment secret returned at registration time.
215
+ * @return {Promise<Identity>} The enrolled identity object with credentials.
216
+ */
217
+ async enroll(enrollmentId, registration, ...args) {
218
+ const { log, ctx } = await this.logCtx(args, this.enroll, true);
219
+ let identity;
220
+ try {
221
+ log.debug(`Enrolling ${enrollmentId}`);
222
+ const enrollment = await this.client.enroll({
223
+ enrollmentID: enrollmentId,
224
+ enrollmentSecret: registration,
225
+ });
226
+ identity = FabricIdentityService.identityFromEnrollment(enrollment, this.config.caName, ctx);
227
+ log.info(`Successfully enrolled ${enrollmentId} under ${this.config.caName} as ${identity.id}`);
228
+ }
229
+ catch (e) {
230
+ throw this.parseError(e);
231
+ }
232
+ return identity;
233
+ }
234
+ /**
235
+ * @description Register and enroll a new identity in one step.
236
+ * @summary Registers a new enrollment ID with the CA and immediately exchanges the secret to enroll, returning the created Identity.
237
+ * @param {Credentials} model - Credentials for the new identity containing userName and password.
238
+ * @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
239
+ * @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
240
+ * @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
241
+ * @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
242
+ * @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
243
+ * @return {Promise<Identity>} The enrolled identity.
244
+ */
245
+ async registerAndEnroll(model, isSuperUser = false, affiliation = "", userRole, attrs, maxEnrollments, ...args) {
246
+ const { ctx } = await this.logCtx(args, this.registerAndEnroll, true);
247
+ const registration = await this.register(model, isSuperUser, affiliation, userRole, attrs, maxEnrollments, ctx);
248
+ const { userName } = model;
249
+ return this.enroll(userName, registration, ctx);
250
+ }
251
+ /**
252
+ * Revokes the enrollment of an identity with the specified enrollment ID.
253
+ *
254
+ * @param enrollmentId - The enrollment ID of the identity to be revoked.
255
+ *
256
+ * @returns A Promise that resolves to the result of the revocation operation.
257
+ *
258
+ * @throws {NotFoundError} If the enrollment with the specified ID does not exist.
259
+ * @throws {InternalError} If there is an error during the revocation process.
260
+ */
261
+ async revoke(enrollmentId, ...args) {
262
+ const { log } = await this.logCtx(args, this.revoke, true);
263
+ log.verbose(`Revoking identity with enrollment ID ${enrollmentId}`);
264
+ const identity = await this.read(enrollmentId);
265
+ if (!identity)
266
+ throw new db_decorators_1.NotFoundError(`Could not find enrollment with id ${enrollmentId}`);
267
+ let result;
268
+ try {
269
+ result = await this.client.revoke({ enrollmentID: identity.id, reason: "User Deletion" }, this.user);
270
+ }
271
+ catch (e) {
272
+ throw new db_decorators_1.InternalError(`Could not revoke enrollment with id ${enrollmentId}: ${e}`);
273
+ }
274
+ if (!result.success)
275
+ throw new db_decorators_1.InternalError(`Could not revoke enrollment with id ${enrollmentId}: ${result.errors.join("\n")}`);
276
+ return result;
277
+ }
278
+ }
279
+ exports.FabricIdentityService = FabricIdentityService;
280
+ //# sourceMappingURL=FabricIdentityService.js.map
@@ -0,0 +1,88 @@
1
+ import { AuthorizationError, ClientBasedService, Context, MaybeContextualArg } from "@decaf-ts/core";
2
+ import FabricCAServices, { AffiliationService, IdentityService, IEnrollResponse, IServiceResponse } from "fabric-ca-client";
3
+ import { CAConfig, Credentials } from "../../shared/types";
4
+ import { ConflictError } from "@decaf-ts/db-decorators";
5
+ import { CertificateResponse, FabricIdentity, GetCertificatesRequest } from "../../shared/fabric-types";
6
+ import { User } from "fabric-common";
7
+ import { CA_ROLE } from "./constants";
8
+ import { IKeyValueAttribute } from "./FabricEnrollmentService";
9
+ import { Identity } from "../../shared/index";
10
+ export declare class FabricIdentityService extends ClientBasedService<FabricCAServices, CAConfig> {
11
+ protected _user: User;
12
+ constructor();
13
+ protected get rootClient(): {
14
+ newCertificateService: any;
15
+ };
16
+ protected get user(): User;
17
+ protected get certificates(): any;
18
+ protected get affiliations(): AffiliationService;
19
+ protected get identities(): IdentityService;
20
+ protected getUser(cfg: CAConfig, ctx: Context): Promise<User>;
21
+ initialize(...args: MaybeContextualArg<any>): Promise<{
22
+ config: CAConfig;
23
+ client: FabricCAServices;
24
+ }>;
25
+ getCertificates(...args: MaybeContextualArg<any>): Promise<string[]>;
26
+ getCertificates(request: GetCertificatesRequest, ...args: MaybeContextualArg<any>): Promise<string[]>;
27
+ getCertificates<MAP extends boolean>(doMap: MAP, ...args: MaybeContextualArg<any>): Promise<MAP extends false ? CertificateResponse : string[]>;
28
+ getCertificates<MAP extends boolean>(request: GetCertificatesRequest, doMap: MAP, ...args: MaybeContextualArg<any>): Promise<MAP extends false ? CertificateResponse : string[]>;
29
+ getIdentities(ctx: Context): Promise<FabricIdentity[]>;
30
+ /**
31
+ * @description Retrieve affiliations from the CA.
32
+ * @summary Queries the CA for the list of affiliations available under the configured CA.
33
+ * @return {string} The affiliations result payload.
34
+ */
35
+ getAffiliations(ctx: Context): Promise<any>;
36
+ protected parseError(e: Error): AuthorizationError | ConflictError;
37
+ /**
38
+ * @description Read identity details from the CA by enrollment ID.
39
+ * @summary Retrieves and validates a single identity, throwing NotFoundError when missing.
40
+ * @param {string} enrollmentId - Enrollment ID to lookup.
41
+ * @return {Promise<FabricIdentity>} The identity details stored in the CA.
42
+ */
43
+ read(enrollmentId: string, ...args: MaybeContextualArg<any>): Promise<FabricIdentity>;
44
+ /**
45
+ * @description Register a new identity with the CA.
46
+ * @summary Submits a registration request for a new enrollment ID, returning the enrollment secret upon success.
47
+ * @param {Credentials} model - Credentials containing userName and password for the new identity.
48
+ * @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
49
+ * @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
50
+ * @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
51
+ * @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
52
+ * @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
53
+ * @return {Promise<string>} The enrollment secret for the registered identity.
54
+ */
55
+ register(model: Credentials, isSuperUser?: boolean, affiliation?: string, userRole?: CA_ROLE | string, attrs?: IKeyValueAttribute, maxEnrollments?: number, ...args: MaybeContextualArg<any>): Promise<string>;
56
+ protected static identityFromEnrollment(enrollment: IEnrollResponse, mspId: string, ctx: Context): Identity;
57
+ /**
58
+ * @description Enroll an identity with the CA using a registration secret.
59
+ * @summary Exchanges the enrollment ID and secret for certificates, returning a constructed Identity model.
60
+ * @param {string} enrollmentId - Enrollment ID to enroll.
61
+ * @param {string} registration - Enrollment secret returned at registration time.
62
+ * @return {Promise<Identity>} The enrolled identity object with credentials.
63
+ */
64
+ enroll(enrollmentId: string, registration: string, ...args: MaybeContextualArg<any>): Promise<Identity>;
65
+ /**
66
+ * @description Register and enroll a new identity in one step.
67
+ * @summary Registers a new enrollment ID with the CA and immediately exchanges the secret to enroll, returning the created Identity.
68
+ * @param {Credentials} model - Credentials for the new identity containing userName and password.
69
+ * @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
70
+ * @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
71
+ * @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
72
+ * @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
73
+ * @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
74
+ * @return {Promise<Identity>} The enrolled identity.
75
+ */
76
+ registerAndEnroll(model: Credentials, isSuperUser?: boolean, affiliation?: string, userRole?: CA_ROLE | string, attrs?: IKeyValueAttribute, maxEnrollments?: number, ...args: MaybeContextualArg<any>): Promise<Identity>;
77
+ /**
78
+ * Revokes the enrollment of an identity with the specified enrollment ID.
79
+ *
80
+ * @param enrollmentId - The enrollment ID of the identity to be revoked.
81
+ *
82
+ * @returns A Promise that resolves to the result of the revocation operation.
83
+ *
84
+ * @throws {NotFoundError} If the enrollment with the specified ID does not exist.
85
+ * @throws {InternalError} If there is an error during the revocation process.
86
+ */
87
+ revoke(enrollmentId: string, ...args: MaybeContextualArg<any>): Promise<IServiceResponse>;
88
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FabricIdentityService.js","sourceRoot":"","sources":["../../../src/client/services/FabricIdentityService.ts"],"names":[],"mappings":";;;;;;AAAA,yCAKwB;AACxB,wEAO0B;AAE1B,2DAIiC;AACjC,oDAA+C;AAQ/C,sDAAwD;AAGxD,oDAA8C;AAC9C,sDAAkD;AAElD,MAAa,qBAAsB,SAAQ,yBAG1C;IAGC;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,IAAc,UAAU;QACtB,OAAQ,IAAI,CAAC,MAAc,CAAC,mBAAmB,CAAQ,CAAC;IAC1D,CAAC;IAED,IAAc,IAAI;QAChB,IAAI,CAAC,IAAI,CAAC,KAAK;YACb,MAAM,IAAI,6BAAa,CACrB,0DAA0D,CAC3D,CAAC;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,IAAc,YAAY;QACxB,OAAO,IAAI,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC;IACjD,CAAC;IAED,IAAc,YAAY;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;IAC7C,CAAC;IAED,IAAc,UAAU;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC;IAC1C,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,GAAa,EAAE,GAAY;QACjD,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;QAEhD,GAAG,CAAC,IAAI,CAAC,wBAAwB,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC;QACrD,GAAG,CAAC,OAAO,CAAC,kCAAkC,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, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RegistrationRequestBuilder = void 0;
13
+ const decorator_validation_1 = require("@decaf-ts/decorator-validation");
14
+ const db_decorators_1 = require("@decaf-ts/db-decorators");
15
+ class RegistrationRequestBuilder extends decorator_validation_1.Model {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.affiliation = "";
19
+ }
20
+ build() {
21
+ const errs = this.hasErrors();
22
+ if (errs)
23
+ throw new db_decorators_1.ValidationError(errs.toString());
24
+ const response = {
25
+ enrollmentID: this.enrollmentID,
26
+ enrollmentSecret: this.enrollmentSecret,
27
+ role: this.role,
28
+ affiliation: this.affiliation,
29
+ };
30
+ if (typeof this.maxEnrollments !== "undefined")
31
+ response.maxEnrollments = this.maxEnrollments;
32
+ if (this.attrs)
33
+ response.attrs = this.attrs;
34
+ return response;
35
+ }
36
+ setAffiliation(value) {
37
+ this.affiliation = value;
38
+ return this;
39
+ }
40
+ addAttr(attr) {
41
+ this.attrs = this.attrs || [];
42
+ this.attrs.push(attr);
43
+ return this;
44
+ }
45
+ setAttrs(value) {
46
+ this.attrs = value;
47
+ return this;
48
+ }
49
+ setEnrollmentID(value) {
50
+ this.enrollmentID = value;
51
+ return this;
52
+ }
53
+ setEnrollmentSecret(value) {
54
+ this.enrollmentSecret = value;
55
+ return this;
56
+ }
57
+ setMaxEnrollments(value) {
58
+ this.maxEnrollments = value;
59
+ return this;
60
+ }
61
+ setRole(value) {
62
+ this.role = value;
63
+ return this;
64
+ }
65
+ }
66
+ exports.RegistrationRequestBuilder = RegistrationRequestBuilder;
67
+ __decorate([
68
+ (0, decorator_validation_1.required)(),
69
+ __metadata("design:type", String)
70
+ ], RegistrationRequestBuilder.prototype, "affiliation", void 0);
71
+ __decorate([
72
+ (0, decorator_validation_1.minlength)(1),
73
+ __metadata("design:type", Array)
74
+ ], RegistrationRequestBuilder.prototype, "attrs", void 0);
75
+ __decorate([
76
+ (0, decorator_validation_1.required)(),
77
+ __metadata("design:type", String)
78
+ ], RegistrationRequestBuilder.prototype, "enrollmentID", void 0);
79
+ __decorate([
80
+ (0, decorator_validation_1.required)(),
81
+ __metadata("design:type", String)
82
+ ], RegistrationRequestBuilder.prototype, "enrollmentSecret", void 0);
83
+ __decorate([
84
+ (0, decorator_validation_1.min)(0),
85
+ __metadata("design:type", Number)
86
+ ], RegistrationRequestBuilder.prototype, "maxEnrollments", void 0);
87
+ __decorate([
88
+ (0, decorator_validation_1.required)(),
89
+ __metadata("design:type", String)
90
+ ], RegistrationRequestBuilder.prototype, "role", void 0);
91
+ //# sourceMappingURL=RegistrationRequestBuilder.js.map
@@ -0,0 +1,19 @@
1
+ import { IRegisterRequest, IKeyValueAttribute } from "fabric-ca-client";
2
+ import { CA_ROLE } from "./constants";
3
+ import { Model } from "@decaf-ts/decorator-validation";
4
+ export declare class RegistrationRequestBuilder extends Model {
5
+ affiliation: string;
6
+ attrs?: IKeyValueAttribute[];
7
+ enrollmentID: string;
8
+ enrollmentSecret: string;
9
+ maxEnrollments?: number;
10
+ role: string;
11
+ build(): IRegisterRequest;
12
+ setAffiliation(value: string): this;
13
+ addAttr(attr: IKeyValueAttribute): this;
14
+ setAttrs(value: IKeyValueAttribute[]): this;
15
+ setEnrollmentID(value: string): this;
16
+ setEnrollmentSecret(value: string): this;
17
+ setMaxEnrollments(value: number): this;
18
+ setRole(value: CA_ROLE | string): this;
19
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegistrationRequestBuilder.js","sourceRoot":"","sources":["../../../src/client/services/RegistrationRequestBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yEAKwC;AACxC,2DAA0D;AAE1D,MAAa,0BAA2B,SAAQ,4BAAK;IAArD;;QAEE,gBAAW,GAAW,EAAE,CAAC;IA8D3B,CAAC;IAlDC,KAAK;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAC9B,IAAI,IAAI;YAAE,MAAM,IAAI,+BAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrD,MAAM,QAAQ,GAAqB;YACjC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;QACF,IAAI,OAAO,IAAI,CAAC,cAAc,KAAK,WAAW;YAC5C,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAChD,IAAI,IAAI,CAAC,KAAK;YAAE,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC5C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,cAAc,CAAC,KAAa;QAC1B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,IAAwB;QAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,KAA2B;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,eAAe,CAAC,KAAa;QAC3B,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mBAAmB,CAAC,KAAa;QAC/B,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iBAAiB,CAAC,KAAa;QAC7B,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,KAAuB;QAC7B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAhED,gEAgEC;AA9DC;IADC,IAAA,+BAAQ,GAAE;;+DACc;AAEzB;IADC,IAAA,gCAAS,EAAC,CAAC,CAAC;;yDACgB;AAE7B;IADC,IAAA,+BAAQ,GAAE;;gEACW;AAEtB;IADC,IAAA,+BAAQ,GAAE;;oEACe;AAE1B;IADC,IAAA,0BAAG,EAAC,CAAC,CAAC;;kEACiB;AAExB;IADC,IAAA,+BAAQ,GAAE;;wDACG"}
@@ -15,5 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./FabricEnrollmentService.cjs"), exports);
18
+ __exportStar(require("./RegistrationRequestBuilder.cjs"), exports);
19
+ __exportStar(require("./FabricIdentityService.cjs"), exports);
18
20
  __exportStar(require("./constants.cjs"), exports);
19
21
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,4 @@
1
1
  export * from "./FabricEnrollmentService";
2
+ export * from "./RegistrationRequestBuilder";
3
+ export * from "./FabricIdentityService";
2
4
  export * from "./constants";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA0C;AAC1C,kDAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA0C;AAC1C,mEAA6C;AAC7C,8DAAwC;AACxC,kDAA4B"}
@@ -0,0 +1,88 @@
1
+ import { AuthorizationError, ClientBasedService, Context, MaybeContextualArg } from "@decaf-ts/core";
2
+ import FabricCAServices, { AffiliationService, IdentityService, IEnrollResponse, IServiceResponse } from "fabric-ca-client";
3
+ import { CAConfig, Credentials } from "../../shared/types";
4
+ import { ConflictError } from "@decaf-ts/db-decorators";
5
+ import { CertificateResponse, FabricIdentity, GetCertificatesRequest } from "../../shared/fabric-types";
6
+ import { User } from "fabric-common";
7
+ import { CA_ROLE } from "./constants";
8
+ import { IKeyValueAttribute } from "./FabricEnrollmentService";
9
+ import { Identity } from "../../shared/index";
10
+ export declare class FabricIdentityService extends ClientBasedService<FabricCAServices, CAConfig> {
11
+ protected _user: User;
12
+ constructor();
13
+ protected get rootClient(): {
14
+ newCertificateService: any;
15
+ };
16
+ protected get user(): User;
17
+ protected get certificates(): any;
18
+ protected get affiliations(): AffiliationService;
19
+ protected get identities(): IdentityService;
20
+ protected getUser(cfg: CAConfig, ctx: Context): Promise<User>;
21
+ initialize(...args: MaybeContextualArg<any>): Promise<{
22
+ config: CAConfig;
23
+ client: FabricCAServices;
24
+ }>;
25
+ getCertificates(...args: MaybeContextualArg<any>): Promise<string[]>;
26
+ getCertificates(request: GetCertificatesRequest, ...args: MaybeContextualArg<any>): Promise<string[]>;
27
+ getCertificates<MAP extends boolean>(doMap: MAP, ...args: MaybeContextualArg<any>): Promise<MAP extends false ? CertificateResponse : string[]>;
28
+ getCertificates<MAP extends boolean>(request: GetCertificatesRequest, doMap: MAP, ...args: MaybeContextualArg<any>): Promise<MAP extends false ? CertificateResponse : string[]>;
29
+ getIdentities(ctx: Context): Promise<FabricIdentity[]>;
30
+ /**
31
+ * @description Retrieve affiliations from the CA.
32
+ * @summary Queries the CA for the list of affiliations available under the configured CA.
33
+ * @return {string} The affiliations result payload.
34
+ */
35
+ getAffiliations(ctx: Context): Promise<any>;
36
+ protected parseError(e: Error): AuthorizationError | ConflictError;
37
+ /**
38
+ * @description Read identity details from the CA by enrollment ID.
39
+ * @summary Retrieves and validates a single identity, throwing NotFoundError when missing.
40
+ * @param {string} enrollmentId - Enrollment ID to lookup.
41
+ * @return {Promise<FabricIdentity>} The identity details stored in the CA.
42
+ */
43
+ read(enrollmentId: string, ...args: MaybeContextualArg<any>): Promise<FabricIdentity>;
44
+ /**
45
+ * @description Register a new identity with the CA.
46
+ * @summary Submits a registration request for a new enrollment ID, returning the enrollment secret upon success.
47
+ * @param {Credentials} model - Credentials containing userName and password for the new identity.
48
+ * @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
49
+ * @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
50
+ * @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
51
+ * @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
52
+ * @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
53
+ * @return {Promise<string>} The enrollment secret for the registered identity.
54
+ */
55
+ register(model: Credentials, isSuperUser?: boolean, affiliation?: string, userRole?: CA_ROLE | string, attrs?: IKeyValueAttribute, maxEnrollments?: number, ...args: MaybeContextualArg<any>): Promise<string>;
56
+ protected static identityFromEnrollment(enrollment: IEnrollResponse, mspId: string, ctx: Context): Identity;
57
+ /**
58
+ * @description Enroll an identity with the CA using a registration secret.
59
+ * @summary Exchanges the enrollment ID and secret for certificates, returning a constructed Identity model.
60
+ * @param {string} enrollmentId - Enrollment ID to enroll.
61
+ * @param {string} registration - Enrollment secret returned at registration time.
62
+ * @return {Promise<Identity>} The enrolled identity object with credentials.
63
+ */
64
+ enroll(enrollmentId: string, registration: string, ...args: MaybeContextualArg<any>): Promise<Identity>;
65
+ /**
66
+ * @description Register and enroll a new identity in one step.
67
+ * @summary Registers a new enrollment ID with the CA and immediately exchanges the secret to enroll, returning the created Identity.
68
+ * @param {Credentials} model - Credentials for the new identity containing userName and password.
69
+ * @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
70
+ * @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
71
+ * @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
72
+ * @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
73
+ * @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
74
+ * @return {Promise<Identity>} The enrolled identity.
75
+ */
76
+ registerAndEnroll(model: Credentials, isSuperUser?: boolean, affiliation?: string, userRole?: CA_ROLE | string, attrs?: IKeyValueAttribute, maxEnrollments?: number, ...args: MaybeContextualArg<any>): Promise<Identity>;
77
+ /**
78
+ * Revokes the enrollment of an identity with the specified enrollment ID.
79
+ *
80
+ * @param enrollmentId - The enrollment ID of the identity to be revoked.
81
+ *
82
+ * @returns A Promise that resolves to the result of the revocation operation.
83
+ *
84
+ * @throws {NotFoundError} If the enrollment with the specified ID does not exist.
85
+ * @throws {InternalError} If there is an error during the revocation process.
86
+ */
87
+ revoke(enrollmentId: string, ...args: MaybeContextualArg<any>): Promise<IServiceResponse>;
88
+ }
@@ -0,0 +1,273 @@
1
+ import { AuthorizationError, ClientBasedService, Context, } from "@decaf-ts/core";
2
+ import FabricCAServices from "fabric-ca-client";
3
+ import { ConflictError, InternalError, NotFoundError, } from "@decaf-ts/db-decorators";
4
+ import { CoreUtils } from "./../../shared/utils.js";
5
+ import { RegistrationError } from "./../../shared/errors.js";
6
+ import { Identity } from "./../../shared/index.js";
7
+ import { CryptoUtils } from "./../../shared/crypto.js";
8
+ export class FabricIdentityService extends ClientBasedService {
9
+ constructor() {
10
+ super();
11
+ }
12
+ get rootClient() {
13
+ return this.client["_FabricCaServices"];
14
+ }
15
+ get user() {
16
+ if (!this._user)
17
+ throw new InternalError("Fabric identity service not properly setup: missing user");
18
+ return this._user;
19
+ }
20
+ get certificates() {
21
+ return this.rootClient.newCertificateService();
22
+ }
23
+ get affiliations() {
24
+ return this.client.newAffiliationService();
25
+ }
26
+ get identities() {
27
+ return this.client.newIdentityService();
28
+ }
29
+ async getUser(cfg, ctx) {
30
+ const log = ctx.logger.for(this.getUser);
31
+ const { caName, caCert, caKey, url, hsm } = cfg;
32
+ log.info(`Creating CA user for ${caName} at ${url}`);
33
+ log.verbose(`Retrieving CA certificate from ${caCert}`);
34
+ const certificate = await CoreUtils.getFirstDirFileNameContent(caCert);
35
+ let key;
36
+ if (!hsm) {
37
+ if (!caKey) {
38
+ throw new InternalError(`Missing caKey configuration for CA ${caName}. Provide a key directory or configure HSM support.`);
39
+ }
40
+ log.debug(`Retrieving CA key from ${caKey}`);
41
+ key = await CoreUtils.getFirstDirFileNameContent(caKey);
42
+ }
43
+ else {
44
+ log.debug(`Using HSM configuration for CA ${caName} with library ${hsm.library}`);
45
+ }
46
+ log.debug(`Loading Admin user for ca ${caName}`);
47
+ this._user = await CoreUtils.getCAUser("admin", key, certificate, caName, {
48
+ hsm,
49
+ });
50
+ return this._user;
51
+ }
52
+ async initialize(...args) {
53
+ const { log, ctx } = await this.logCtx(args, this.initialize, true);
54
+ const [config] = args;
55
+ if (!config)
56
+ throw new InternalError("Missing Fabric CA configuration");
57
+ const { url, tls, caName } = config;
58
+ log.info(`Initializing CA Client for CA ${config.caName} at ${config.url}`);
59
+ const { trustedRoots, verify } = tls;
60
+ const root = trustedRoots[0];
61
+ log.debug(`Retrieving CA certificate from ${root}. cwd: ${process.cwd()}`);
62
+ const certificate = await CoreUtils.getFileContent(root);
63
+ log.debug(`CA Certificate: ${certificate.toString()}`);
64
+ const client = new FabricCAServices(url, {
65
+ trustedRoots: Buffer.from(certificate),
66
+ verify,
67
+ }, caName);
68
+ const user = await this.getUser(config, ctx);
69
+ log.debug(`CA user loaded: ${user.getName()}`);
70
+ return {
71
+ config,
72
+ client,
73
+ };
74
+ }
75
+ async getCertificates(request, doMap = true, ...args) {
76
+ if (request instanceof Context) {
77
+ args = [request];
78
+ doMap = true;
79
+ request = undefined;
80
+ }
81
+ else if (typeof request === "boolean") {
82
+ doMap = request;
83
+ request = undefined;
84
+ }
85
+ else if (typeof doMap !== "boolean") {
86
+ args = [doMap, ...args];
87
+ doMap = true;
88
+ }
89
+ const { log } = await this.logCtx(args, this.getCertificates, true);
90
+ log.debug(`Retrieving certificates${request ? ` for ${request.id}` : ""} for CA ${this.config.caName}`);
91
+ const response = (await this.certificates.getCertificates(request || {}, this.user)).result;
92
+ log.verbose(`Found ${response.certs.length} certificates`);
93
+ log.debug(response.certs);
94
+ return (doMap ? response.certs.map((c) => c.PEM) : response);
95
+ }
96
+ async getIdentities(ctx) {
97
+ const log = ctx.logger.for(this.getIdentities);
98
+ log.verbose(`Retrieving Identities under CA ${this.config.caName}`);
99
+ const response = (await this.identities.getAll(this.user))
100
+ .result;
101
+ log.verbose(`Found ${response.identities.length} Identities`);
102
+ log.debug(response.identities);
103
+ return response.identities;
104
+ }
105
+ /**
106
+ * @description Retrieve affiliations from the CA.
107
+ * @summary Queries the CA for the list of affiliations available under the configured CA.
108
+ * @return {string} The affiliations result payload.
109
+ */
110
+ async getAffiliations(ctx) {
111
+ const log = ctx.logger.for(this.getAffiliations);
112
+ log.verbose(`Retrieving Affiliations under CA ${this.config.caName}`);
113
+ const response = (await this.affiliations.getAll(this.user)).result;
114
+ log.verbose(`Found ${response.a.length} Affiliations`);
115
+ log.debug(JSON.stringify(response));
116
+ return response;
117
+ }
118
+ parseError(e) {
119
+ const regexp = /.*code:\s(\d+).*?message:\s["'](.+)["']/gs;
120
+ const match = regexp.exec(e.message);
121
+ if (!match)
122
+ return new RegistrationError(e);
123
+ const [, code, message] = match;
124
+ switch (code) {
125
+ case "74":
126
+ case "71":
127
+ return new ConflictError(message);
128
+ case "20":
129
+ return new AuthorizationError(message);
130
+ default:
131
+ return new RegistrationError(message);
132
+ }
133
+ }
134
+ /**
135
+ * @description Read identity details from the CA by enrollment ID.
136
+ * @summary Retrieves and validates a single identity, throwing NotFoundError when missing.
137
+ * @param {string} enrollmentId - Enrollment ID to lookup.
138
+ * @return {Promise<FabricIdentity>} The identity details stored in the CA.
139
+ */
140
+ async read(enrollmentId, ...args) {
141
+ const { log } = await this.logCtx(args, this.read, true);
142
+ log.verbose(`Retrieving identity with enrollment ID ${enrollmentId}`);
143
+ let result;
144
+ try {
145
+ result = await this.identities.getOne(enrollmentId, this.user);
146
+ }
147
+ catch (e) {
148
+ throw new NotFoundError(`Couldn't find enrollment with id ${enrollmentId}: ${e}`);
149
+ }
150
+ if (!result.success)
151
+ throw new NotFoundError(`Couldn't find enrollment with id ${enrollmentId}: ${result.errors.join("\n")}`);
152
+ return result.result;
153
+ }
154
+ /**
155
+ * @description Register a new identity with the CA.
156
+ * @summary Submits a registration request for a new enrollment ID, returning the enrollment secret upon success.
157
+ * @param {Credentials} model - Credentials containing userName and password for the new identity.
158
+ * @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
159
+ * @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
160
+ * @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
161
+ * @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
162
+ * @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
163
+ * @return {Promise<string>} The enrollment secret for the registered identity.
164
+ */
165
+ async register(model, isSuperUser = false, affiliation = "", userRole, attrs, maxEnrollments, ...args) {
166
+ const { log } = await this.logCtx(args, this.register, true);
167
+ let registration;
168
+ try {
169
+ const { userName, password } = model;
170
+ const props = {
171
+ enrollmentID: userName,
172
+ enrollmentSecret: password,
173
+ affiliation: affiliation,
174
+ userRole: userRole,
175
+ attrs: attrs,
176
+ maxEnrollments: maxEnrollments,
177
+ };
178
+ registration = await this.client.register(props, this.user);
179
+ log.info(`Registration for ${userName} created with user type ${userRole ?? "Undefined Role"} ${isSuperUser ? "as super user" : ""}`);
180
+ }
181
+ catch (e) {
182
+ throw this.parseError(e);
183
+ }
184
+ return registration;
185
+ }
186
+ static identityFromEnrollment(enrollment, mspId, ctx) {
187
+ const log = ctx.logger.for(this.identityFromEnrollment);
188
+ const { certificate, key, rootCertificate } = enrollment;
189
+ log.verbose(`Generating Identity from certificate ${certificate} in msp ${mspId}`);
190
+ const clientId = CryptoUtils.fabricIdFromCertificate(certificate);
191
+ const id = CryptoUtils.encode(clientId);
192
+ log.debug(`Identity ${clientId} and encodedId ${id}`);
193
+ return new Identity({
194
+ id: id,
195
+ credentials: {
196
+ id: id,
197
+ certificate: certificate,
198
+ privateKey: key.toBytes(),
199
+ rootCertificate: rootCertificate,
200
+ },
201
+ mspId: mspId,
202
+ });
203
+ }
204
+ /**
205
+ * @description Enroll an identity with the CA using a registration secret.
206
+ * @summary Exchanges the enrollment ID and secret for certificates, returning a constructed Identity model.
207
+ * @param {string} enrollmentId - Enrollment ID to enroll.
208
+ * @param {string} registration - Enrollment secret returned at registration time.
209
+ * @return {Promise<Identity>} The enrolled identity object with credentials.
210
+ */
211
+ async enroll(enrollmentId, registration, ...args) {
212
+ const { log, ctx } = await this.logCtx(args, this.enroll, true);
213
+ let identity;
214
+ try {
215
+ log.debug(`Enrolling ${enrollmentId}`);
216
+ const enrollment = await this.client.enroll({
217
+ enrollmentID: enrollmentId,
218
+ enrollmentSecret: registration,
219
+ });
220
+ identity = FabricIdentityService.identityFromEnrollment(enrollment, this.config.caName, ctx);
221
+ log.info(`Successfully enrolled ${enrollmentId} under ${this.config.caName} as ${identity.id}`);
222
+ }
223
+ catch (e) {
224
+ throw this.parseError(e);
225
+ }
226
+ return identity;
227
+ }
228
+ /**
229
+ * @description Register and enroll a new identity in one step.
230
+ * @summary Registers a new enrollment ID with the CA and immediately exchanges the secret to enroll, returning the created Identity.
231
+ * @param {Credentials} model - Credentials for the new identity containing userName and password.
232
+ * @param {boolean} [isSuperUser=false] - Whether to register the identity as a super user.
233
+ * @param {string} [affiliation=""] - Affiliation string (e.g., org1.department1).
234
+ * @param {CA_ROLE | string} [userRole] - Role to assign to the identity.
235
+ * @param {IKeyValueAttribute} [attrs] - Optional attributes to attach to the identity.
236
+ * @param {number} [maxEnrollments] - Maximum number of enrollments allowed for the identity.
237
+ * @return {Promise<Identity>} The enrolled identity.
238
+ */
239
+ async registerAndEnroll(model, isSuperUser = false, affiliation = "", userRole, attrs, maxEnrollments, ...args) {
240
+ const { ctx } = await this.logCtx(args, this.registerAndEnroll, true);
241
+ const registration = await this.register(model, isSuperUser, affiliation, userRole, attrs, maxEnrollments, ctx);
242
+ const { userName } = model;
243
+ return this.enroll(userName, registration, ctx);
244
+ }
245
+ /**
246
+ * Revokes the enrollment of an identity with the specified enrollment ID.
247
+ *
248
+ * @param enrollmentId - The enrollment ID of the identity to be revoked.
249
+ *
250
+ * @returns A Promise that resolves to the result of the revocation operation.
251
+ *
252
+ * @throws {NotFoundError} If the enrollment with the specified ID does not exist.
253
+ * @throws {InternalError} If there is an error during the revocation process.
254
+ */
255
+ async revoke(enrollmentId, ...args) {
256
+ const { log } = await this.logCtx(args, this.revoke, true);
257
+ log.verbose(`Revoking identity with enrollment ID ${enrollmentId}`);
258
+ const identity = await this.read(enrollmentId);
259
+ if (!identity)
260
+ throw new NotFoundError(`Could not find enrollment with id ${enrollmentId}`);
261
+ let result;
262
+ try {
263
+ result = await this.client.revoke({ enrollmentID: identity.id, reason: "User Deletion" }, this.user);
264
+ }
265
+ catch (e) {
266
+ throw new InternalError(`Could not revoke enrollment with id ${enrollmentId}: ${e}`);
267
+ }
268
+ if (!result.success)
269
+ throw new InternalError(`Could not revoke enrollment with id ${enrollmentId}: ${result.errors.join("\n")}`);
270
+ return result;
271
+ }
272
+ }
273
+ //# sourceMappingURL=FabricIdentityService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FabricIdentityService.js","sourceRoot":"","sources":["../../../../src/client/services/FabricIdentityService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,GAER,MAAM,gBAAgB,CAAC;AACxB,OAAO,gBAON,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,aAAa,EACb,aA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QAAkB,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAM,CACV,YAAoB,EACpB,GAAG,IAA6B;QAEhC,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC3D,GAAG,CAAC,OAAO,CAAC,wCAAwC,YAAY,EAAE,CAAC,CAAC;QACpE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ;YACX,MAAM,IAAI,aAAa,CACrB,qCAAqC,YAAY,EAAE,CACpD,CAAC;QACJ,IAAI,MAAwB,CAAC;QAC7B,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAC/B,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,EACtD,IAAI,CAAC,IAAI,CACV,CAAC;QACJ,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACpB,MAAM,IAAI,aAAa,CACrB,uCAAuC,YAAY,KAAK,CAAC,EAAE,CAC5D,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,OAAO;YACjB,MAAM,IAAI,aAAa,CACrB,uCAAuC,YAAY,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACnF,CAAC;QACJ,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,19 @@
1
+ import { IRegisterRequest, IKeyValueAttribute } from "fabric-ca-client";
2
+ import { CA_ROLE } from "./constants";
3
+ import { Model } from "@decaf-ts/decorator-validation";
4
+ export declare class RegistrationRequestBuilder extends Model {
5
+ affiliation: string;
6
+ attrs?: IKeyValueAttribute[];
7
+ enrollmentID: string;
8
+ enrollmentSecret: string;
9
+ maxEnrollments?: number;
10
+ role: string;
11
+ build(): IRegisterRequest;
12
+ setAffiliation(value: string): this;
13
+ addAttr(attr: IKeyValueAttribute): this;
14
+ setAttrs(value: IKeyValueAttribute[]): this;
15
+ setEnrollmentID(value: string): this;
16
+ setEnrollmentSecret(value: string): this;
17
+ setMaxEnrollments(value: number): this;
18
+ setRole(value: CA_ROLE | string): this;
19
+ }
@@ -0,0 +1,87 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { min, minlength, Model, required, } from "@decaf-ts/decorator-validation";
11
+ import { ValidationError } from "@decaf-ts/db-decorators";
12
+ export class RegistrationRequestBuilder extends Model {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.affiliation = "";
16
+ }
17
+ build() {
18
+ const errs = this.hasErrors();
19
+ if (errs)
20
+ throw new ValidationError(errs.toString());
21
+ const response = {
22
+ enrollmentID: this.enrollmentID,
23
+ enrollmentSecret: this.enrollmentSecret,
24
+ role: this.role,
25
+ affiliation: this.affiliation,
26
+ };
27
+ if (typeof this.maxEnrollments !== "undefined")
28
+ response.maxEnrollments = this.maxEnrollments;
29
+ if (this.attrs)
30
+ response.attrs = this.attrs;
31
+ return response;
32
+ }
33
+ setAffiliation(value) {
34
+ this.affiliation = value;
35
+ return this;
36
+ }
37
+ addAttr(attr) {
38
+ this.attrs = this.attrs || [];
39
+ this.attrs.push(attr);
40
+ return this;
41
+ }
42
+ setAttrs(value) {
43
+ this.attrs = value;
44
+ return this;
45
+ }
46
+ setEnrollmentID(value) {
47
+ this.enrollmentID = value;
48
+ return this;
49
+ }
50
+ setEnrollmentSecret(value) {
51
+ this.enrollmentSecret = value;
52
+ return this;
53
+ }
54
+ setMaxEnrollments(value) {
55
+ this.maxEnrollments = value;
56
+ return this;
57
+ }
58
+ setRole(value) {
59
+ this.role = value;
60
+ return this;
61
+ }
62
+ }
63
+ __decorate([
64
+ required(),
65
+ __metadata("design:type", String)
66
+ ], RegistrationRequestBuilder.prototype, "affiliation", void 0);
67
+ __decorate([
68
+ minlength(1),
69
+ __metadata("design:type", Array)
70
+ ], RegistrationRequestBuilder.prototype, "attrs", void 0);
71
+ __decorate([
72
+ required(),
73
+ __metadata("design:type", String)
74
+ ], RegistrationRequestBuilder.prototype, "enrollmentID", void 0);
75
+ __decorate([
76
+ required(),
77
+ __metadata("design:type", String)
78
+ ], RegistrationRequestBuilder.prototype, "enrollmentSecret", void 0);
79
+ __decorate([
80
+ min(0),
81
+ __metadata("design:type", Number)
82
+ ], RegistrationRequestBuilder.prototype, "maxEnrollments", void 0);
83
+ __decorate([
84
+ required(),
85
+ __metadata("design:type", String)
86
+ ], RegistrationRequestBuilder.prototype, "role", void 0);
87
+ //# sourceMappingURL=RegistrationRequestBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegistrationRequestBuilder.js","sourceRoot":"","sources":["../../../../src/client/services/RegistrationRequestBuilder.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EACL,GAAG,EACH,SAAS,EACT,KAAK,EACL,QAAQ,GACT,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAArD;;QAEE,gBAAW,GAAW,EAAE,CAAC;IA8D3B,CAAC;IAlDC,KAAK;QACH,MAA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AI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,KAAuB;QAC7B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA9DC;IADC,QAAQ,EAAE;;+DACc;AAEzB;IADC,SAAS,CAAC,CAAC,CAAC;;yDACgB;AAE7B;IADC,QAAQ,EAAE;;gEACW;AAEtB;IADC,QAAQ,EAAE;;oEACe;AAE1B;IADC,GAAG,CAAC,CAAC,CAAC;;kEACiB;AAExB;IADC,QAAQ,EAAE;;wDACG"}
@@ -1,2 +1,4 @@
1
1
  export * from "./FabricEnrollmentService";
2
+ export * from "./RegistrationRequestBuilder";
3
+ export * from "./FabricIdentityService";
2
4
  export * from "./constants";
@@ -1,3 +1,5 @@
1
1
  export * from "./FabricEnrollmentService.js";
2
+ export * from "./RegistrationRequestBuilder.js";
3
+ export * from "./FabricIdentityService.js";
2
4
  export * from "./constants.js";
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/services/index.ts"],"names":[],"mappings":"AAAA,6CAA0C;AAC1C,+BAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/services/index.ts"],"names":[],"mappings":"AAAA,6CAA0C;AAC1C,gDAA6C;AAC7C,2CAAwC;AACxC,+BAA4B"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.42";
1
+ export declare const VERSION = "0.1.43";
2
2
  export declare const PACKAGE_NAME = "@decaf-ts/for-fabric";
@@ -1,5 +1,5 @@
1
1
  import { Metadata } from "@decaf-ts/decoration";
2
- export const VERSION = "0.1.42";
2
+ export const VERSION = "0.1.43";
3
3
  export const PACKAGE_NAME = "@decaf-ts/for-fabric";
4
4
  Metadata.registerLibrary(PACKAGE_NAME, VERSION);
5
5
  //# sourceMappingURL=version.js.map
package/lib/version.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PACKAGE_NAME = exports.VERSION = void 0;
4
4
  const decoration_1 = require("@decaf-ts/decoration");
5
- exports.VERSION = "0.1.42";
5
+ exports.VERSION = "0.1.43";
6
6
  exports.PACKAGE_NAME = "@decaf-ts/for-fabric";
7
7
  decoration_1.Metadata.registerLibrary(exports.PACKAGE_NAME, exports.VERSION);
8
8
  //# sourceMappingURL=version.js.map
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.42";
1
+ export declare const VERSION = "0.1.43";
2
2
  export declare const PACKAGE_NAME = "@decaf-ts/for-fabric";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decaf-ts/for-fabric",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
4
4
  "description": "Abstracts fabric logic",
5
5
  "type": "module",
6
6
  "exports": {