@memberjunction/credentials 0.0.1 → 2.130.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.
@@ -0,0 +1,30 @@
1
+ import { BaseEngine, IMetadataProvider, UserInfo } from "@memberjunction/core";
2
+ import { CredentialCategoryEntity, CredentialEntity, CredentialTypeEntity } from "@memberjunction/core-entities";
3
+ import { CredentialResolutionOptions, ResolvedCredential, StoreCredentialOptions, CredentialValidationResult } from "./types";
4
+ export declare class CredentialEngine extends BaseEngine<CredentialEngine> {
5
+ private _credentials;
6
+ private _credentialTypes;
7
+ private _credentialCategories;
8
+ private _credentialsEntityId;
9
+ Config(forceRefresh?: boolean, contextUser?: UserInfo, provider?: IMetadataProvider): Promise<void>;
10
+ static get Instance(): CredentialEngine;
11
+ get Credentials(): CredentialEntity[];
12
+ get CredentialTypes(): CredentialTypeEntity[];
13
+ get CredentialCategories(): CredentialCategoryEntity[];
14
+ getCredentialTypeByName(typeName: string): CredentialTypeEntity | undefined;
15
+ getDefaultCredentialForType(credentialTypeName: string): CredentialEntity | undefined;
16
+ getCredentialById(credentialId: string): CredentialEntity | undefined;
17
+ getCredentialByName(credentialTypeName: string, credentialName: string): CredentialEntity | undefined;
18
+ getCredential<T extends Record<string, string> = Record<string, string>>(credentialName: string, options?: CredentialResolutionOptions): Promise<ResolvedCredential<T>>;
19
+ storeCredential(credentialTypeName: string, name: string, values: Record<string, string>, options: StoreCredentialOptions, contextUser: UserInfo): Promise<CredentialEntity>;
20
+ updateCredential(credentialId: string, values: Record<string, string>, contextUser: UserInfo): Promise<void>;
21
+ validateCredential(credentialId: string, contextUser: UserInfo): Promise<CredentialValidationResult>;
22
+ private resolveCredential;
23
+ private parseCredentialValues;
24
+ private validateValues;
25
+ private updateLastUsedAt;
26
+ private updateLastValidatedAt;
27
+ protected callValidationEndpoint(endpoint: string, values: Record<string, string>): Promise<CredentialValidationResult>;
28
+ private logAccess;
29
+ }
30
+ //# sourceMappingUR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AE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChF,cAAc,EAAE,MAAM,EACtB,OAAO,GAAE,2BAAgC,GAC1C,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAsEpB,eAAe,CACxB,kBAAkB,EAAE,MAAM,EAC1B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,OAAO,EAAE,sBAAsB,EAC/B,WAAW,EAAE,QAAQ,GACtB,OAAO,CAAC,gBAAgB,CAAC;IAqDf,gBAAgB,CACzB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,WAAW,EAAE,QAAQ,GACtB,OAAO,CAAC,IAAI,CAAC;IAuCH,kBAAkB,CAC3B,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,QAAQ,GACtB,OAAO,CAAC,0BAA0B,CAAC;IAuDtC,OAAO,CAAC,iBAAiB;IA2BzB,OAAO,CAAC,qBAAqB;IAkB7B,OAAO,CAAC,cAAc;YA0BR,gBAAgB;YAgBhB,qBAAqB;cAiBnB,sBAAsB,CAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,0BAA0B,CAAC;YAexB,SAAS;CAuC1B"}
@@ -0,0 +1,324 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CredentialEngine = void 0;
4
+ const core_1 = require("@memberjunction/core");
5
+ const CREDENTIAL_ACCESS_AUDIT_LOG_TYPE_ID = 'E8D4D100-E785-42D3-997F-ECFF3B0BCFC0';
6
+ class CredentialEngine extends core_1.BaseEngine {
7
+ constructor() {
8
+ super(...arguments);
9
+ this._credentials = [];
10
+ this._credentialTypes = [];
11
+ this._credentialCategories = [];
12
+ this._credentialsEntityId = null;
13
+ }
14
+ async Config(forceRefresh, contextUser, provider) {
15
+ const params = [
16
+ {
17
+ PropertyName: '_credentials',
18
+ EntityName: 'MJ: Credentials',
19
+ CacheLocal: true
20
+ },
21
+ {
22
+ PropertyName: '_credentialTypes',
23
+ EntityName: 'MJ: Credential Types',
24
+ CacheLocal: true
25
+ },
26
+ {
27
+ PropertyName: '_credentialCategories',
28
+ EntityName: 'MJ: Credential Categories',
29
+ CacheLocal: true
30
+ }
31
+ ];
32
+ let entityMatch;
33
+ if (provider) {
34
+ entityMatch = provider.Entities.find(e => e.Name?.trim().toLowerCase() === 'mj: credentials');
35
+ }
36
+ else {
37
+ const md = new core_1.Metadata();
38
+ entityMatch = md.EntityByName("MJ: Credentials");
39
+ }
40
+ if (entityMatch) {
41
+ this._credentialsEntityId = entityMatch.ID;
42
+ }
43
+ else {
44
+ throw new Error("Entity not found for MJ: Credentials!");
45
+ }
46
+ return await this.Load(params, provider, forceRefresh, contextUser);
47
+ }
48
+ static get Instance() {
49
+ return super.getInstance();
50
+ }
51
+ get Credentials() {
52
+ return this._credentials;
53
+ }
54
+ get CredentialTypes() {
55
+ return this._credentialTypes;
56
+ }
57
+ get CredentialCategories() {
58
+ return this._credentialCategories;
59
+ }
60
+ getCredentialTypeByName(typeName) {
61
+ return this._credentialTypes.find(t => t.Name.trim().toLowerCase() === typeName.trim().toLowerCase());
62
+ }
63
+ getDefaultCredentialForType(credentialTypeName) {
64
+ const credType = this.getCredentialTypeByName(credentialTypeName);
65
+ if (!credType)
66
+ return undefined;
67
+ return this._credentials.find(c => c.CredentialTypeID === credType.ID && c.IsDefault && c.IsActive);
68
+ }
69
+ getCredentialById(credentialId) {
70
+ return this._credentials.find(c => c.ID === credentialId);
71
+ }
72
+ getCredentialByName(credentialTypeName, credentialName) {
73
+ const credType = this.getCredentialTypeByName(credentialTypeName);
74
+ if (!credType)
75
+ return undefined;
76
+ return this._credentials.find(c => c.CredentialTypeID === credType.ID &&
77
+ c.Name.trim().toLowerCase() === credentialName.trim().toLowerCase() &&
78
+ c.IsActive);
79
+ }
80
+ async getCredential(credentialName, options = {}) {
81
+ const startTime = Date.now();
82
+ let credential = null;
83
+ let values = {};
84
+ let source = 'database';
85
+ try {
86
+ this.TryThrowIfNotLoaded();
87
+ if (options.directValues) {
88
+ values = options.directValues;
89
+ source = 'request';
90
+ }
91
+ else {
92
+ credential = this.resolveCredential(credentialName, options);
93
+ if (credential) {
94
+ values = this.parseCredentialValues(credential.Values);
95
+ source = 'database';
96
+ }
97
+ else {
98
+ throw new Error(`Credential not found: ${credentialName}`);
99
+ }
100
+ }
101
+ await this.logAccess(credential, options.contextUser, {
102
+ operation: 'Decrypt',
103
+ subsystem: options.subsystem,
104
+ success: true,
105
+ durationMs: Date.now() - startTime
106
+ });
107
+ if (credential && options.contextUser) {
108
+ this.updateLastUsedAt(credential.ID, options.contextUser).catch(e => (0, core_1.LogError)(e));
109
+ }
110
+ return {
111
+ credential,
112
+ values,
113
+ source,
114
+ expiresAt: credential?.ExpiresAt
115
+ };
116
+ }
117
+ catch (error) {
118
+ await this.logAccess(credential, options.contextUser, {
119
+ operation: 'Decrypt',
120
+ subsystem: options.subsystem,
121
+ success: false,
122
+ errorMessage: error instanceof Error ? error.message : String(error),
123
+ durationMs: Date.now() - startTime
124
+ });
125
+ throw error;
126
+ }
127
+ }
128
+ async storeCredential(credentialTypeName, name, values, options, contextUser) {
129
+ this.TryThrowIfNotLoaded();
130
+ const credType = this.getCredentialTypeByName(credentialTypeName);
131
+ if (!credType) {
132
+ throw new Error(`Credential type not found: ${credentialTypeName}`);
133
+ }
134
+ this.validateValues(values, credType.FieldSchema);
135
+ const md = new core_1.Metadata();
136
+ const credEntity = await md.GetEntityObject('MJ: Credentials', contextUser);
137
+ credEntity.NewRecord();
138
+ credEntity.CredentialTypeID = credType.ID;
139
+ credEntity.Name = name;
140
+ credEntity.Description = options.description || null;
141
+ credEntity.Values = JSON.stringify(values);
142
+ credEntity.IsDefault = options.isDefault ?? false;
143
+ credEntity.IsActive = true;
144
+ credEntity.CategoryID = options.categoryId || null;
145
+ credEntity.IconClass = options.iconClass || null;
146
+ credEntity.ExpiresAt = options.expiresAt || null;
147
+ const saved = await credEntity.Save();
148
+ if (!saved) {
149
+ throw new Error('Failed to save credential');
150
+ }
151
+ await this.logAccess(credEntity, contextUser, {
152
+ operation: 'Create',
153
+ success: true
154
+ });
155
+ await this.RefreshItem('_credentials');
156
+ return credEntity;
157
+ }
158
+ async updateCredential(credentialId, values, contextUser) {
159
+ this.TryThrowIfNotLoaded();
160
+ const md = new core_1.Metadata();
161
+ const credEntity = await md.GetEntityObject('MJ: Credentials', contextUser);
162
+ const loaded = await credEntity.Load(credentialId);
163
+ if (!loaded) {
164
+ throw new Error(`Credential not found: ${credentialId}`);
165
+ }
166
+ const credType = this._credentialTypes.find(t => t.ID === credEntity.CredentialTypeID);
167
+ if (credType) {
168
+ this.validateValues(values, credType.FieldSchema);
169
+ }
170
+ credEntity.Values = JSON.stringify(values);
171
+ const saved = await credEntity.Save();
172
+ if (!saved) {
173
+ throw new Error('Failed to update credential');
174
+ }
175
+ await this.logAccess(credEntity, contextUser, {
176
+ operation: 'Update',
177
+ success: true
178
+ });
179
+ await this.RefreshItem('_credentials');
180
+ }
181
+ async validateCredential(credentialId, contextUser) {
182
+ this.TryThrowIfNotLoaded();
183
+ const credential = this.getCredentialById(credentialId);
184
+ if (!credential) {
185
+ return {
186
+ isValid: false,
187
+ errors: ['Credential not found'],
188
+ warnings: [],
189
+ validatedAt: new Date()
190
+ };
191
+ }
192
+ const credType = this._credentialTypes.find(t => t.ID === credential.CredentialTypeID);
193
+ if (!credType?.ValidationEndpoint) {
194
+ return {
195
+ isValid: true,
196
+ errors: [],
197
+ warnings: ['No validation endpoint configured'],
198
+ validatedAt: new Date()
199
+ };
200
+ }
201
+ const values = this.parseCredentialValues(credential.Values);
202
+ const result = await this.callValidationEndpoint(credType.ValidationEndpoint, values);
203
+ if (contextUser) {
204
+ this.updateLastValidatedAt(credentialId, contextUser).catch(e => (0, core_1.LogError)(e));
205
+ }
206
+ await this.logAccess(credential, contextUser, {
207
+ operation: 'Validate',
208
+ success: result.isValid
209
+ });
210
+ return result;
211
+ }
212
+ resolveCredential(credentialName, options) {
213
+ if (options.credentialId) {
214
+ return this.getCredentialById(options.credentialId) || null;
215
+ }
216
+ const nameToFind = options.credentialName || credentialName;
217
+ const cred = this._credentials.find(c => c.Name.trim().toLowerCase() === nameToFind.trim().toLowerCase() &&
218
+ c.IsActive);
219
+ if (cred) {
220
+ return cred;
221
+ }
222
+ return null;
223
+ }
224
+ parseCredentialValues(valuesField) {
225
+ if (!valuesField)
226
+ return {};
227
+ try {
228
+ if (typeof valuesField === 'object') {
229
+ return valuesField;
230
+ }
231
+ return JSON.parse(valuesField);
232
+ }
233
+ catch (e) {
234
+ (0, core_1.LogError)(`Failed to parse credential values: ${e}`);
235
+ return {};
236
+ }
237
+ }
238
+ validateValues(values, fieldSchemaJson) {
239
+ if (!fieldSchemaJson)
240
+ return;
241
+ try {
242
+ const schema = JSON.parse(fieldSchemaJson);
243
+ const required = schema.required || [];
244
+ for (const field of required) {
245
+ if (!values[field]) {
246
+ throw new Error(`Required field missing: ${field}`);
247
+ }
248
+ }
249
+ }
250
+ catch (e) {
251
+ if (e instanceof SyntaxError) {
252
+ (0, core_1.LogError)(`Invalid FieldSchema JSON: ${e}`);
253
+ }
254
+ else {
255
+ throw e;
256
+ }
257
+ }
258
+ }
259
+ async updateLastUsedAt(credentialId, contextUser) {
260
+ try {
261
+ const md = new core_1.Metadata();
262
+ const credEntity = await md.GetEntityObject('MJ: Credentials', contextUser);
263
+ await credEntity.Load(credentialId);
264
+ credEntity.LastUsedAt = new Date();
265
+ await credEntity.Save();
266
+ }
267
+ catch (e) {
268
+ (0, core_1.LogError)(e);
269
+ }
270
+ }
271
+ async updateLastValidatedAt(credentialId, contextUser) {
272
+ try {
273
+ const md = new core_1.Metadata();
274
+ const credEntity = await md.GetEntityObject('MJ: Credentials', contextUser);
275
+ await credEntity.Load(credentialId);
276
+ credEntity.LastValidatedAt = new Date();
277
+ await credEntity.Save();
278
+ }
279
+ catch (e) {
280
+ (0, core_1.LogError)(e);
281
+ }
282
+ }
283
+ async callValidationEndpoint(endpoint, values) {
284
+ (0, core_1.LogStatus)(`Validation endpoint configured but not implemented: ${endpoint}`);
285
+ return {
286
+ isValid: true,
287
+ errors: [],
288
+ warnings: ['Validation endpoint call not implemented'],
289
+ validatedAt: new Date()
290
+ };
291
+ }
292
+ async logAccess(credential, contextUser, details) {
293
+ try {
294
+ if (!contextUser) {
295
+ return;
296
+ }
297
+ const md = new core_1.Metadata();
298
+ const auditLog = await md.GetEntityObject('Audit Logs', contextUser);
299
+ auditLog.NewRecord();
300
+ auditLog.UserID = contextUser.ID;
301
+ auditLog.AuditLogTypeID = CREDENTIAL_ACCESS_AUDIT_LOG_TYPE_ID;
302
+ auditLog.Status = details.success ? 'Success' : 'Failed';
303
+ auditLog.Description = credential
304
+ ? `${details.operation} credential '${credential.Name}'`
305
+ : `${details.operation} credential (not found)`;
306
+ auditLog.Details = JSON.stringify({
307
+ operation: details.operation,
308
+ subsystem: details.subsystem,
309
+ errorMessage: details.errorMessage,
310
+ durationMs: details.durationMs
311
+ });
312
+ if (credential && this._credentialsEntityId) {
313
+ auditLog.EntityID = this._credentialsEntityId;
314
+ auditLog.RecordID = credential.ID;
315
+ }
316
+ await auditLog.Save();
317
+ }
318
+ catch (e) {
319
+ (0, core_1.LogError)(`Failed to log credential access: ${e}`);
320
+ }
321
+ }
322
+ }
323
+ exports.CredentialEngine = CredentialEngine;
324
+ //# sourceMappingURL=CredentialEngine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CredentialEngine.js","sourceRoot":"","sources":["../src/CredentialEngine.ts"],"names":[],"mappings":";;;AAAA,+CAS8B;AAkB9B,MAAM,mCAAmC,GAAG,sCAAsC,CAAC;AAgCnF,MAAa,gBAAiB,SAAQ,iBAA4B;IAAlE;;QAEY,iBAAY,GAAuB,EAAE,CAA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,0 +1,4 @@
1
+ export { CredentialEngine } from './CredentialEngine';
2
+ export { CredentialResolutionOptions, ResolvedCredential, StoreCredentialOptions, CredentialValidationResult, CredentialAccessDetails, APIKeyCredentialValues, APIKeyWithEndpointCredentialValues, OAuth2ClientCredentialValues, BasicAuthCredentialValues, AzureServicePrincipalCredentialValues, AWSIAMCredentialValues, DatabaseConnectionCredentialValues, TwilioCredentialValues } from './types';
3
+ export { CredentialEntity, CredentialTypeEntity, CredentialCategoryEntity } from '@memberjunction/core-entities';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EACH,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EAEvB,sBAAsB,EACtB,kCAAkC,EAClC,4BAA4B,EAC5B,yBAAyB,EACzB,qCAAqC,EACrC,sBAAsB,EACtB,kCAAkC,EAClC,sBAAsB,EACzB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACH,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EAC3B,MAAM,+BAA+B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CredentialCategoryEntity = exports.CredentialTypeEntity = exports.CredentialEntity = exports.CredentialEngine = void 0;
4
+ var CredentialEngine_1 = require("./CredentialEngine");
5
+ Object.defineProperty(exports, "CredentialEngine", { enumerable: true, get: function () { return CredentialEngine_1.CredentialEngine; } });
6
+ var core_entities_1 = require("@memberjunction/core-entities");
7
+ Object.defineProperty(exports, "CredentialEntity", { enumerable: true, get: function () { return core_entities_1.CredentialEntity; } });
8
+ Object.defineProperty(exports, "CredentialTypeEntity", { enumerable: true, get: function () { return core_entities_1.CredentialTypeEntity; } });
9
+ Object.defineProperty(exports, "CredentialCategoryEntity", { enumerable: true, get: function () { return core_entities_1.CredentialCategoryEntity; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AAqBzB,+DAIuC;AAHnC,iHAAA,gBAAgB,OAAA;AAChB,qHAAA,oBAAoB,OAAA;AACpB,yHAAA,wBAAwB,OAAA"}
@@ -0,0 +1,74 @@
1
+ import { UserInfo } from "@memberjunction/core";
2
+ import { CredentialEntity } from "@memberjunction/core-entities";
3
+ export interface CredentialResolutionOptions {
4
+ credentialId?: string;
5
+ credentialName?: string;
6
+ directValues?: Record<string, string>;
7
+ contextUser?: UserInfo;
8
+ subsystem?: string;
9
+ }
10
+ export interface ResolvedCredential<T extends Record<string, string> = Record<string, string>> {
11
+ credential: CredentialEntity | null;
12
+ values: T;
13
+ source: 'database' | 'request';
14
+ expiresAt?: Date | null;
15
+ }
16
+ export interface StoreCredentialOptions {
17
+ isDefault?: boolean;
18
+ categoryId?: string;
19
+ iconClass?: string;
20
+ description?: string;
21
+ expiresAt?: Date;
22
+ }
23
+ export interface CredentialValidationResult {
24
+ isValid: boolean;
25
+ errors: string[];
26
+ warnings: string[];
27
+ validatedAt: Date;
28
+ }
29
+ export interface CredentialAccessDetails {
30
+ operation: 'Decrypt' | 'Create' | 'Update' | 'Delete' | 'Validate';
31
+ subsystem?: string;
32
+ success: boolean;
33
+ errorMessage?: string;
34
+ durationMs?: number;
35
+ }
36
+ export interface APIKeyCredentialValues {
37
+ apiKey: string;
38
+ }
39
+ export interface APIKeyWithEndpointCredentialValues {
40
+ apiKey: string;
41
+ endpoint: string;
42
+ }
43
+ export interface OAuth2ClientCredentialValues {
44
+ clientId: string;
45
+ clientSecret: string;
46
+ tokenUrl: string;
47
+ scope?: string;
48
+ }
49
+ export interface BasicAuthCredentialValues {
50
+ username: string;
51
+ password: string;
52
+ }
53
+ export interface AzureServicePrincipalCredentialValues {
54
+ tenantId: string;
55
+ clientId: string;
56
+ clientSecret: string;
57
+ }
58
+ export interface AWSIAMCredentialValues {
59
+ accessKeyId: string;
60
+ secretAccessKey: string;
61
+ region: string;
62
+ }
63
+ export interface DatabaseConnectionCredentialValues {
64
+ host: string;
65
+ port?: number;
66
+ database: string;
67
+ username: string;
68
+ password: string;
69
+ }
70
+ export interface TwilioCredentialValues {
71
+ accountSid: string;
72
+ authToken: string;
73
+ }
74
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKjE,MAAM,WAAW,2BAA2B;IAKxC,YAAY,CAAC,EAAE,MAAM,CAAC;IAMtB,cAAc,CAAC,EAAE,MAAM,CAAC;IAOxB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAMtC,WAAW,CAAC,EAAE,QAAQ,CAAC;IAMvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAOD,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAKzF,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAcpC,MAAM,EAAE,CAAC,CAAC;IAOV,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAM/B,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC3B;AAKD,MAAM,WAAW,sBAAsB;IAInC,SAAS,CAAC,EAAE,OAAO,CAAC;IAKpB,UAAU,CAAC,EAAE,MAAM,CAAC;IAKpB,SAAS,CAAC,EAAE,MAAM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AC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAKD,MAAM,WAAW,sBAAsB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACrB"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,10 +1,32 @@
1
1
  {
2
2
  "name": "@memberjunction/credentials",
3
- "version": "0.0.1",
4
- "description": "OIDC trusted publishing setup package for @memberjunction/credentials",
5
- "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
3
+ "version": "2.130.0",
4
+ "description": "MemberJunction: Credential Engine - secure credential management with caching, encryption, and audit logging.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "/dist"
9
+ ],
10
+ "scripts": {
11
+ "start": "ts-node-dev src/index.ts",
12
+ "build": "tsc",
13
+ "test": "echo \"Error: no test specified\" && exit 1"
14
+ },
15
+ "author": "MemberJunction.com",
16
+ "license": "ISC",
17
+ "dependencies": {
18
+ "@memberjunction/core": "2.130.0",
19
+ "@memberjunction/global": "2.130.0",
20
+ "@memberjunction/core-entities": "2.130.0",
21
+ "rxjs": "^7.8.1"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "20.14.2",
25
+ "ts-node-dev": "^2.0.0",
26
+ "typescript": "^5.4.5"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/MemberJunction/MJ"
31
+ }
10
32
  }
package/README.md DELETED
@@ -1,45 +0,0 @@
1
- # @memberjunction/credentials
2
-
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
4
-
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
6
-
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
8
-
9
- ## Purpose
10
-
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@memberjunction/credentials`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
15
-
16
- ## What is OIDC Trusted Publishing?
17
-
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
19
-
20
- ## Setup Instructions
21
-
22
- To properly configure OIDC trusted publishing for this package:
23
-
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
28
-
29
- ## DO NOT USE THIS PACKAGE
30
-
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
36
-
37
- ## More Information
38
-
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
42
-
43
- ---
44
-
45
- **Maintained for OIDC setup purposes only**