@twin.org/identity-authentication 0.0.2-next.8 → 0.0.2-next.9

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.
@@ -38,7 +38,7 @@ class VerifiableCredentialAuthenticationGenerator {
38
38
  /**
39
39
  * Runtime name for the class.
40
40
  */
41
- CLASS_NAME = "VerifiableCredentialAuthenticationGenerator";
41
+ static CLASS_NAME = "VerifiableCredentialAuthenticationGenerator";
42
42
  /**
43
43
  * Connector for identity operations.
44
44
  * @internal
@@ -64,9 +64,9 @@ class VerifiableCredentialAuthenticationGenerator {
64
64
  * @param options The options for the service.
65
65
  */
66
66
  constructor(options) {
67
- core.Guards.object(this.CLASS_NAME, "options", options);
68
- core.Guards.object(this.CLASS_NAME, "options.config", options.config);
69
- core.Guards.stringValue(this.CLASS_NAME, "options.config.verificationMethodId", options.config.verificationMethodId);
67
+ core.Guards.object(VerifiableCredentialAuthenticationGenerator.CLASS_NAME, "options", options);
68
+ core.Guards.object(VerifiableCredentialAuthenticationGenerator.CLASS_NAME, "options.config", options.config);
69
+ core.Guards.stringValue(VerifiableCredentialAuthenticationGenerator.CLASS_NAME, "options.config.verificationMethodId", options.config.verificationMethodId);
70
70
  this._identityConnector = identityModels.IdentityConnectorFactory.get(options?.identityConnectorType ?? "identity");
71
71
  this._verificationMethodId = options.config.verificationMethodId;
72
72
  this._tokenTtlInSeconds = options.config.tokenTtlInSeconds ?? 60;
@@ -87,9 +87,9 @@ class VerifiableCredentialAuthenticationGenerator {
87
87
  * @returns A promise that resolves when the authentication information has been added.
88
88
  */
89
89
  async addAuthentication(requestHeaders, authData) {
90
- core.Guards.object(this.CLASS_NAME, "requestHeaders", requestHeaders);
90
+ core.Guards.object(VerifiableCredentialAuthenticationGenerator.CLASS_NAME, "requestHeaders", requestHeaders);
91
91
  if (!this._nodeIdentity) {
92
- throw new core.GeneralError(this.CLASS_NAME, "missingNodeIdentity");
92
+ throw new core.GeneralError(VerifiableCredentialAuthenticationGenerator.CLASS_NAME, "missingNodeIdentity");
93
93
  }
94
94
  const ttlMs = this._tokenTtlInSeconds * 1000;
95
95
  const credential = await this._identityConnector.createVerifiableCredential(this._nodeIdentity, identityModels.DocumentHelper.joinId(this._nodeIdentity, this._verificationMethodId), undefined, authData, {
@@ -106,7 +106,7 @@ class VerifiableCredentialAuthenticationProcessor {
106
106
  /**
107
107
  * Runtime name for the class.
108
108
  */
109
- CLASS_NAME = "VerifiableCredentialAuthenticationProcessor";
109
+ static CLASS_NAME = "VerifiableCredentialAuthenticationProcessor";
110
110
  /**
111
111
  * Connector for identity operations.
112
112
  * @internal
@@ -152,17 +152,17 @@ class VerifiableCredentialAuthenticationProcessor {
152
152
  const result = await this._identityConnector.checkVerifiableCredential(token);
153
153
  const verifiableCredential = result.verifiableCredential;
154
154
  if (core.Is.empty(verifiableCredential)) {
155
- throw new core.GeneralError(this.CLASS_NAME, "tokenNoCredential");
155
+ throw new core.GeneralError(VerifiableCredentialAuthenticationProcessor.CLASS_NAME, "tokenNoCredential");
156
156
  }
157
157
  const issuer = core.Is.stringValue(verifiableCredential.issuer)
158
158
  ? verifiableCredential.issuer
159
159
  : undefined;
160
160
  if (core.Is.empty(issuer)) {
161
- throw new core.GeneralError(this.CLASS_NAME, "tokenNoIssuer");
161
+ throw new core.GeneralError(VerifiableCredentialAuthenticationProcessor.CLASS_NAME, "tokenNoIssuer");
162
162
  }
163
163
  const issuanceDate = standardsW3cDid.VerifiableCredentialHelper.getValidFrom(verifiableCredential);
164
164
  if (core.Is.empty(issuanceDate)) {
165
- throw new core.GeneralError(this.CLASS_NAME, "tokenMissingIssuanceDate", {
165
+ throw new core.GeneralError(VerifiableCredentialAuthenticationProcessor.CLASS_NAME, "tokenMissingIssuanceDate", {
166
166
  issuer
167
167
  });
168
168
  }
@@ -171,13 +171,13 @@ class VerifiableCredentialAuthenticationProcessor {
171
171
  const tokenTtlInMs = this._tokenTtlInSeconds * 1000;
172
172
  // If the token has expired then we should reject it
173
173
  if (tokenCreated.getTime() + tokenTtlInMs < now) {
174
- throw new core.GeneralError(this.CLASS_NAME, "tokenExpired", {
174
+ throw new core.GeneralError(VerifiableCredentialAuthenticationProcessor.CLASS_NAME, "tokenExpired", {
175
175
  issuer
176
176
  });
177
177
  }
178
178
  const subject = verifiableCredential.credentialSubject;
179
179
  if (core.Is.empty(subject)) {
180
- throw new core.GeneralError(this.CLASS_NAME, "tokenMissingSubject", {
180
+ throw new core.GeneralError(VerifiableCredentialAuthenticationProcessor.CLASS_NAME, "tokenMissingSubject", {
181
181
  issuer
182
182
  });
183
183
  }
@@ -187,7 +187,7 @@ class VerifiableCredentialAuthenticationProcessor {
187
187
  }
188
188
  }
189
189
  catch (err) {
190
- throw new core.GeneralError(this.CLASS_NAME, "tokenFailed", undefined, err);
190
+ throw new core.GeneralError(VerifiableCredentialAuthenticationProcessor.CLASS_NAME, "tokenFailed", undefined, err);
191
191
  }
192
192
  }
193
193
  }
@@ -36,7 +36,7 @@ class VerifiableCredentialAuthenticationGenerator {
36
36
  /**
37
37
  * Runtime name for the class.
38
38
  */
39
- CLASS_NAME = "VerifiableCredentialAuthenticationGenerator";
39
+ static CLASS_NAME = "VerifiableCredentialAuthenticationGenerator";
40
40
  /**
41
41
  * Connector for identity operations.
42
42
  * @internal
@@ -62,9 +62,9 @@ class VerifiableCredentialAuthenticationGenerator {
62
62
  * @param options The options for the service.
63
63
  */
64
64
  constructor(options) {
65
- Guards.object(this.CLASS_NAME, "options", options);
66
- Guards.object(this.CLASS_NAME, "options.config", options.config);
67
- Guards.stringValue(this.CLASS_NAME, "options.config.verificationMethodId", options.config.verificationMethodId);
65
+ Guards.object(VerifiableCredentialAuthenticationGenerator.CLASS_NAME, "options", options);
66
+ Guards.object(VerifiableCredentialAuthenticationGenerator.CLASS_NAME, "options.config", options.config);
67
+ Guards.stringValue(VerifiableCredentialAuthenticationGenerator.CLASS_NAME, "options.config.verificationMethodId", options.config.verificationMethodId);
68
68
  this._identityConnector = IdentityConnectorFactory.get(options?.identityConnectorType ?? "identity");
69
69
  this._verificationMethodId = options.config.verificationMethodId;
70
70
  this._tokenTtlInSeconds = options.config.tokenTtlInSeconds ?? 60;
@@ -85,9 +85,9 @@ class VerifiableCredentialAuthenticationGenerator {
85
85
  * @returns A promise that resolves when the authentication information has been added.
86
86
  */
87
87
  async addAuthentication(requestHeaders, authData) {
88
- Guards.object(this.CLASS_NAME, "requestHeaders", requestHeaders);
88
+ Guards.object(VerifiableCredentialAuthenticationGenerator.CLASS_NAME, "requestHeaders", requestHeaders);
89
89
  if (!this._nodeIdentity) {
90
- throw new GeneralError(this.CLASS_NAME, "missingNodeIdentity");
90
+ throw new GeneralError(VerifiableCredentialAuthenticationGenerator.CLASS_NAME, "missingNodeIdentity");
91
91
  }
92
92
  const ttlMs = this._tokenTtlInSeconds * 1000;
93
93
  const credential = await this._identityConnector.createVerifiableCredential(this._nodeIdentity, DocumentHelper.joinId(this._nodeIdentity, this._verificationMethodId), undefined, authData, {
@@ -104,7 +104,7 @@ class VerifiableCredentialAuthenticationProcessor {
104
104
  /**
105
105
  * Runtime name for the class.
106
106
  */
107
- CLASS_NAME = "VerifiableCredentialAuthenticationProcessor";
107
+ static CLASS_NAME = "VerifiableCredentialAuthenticationProcessor";
108
108
  /**
109
109
  * Connector for identity operations.
110
110
  * @internal
@@ -150,17 +150,17 @@ class VerifiableCredentialAuthenticationProcessor {
150
150
  const result = await this._identityConnector.checkVerifiableCredential(token);
151
151
  const verifiableCredential = result.verifiableCredential;
152
152
  if (Is.empty(verifiableCredential)) {
153
- throw new GeneralError(this.CLASS_NAME, "tokenNoCredential");
153
+ throw new GeneralError(VerifiableCredentialAuthenticationProcessor.CLASS_NAME, "tokenNoCredential");
154
154
  }
155
155
  const issuer = Is.stringValue(verifiableCredential.issuer)
156
156
  ? verifiableCredential.issuer
157
157
  : undefined;
158
158
  if (Is.empty(issuer)) {
159
- throw new GeneralError(this.CLASS_NAME, "tokenNoIssuer");
159
+ throw new GeneralError(VerifiableCredentialAuthenticationProcessor.CLASS_NAME, "tokenNoIssuer");
160
160
  }
161
161
  const issuanceDate = VerifiableCredentialHelper.getValidFrom(verifiableCredential);
162
162
  if (Is.empty(issuanceDate)) {
163
- throw new GeneralError(this.CLASS_NAME, "tokenMissingIssuanceDate", {
163
+ throw new GeneralError(VerifiableCredentialAuthenticationProcessor.CLASS_NAME, "tokenMissingIssuanceDate", {
164
164
  issuer
165
165
  });
166
166
  }
@@ -169,13 +169,13 @@ class VerifiableCredentialAuthenticationProcessor {
169
169
  const tokenTtlInMs = this._tokenTtlInSeconds * 1000;
170
170
  // If the token has expired then we should reject it
171
171
  if (tokenCreated.getTime() + tokenTtlInMs < now) {
172
- throw new GeneralError(this.CLASS_NAME, "tokenExpired", {
172
+ throw new GeneralError(VerifiableCredentialAuthenticationProcessor.CLASS_NAME, "tokenExpired", {
173
173
  issuer
174
174
  });
175
175
  }
176
176
  const subject = verifiableCredential.credentialSubject;
177
177
  if (Is.empty(subject)) {
178
- throw new GeneralError(this.CLASS_NAME, "tokenMissingSubject", {
178
+ throw new GeneralError(VerifiableCredentialAuthenticationProcessor.CLASS_NAME, "tokenMissingSubject", {
179
179
  issuer
180
180
  });
181
181
  }
@@ -185,7 +185,7 @@ class VerifiableCredentialAuthenticationProcessor {
185
185
  }
186
186
  }
187
187
  catch (err) {
188
- throw new GeneralError(this.CLASS_NAME, "tokenFailed", undefined, err);
188
+ throw new GeneralError(VerifiableCredentialAuthenticationProcessor.CLASS_NAME, "tokenFailed", undefined, err);
189
189
  }
190
190
  }
191
191
  }
@@ -9,7 +9,7 @@ export declare class VerifiableCredentialAuthenticationGenerator implements IAut
9
9
  /**
10
10
  * Runtime name for the class.
11
11
  */
12
- readonly CLASS_NAME: string;
12
+ static readonly CLASS_NAME: string;
13
13
  /**
14
14
  * Create a new instance of VerifiableCredentialAuthenticationGenerator.
15
15
  * @param options The options for the service.
@@ -7,7 +7,7 @@ export declare class VerifiableCredentialAuthenticationProcessor implements IBas
7
7
  /**
8
8
  * Runtime name for the class.
9
9
  */
10
- readonly CLASS_NAME: string;
10
+ static readonly CLASS_NAME: string;
11
11
  /**
12
12
  * Create a new instance of AuthCookiePreProcessor.
13
13
  * @param options Options for the processor.
package/docs/changelog.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.2-next.9](https://github.com/twinfoundation/identity/compare/identity-authentication-v0.0.2-next.8...identity-authentication-v0.0.2-next.9) (2025-10-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * add validate-locales ([04d74b4](https://github.com/twinfoundation/identity/commit/04d74b4d1ebe42672e8ca75a7bdb8e3556afd0be))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/identity-models bumped from 0.0.2-next.8 to 0.0.2-next.9
16
+ * devDependencies
17
+ * @twin.org/identity-connector-entity-storage bumped from 0.0.2-next.8 to 0.0.2-next.9
18
+
3
19
  ## [0.0.2-next.8](https://github.com/twinfoundation/identity/compare/identity-authentication-v0.0.2-next.7...identity-authentication-v0.0.2-next.8) (2025-09-25)
4
20
 
5
21
 
@@ -30,14 +30,10 @@ The options for the service.
30
30
 
31
31
  ### CLASS\_NAME
32
32
 
33
- > `readonly` **CLASS\_NAME**: `string`
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
35
35
  Runtime name for the class.
36
36
 
37
- #### Implementation of
38
-
39
- `IAuthenticationGenerator.CLASS_NAME`
40
-
41
37
  ## Methods
42
38
 
43
39
  ### start()
@@ -30,14 +30,10 @@ Options for the processor.
30
30
 
31
31
  ### CLASS\_NAME
32
32
 
33
- > `readonly` **CLASS\_NAME**: `string`
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
35
35
  Runtime name for the class.
36
36
 
37
- #### Implementation of
38
-
39
- `IBaseRouteProcessor.CLASS_NAME`
40
-
41
37
  ## Methods
42
38
 
43
39
  ### features()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-authentication",
3
- "version": "0.0.2-next.8",
3
+ "version": "0.0.2-next.9",
4
4
  "description": "Authentication components implemented using identity",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  "@twin.org/core": "next",
19
19
  "@twin.org/crypto": "next",
20
20
  "@twin.org/data-json-ld": "next",
21
- "@twin.org/identity-models": "0.0.2-next.8",
21
+ "@twin.org/identity-models": "0.0.2-next.9",
22
22
  "@twin.org/standards-w3c-did": "next",
23
23
  "@twin.org/web": "next"
24
24
  },
@@ -39,5 +39,20 @@
39
39
  "dist/types",
40
40
  "locales",
41
41
  "docs"
42
- ]
42
+ ],
43
+ "keywords": [
44
+ "twin",
45
+ "trade",
46
+ "iota",
47
+ "framework",
48
+ "blockchain",
49
+ "identity",
50
+ "did",
51
+ "credentials",
52
+ "authentication"
53
+ ],
54
+ "bugs": {
55
+ "url": "git+https://github.com/twinfoundation/identity/issues"
56
+ },
57
+ "homepage": "https://twindev.org"
43
58
  }