@twin.org/identity-authentication 0.0.2-next.6
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/LICENSE +201 -0
- package/README.md +21 -0
- package/dist/cjs/index.cjs +198 -0
- package/dist/esm/index.mjs +193 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/models/IIdentityAuthenticationActionRequest.d.ts +23 -0
- package/dist/types/models/IVerifiableCredentialAuthenticationGeneratorConfig.d.ts +14 -0
- package/dist/types/models/IVerifiableCredentialAuthenticationGeneratorConstructorOptions.d.ts +20 -0
- package/dist/types/models/IVerifiableCredentialAuthenticationProcessorConfig.d.ts +10 -0
- package/dist/types/models/IVerifiableCredentialAuthenticationProcessorConstructorOptions.d.ts +20 -0
- package/dist/types/models/identityAuthenticationContexts.d.ts +13 -0
- package/dist/types/models/identityAuthenticationTypes.d.ts +13 -0
- package/dist/types/verifiableCredentialAuthenticationGenerator.d.ts +32 -0
- package/dist/types/verifiableCredentialAuthenticationProcessor.d.ts +35 -0
- package/docs/changelog.md +17 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/VerifiableCredentialAuthenticationGenerator.md +103 -0
- package/docs/reference/classes/VerifiableCredentialAuthenticationProcessor.md +107 -0
- package/docs/reference/index.md +24 -0
- package/docs/reference/interfaces/IIdentityAuthenticationActionRequest.md +35 -0
- package/docs/reference/interfaces/IVerifiableCredentialAuthenticationGeneratorConfig.md +25 -0
- package/docs/reference/interfaces/IVerifiableCredentialAuthenticationGeneratorConstructorOptions.md +39 -0
- package/docs/reference/interfaces/IVerifiableCredentialAuthenticationProcessorConfig.md +17 -0
- package/docs/reference/interfaces/IVerifiableCredentialAuthenticationProcessorConstructorOptions.md +39 -0
- package/docs/reference/type-aliases/IdentityAuthenticationContexts.md +5 -0
- package/docs/reference/type-aliases/IdentityAuthenticationTypes.md +5 -0
- package/docs/reference/variables/IdentityAuthenticationContexts.md +13 -0
- package/docs/reference/variables/IdentityAuthenticationTypes.md +13 -0
- package/locales/en.json +15 -0
- package/package.json +43 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IVerifiableCredentialAuthenticationGeneratorConfig } from "./IVerifiableCredentialAuthenticationGeneratorConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the verifiable credential authentication generator constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface IVerifiableCredentialAuthenticationGeneratorConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The type of identity connector to use.
|
|
8
|
+
* @default identity
|
|
9
|
+
*/
|
|
10
|
+
identityConnectorType?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The type of logging component to use.
|
|
13
|
+
* @default logging
|
|
14
|
+
*/
|
|
15
|
+
loggingComponentType?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The configuration for the verifiable credential authentication generator.
|
|
18
|
+
*/
|
|
19
|
+
config: IVerifiableCredentialAuthenticationGeneratorConfig;
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the Verifiable Credential Authentication Processor.
|
|
3
|
+
*/
|
|
4
|
+
export interface IVerifiableCredentialAuthenticationProcessorConfig {
|
|
5
|
+
/**
|
|
6
|
+
* The time-to-live (TTL) for token in seconds.
|
|
7
|
+
* @default 60 (1 minute)
|
|
8
|
+
*/
|
|
9
|
+
tokenTtlInSeconds?: number;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IVerifiableCredentialAuthenticationProcessorConfig } from "./IVerifiableCredentialAuthenticationProcessorConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the verifiable credential authentication processor constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface IVerifiableCredentialAuthenticationProcessorConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The type of identity connector to use.
|
|
8
|
+
* @default identity
|
|
9
|
+
*/
|
|
10
|
+
identityConnectorType?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The type of logging component to use.
|
|
13
|
+
* @default logging
|
|
14
|
+
*/
|
|
15
|
+
loggingComponentType?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The configuration for the verifiable credential authentication processor.
|
|
18
|
+
*/
|
|
19
|
+
config?: IVerifiableCredentialAuthenticationProcessorConfig;
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The LD Contexts concerning Identity Authentication.
|
|
3
|
+
*/
|
|
4
|
+
export declare const IdentityAuthenticationContexts: {
|
|
5
|
+
/**
|
|
6
|
+
* The Identity Authentication LD Context.
|
|
7
|
+
*/
|
|
8
|
+
readonly ContextRoot: "https://schema.twindev.org/identity-authentication";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The LD Contexts concerning Identity Authentication.
|
|
12
|
+
*/
|
|
13
|
+
export type IdentityAuthenticationContexts = (typeof IdentityAuthenticationContexts)[keyof typeof IdentityAuthenticationContexts];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The types of Identity Authentication data.
|
|
3
|
+
*/
|
|
4
|
+
export declare const IdentityAuthenticationTypes: {
|
|
5
|
+
/**
|
|
6
|
+
* Represents action request.
|
|
7
|
+
*/
|
|
8
|
+
readonly ActionRequest: "ActionRequest";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The types of Identity Authentication data.
|
|
12
|
+
*/
|
|
13
|
+
export type IdentityAuthenticationTypes = (typeof IdentityAuthenticationTypes)[keyof typeof IdentityAuthenticationTypes];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IAuthenticationGenerator } from "@twin.org/api-models";
|
|
2
|
+
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
3
|
+
import { type IHttpHeaders } from "@twin.org/web";
|
|
4
|
+
import type { IVerifiableCredentialAuthenticationGeneratorConstructorOptions } from "./models/IVerifiableCredentialAuthenticationGeneratorConstructorOptions";
|
|
5
|
+
/**
|
|
6
|
+
* Class performing verifiable credential authentication generation.
|
|
7
|
+
*/
|
|
8
|
+
export declare class VerifiableCredentialAuthenticationGenerator implements IAuthenticationGenerator {
|
|
9
|
+
/**
|
|
10
|
+
* Runtime name for the class.
|
|
11
|
+
*/
|
|
12
|
+
readonly CLASS_NAME: string;
|
|
13
|
+
/**
|
|
14
|
+
* Create a new instance of VerifiableCredentialAuthenticationGenerator.
|
|
15
|
+
* @param options The options for the service.
|
|
16
|
+
*/
|
|
17
|
+
constructor(options: IVerifiableCredentialAuthenticationGeneratorConstructorOptions);
|
|
18
|
+
/**
|
|
19
|
+
* The component needs to be started when the node is initialized.
|
|
20
|
+
* @param nodeIdentity The identity of the node starting the component.
|
|
21
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
22
|
+
* @returns Nothing.
|
|
23
|
+
*/
|
|
24
|
+
start(nodeIdentity: string, nodeLoggingComponentType: string | undefined): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Adds authentication information to the request headers.
|
|
27
|
+
* @param requestHeaders The request headers to add authentication information to.
|
|
28
|
+
* @param authData Optional authentication data passed from the request.
|
|
29
|
+
* @returns A promise that resolves when the authentication information has been added.
|
|
30
|
+
*/
|
|
31
|
+
addAuthentication(requestHeaders: IHttpHeaders, authData: IJsonLdNodeObject): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { IBaseRoute, IBaseRouteProcessor, IHttpRequestIdentity, IHttpResponse, IHttpServerRequest } from "@twin.org/api-models";
|
|
2
|
+
import type { IVerifiableCredentialAuthenticationProcessorConstructorOptions } from "./models/IVerifiableCredentialAuthenticationProcessorConstructorOptions";
|
|
3
|
+
/**
|
|
4
|
+
* Handle a JWT token in the authorization header and verify the credential.
|
|
5
|
+
*/
|
|
6
|
+
export declare class VerifiableCredentialAuthenticationProcessor implements IBaseRouteProcessor {
|
|
7
|
+
/**
|
|
8
|
+
* Runtime name for the class.
|
|
9
|
+
*/
|
|
10
|
+
readonly CLASS_NAME: string;
|
|
11
|
+
/**
|
|
12
|
+
* Create a new instance of AuthCookiePreProcessor.
|
|
13
|
+
* @param options Options for the processor.
|
|
14
|
+
*/
|
|
15
|
+
constructor(options?: IVerifiableCredentialAuthenticationProcessorConstructorOptions);
|
|
16
|
+
/**
|
|
17
|
+
* Features supported by this processor.
|
|
18
|
+
* If a route has any of these features listed, this processor will be run for that route.
|
|
19
|
+
* If this is not implemented, the processor will run for all routes.
|
|
20
|
+
* @returns The features supported by this processor.
|
|
21
|
+
*/
|
|
22
|
+
features(): string[];
|
|
23
|
+
/**
|
|
24
|
+
* Pre process the REST request for the specified route.
|
|
25
|
+
* @param request The incoming request.
|
|
26
|
+
* @param response The outgoing response.
|
|
27
|
+
* @param route The route to process.
|
|
28
|
+
* @param requestIdentity The identity context for the request.
|
|
29
|
+
* @param processorState The state handed through the processors.
|
|
30
|
+
* @returns Nothing
|
|
31
|
+
*/
|
|
32
|
+
pre(request: IHttpServerRequest, response: IHttpResponse, route: IBaseRoute | undefined, requestIdentity: IHttpRequestIdentity, processorState: {
|
|
33
|
+
[id: string]: unknown;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.2-next.6](https://github.com/twinfoundation/identity/compare/identity-authentication-v0.0.2-next.5...identity-authentication-v0.0.2-next.6) (2025-09-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add identity authentication module ([33fb5cc](https://github.com/twinfoundation/identity/commit/33fb5cc409ff11aba273b13c8d83724b0b0daa53))
|
|
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.5 to 0.0.2-next.6
|
|
16
|
+
|
|
17
|
+
## @twin.org/identity-authentication - Changelog
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @twin.org/identity-authentication - Examples
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Class: VerifiableCredentialAuthenticationGenerator
|
|
2
|
+
|
|
3
|
+
Class performing verifiable credential authentication generation.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IAuthenticationGenerator`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new VerifiableCredentialAuthenticationGenerator**(`options`): `VerifiableCredentialAuthenticationGenerator`
|
|
14
|
+
|
|
15
|
+
Create a new instance of VerifiableCredentialAuthenticationGenerator.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options
|
|
20
|
+
|
|
21
|
+
[`IVerifiableCredentialAuthenticationGeneratorConstructorOptions`](../interfaces/IVerifiableCredentialAuthenticationGeneratorConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
The options for the service.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`VerifiableCredentialAuthenticationGenerator`
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
### CLASS\_NAME
|
|
32
|
+
|
|
33
|
+
> `readonly` **CLASS\_NAME**: `string`
|
|
34
|
+
|
|
35
|
+
Runtime name for the class.
|
|
36
|
+
|
|
37
|
+
#### Implementation of
|
|
38
|
+
|
|
39
|
+
`IAuthenticationGenerator.CLASS_NAME`
|
|
40
|
+
|
|
41
|
+
## Methods
|
|
42
|
+
|
|
43
|
+
### start()
|
|
44
|
+
|
|
45
|
+
> **start**(`nodeIdentity`, `nodeLoggingComponentType`): `Promise`\<`void`\>
|
|
46
|
+
|
|
47
|
+
The component needs to be started when the node is initialized.
|
|
48
|
+
|
|
49
|
+
#### Parameters
|
|
50
|
+
|
|
51
|
+
##### nodeIdentity
|
|
52
|
+
|
|
53
|
+
`string`
|
|
54
|
+
|
|
55
|
+
The identity of the node starting the component.
|
|
56
|
+
|
|
57
|
+
##### nodeLoggingComponentType
|
|
58
|
+
|
|
59
|
+
The node logging component type.
|
|
60
|
+
|
|
61
|
+
`undefined` | `string`
|
|
62
|
+
|
|
63
|
+
#### Returns
|
|
64
|
+
|
|
65
|
+
`Promise`\<`void`\>
|
|
66
|
+
|
|
67
|
+
Nothing.
|
|
68
|
+
|
|
69
|
+
#### Implementation of
|
|
70
|
+
|
|
71
|
+
`IAuthenticationGenerator.start`
|
|
72
|
+
|
|
73
|
+
***
|
|
74
|
+
|
|
75
|
+
### addAuthentication()
|
|
76
|
+
|
|
77
|
+
> **addAuthentication**(`requestHeaders`, `authData`): `Promise`\<`void`\>
|
|
78
|
+
|
|
79
|
+
Adds authentication information to the request headers.
|
|
80
|
+
|
|
81
|
+
#### Parameters
|
|
82
|
+
|
|
83
|
+
##### requestHeaders
|
|
84
|
+
|
|
85
|
+
`IHttpHeaders`
|
|
86
|
+
|
|
87
|
+
The request headers to add authentication information to.
|
|
88
|
+
|
|
89
|
+
##### authData
|
|
90
|
+
|
|
91
|
+
`IJsonLdNodeObject`
|
|
92
|
+
|
|
93
|
+
Optional authentication data passed from the request.
|
|
94
|
+
|
|
95
|
+
#### Returns
|
|
96
|
+
|
|
97
|
+
`Promise`\<`void`\>
|
|
98
|
+
|
|
99
|
+
A promise that resolves when the authentication information has been added.
|
|
100
|
+
|
|
101
|
+
#### Implementation of
|
|
102
|
+
|
|
103
|
+
`IAuthenticationGenerator.addAuthentication`
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Class: VerifiableCredentialAuthenticationProcessor
|
|
2
|
+
|
|
3
|
+
Handle a JWT token in the authorization header and verify the credential.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IBaseRouteProcessor`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new VerifiableCredentialAuthenticationProcessor**(`options?`): `VerifiableCredentialAuthenticationProcessor`
|
|
14
|
+
|
|
15
|
+
Create a new instance of AuthCookiePreProcessor.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options?
|
|
20
|
+
|
|
21
|
+
[`IVerifiableCredentialAuthenticationProcessorConstructorOptions`](../interfaces/IVerifiableCredentialAuthenticationProcessorConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
Options for the processor.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`VerifiableCredentialAuthenticationProcessor`
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
### CLASS\_NAME
|
|
32
|
+
|
|
33
|
+
> `readonly` **CLASS\_NAME**: `string`
|
|
34
|
+
|
|
35
|
+
Runtime name for the class.
|
|
36
|
+
|
|
37
|
+
#### Implementation of
|
|
38
|
+
|
|
39
|
+
`IBaseRouteProcessor.CLASS_NAME`
|
|
40
|
+
|
|
41
|
+
## Methods
|
|
42
|
+
|
|
43
|
+
### features()
|
|
44
|
+
|
|
45
|
+
> **features**(): `string`[]
|
|
46
|
+
|
|
47
|
+
Features supported by this processor.
|
|
48
|
+
If a route has any of these features listed, this processor will be run for that route.
|
|
49
|
+
If this is not implemented, the processor will run for all routes.
|
|
50
|
+
|
|
51
|
+
#### Returns
|
|
52
|
+
|
|
53
|
+
`string`[]
|
|
54
|
+
|
|
55
|
+
The features supported by this processor.
|
|
56
|
+
|
|
57
|
+
#### Implementation of
|
|
58
|
+
|
|
59
|
+
`IBaseRouteProcessor.features`
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### pre()
|
|
64
|
+
|
|
65
|
+
> **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\>
|
|
66
|
+
|
|
67
|
+
Pre process the REST request for the specified route.
|
|
68
|
+
|
|
69
|
+
#### Parameters
|
|
70
|
+
|
|
71
|
+
##### request
|
|
72
|
+
|
|
73
|
+
`IHttpServerRequest`
|
|
74
|
+
|
|
75
|
+
The incoming request.
|
|
76
|
+
|
|
77
|
+
##### response
|
|
78
|
+
|
|
79
|
+
`IHttpResponse`
|
|
80
|
+
|
|
81
|
+
The outgoing response.
|
|
82
|
+
|
|
83
|
+
##### route
|
|
84
|
+
|
|
85
|
+
The route to process.
|
|
86
|
+
|
|
87
|
+
`undefined` | `IBaseRoute`
|
|
88
|
+
|
|
89
|
+
##### requestIdentity
|
|
90
|
+
|
|
91
|
+
`IHttpRequestIdentity`
|
|
92
|
+
|
|
93
|
+
The identity context for the request.
|
|
94
|
+
|
|
95
|
+
##### processorState
|
|
96
|
+
|
|
97
|
+
The state handed through the processors.
|
|
98
|
+
|
|
99
|
+
#### Returns
|
|
100
|
+
|
|
101
|
+
`Promise`\<`void`\>
|
|
102
|
+
|
|
103
|
+
Nothing
|
|
104
|
+
|
|
105
|
+
#### Implementation of
|
|
106
|
+
|
|
107
|
+
`IBaseRouteProcessor.pre`
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @twin.org/identity-authentication
|
|
2
|
+
|
|
3
|
+
## Classes
|
|
4
|
+
|
|
5
|
+
- [VerifiableCredentialAuthenticationGenerator](classes/VerifiableCredentialAuthenticationGenerator.md)
|
|
6
|
+
- [VerifiableCredentialAuthenticationProcessor](classes/VerifiableCredentialAuthenticationProcessor.md)
|
|
7
|
+
|
|
8
|
+
## Interfaces
|
|
9
|
+
|
|
10
|
+
- [IIdentityAuthenticationActionRequest](interfaces/IIdentityAuthenticationActionRequest.md)
|
|
11
|
+
- [IVerifiableCredentialAuthenticationGeneratorConfig](interfaces/IVerifiableCredentialAuthenticationGeneratorConfig.md)
|
|
12
|
+
- [IVerifiableCredentialAuthenticationGeneratorConstructorOptions](interfaces/IVerifiableCredentialAuthenticationGeneratorConstructorOptions.md)
|
|
13
|
+
- [IVerifiableCredentialAuthenticationProcessorConfig](interfaces/IVerifiableCredentialAuthenticationProcessorConfig.md)
|
|
14
|
+
- [IVerifiableCredentialAuthenticationProcessorConstructorOptions](interfaces/IVerifiableCredentialAuthenticationProcessorConstructorOptions.md)
|
|
15
|
+
|
|
16
|
+
## Type Aliases
|
|
17
|
+
|
|
18
|
+
- [IdentityAuthenticationContexts](type-aliases/IdentityAuthenticationContexts.md)
|
|
19
|
+
- [IdentityAuthenticationTypes](type-aliases/IdentityAuthenticationTypes.md)
|
|
20
|
+
|
|
21
|
+
## Variables
|
|
22
|
+
|
|
23
|
+
- [IdentityAuthenticationContexts](variables/IdentityAuthenticationContexts.md)
|
|
24
|
+
- [IdentityAuthenticationTypes](variables/IdentityAuthenticationTypes.md)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Interface: IIdentityAuthenticationActionRequest
|
|
2
|
+
|
|
3
|
+
The JSON-LD definition for a action request.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### @context
|
|
8
|
+
|
|
9
|
+
> **@context**: `"https://schema.twindev.org/identity-authentication"`
|
|
10
|
+
|
|
11
|
+
The JSON-LD context.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### type
|
|
16
|
+
|
|
17
|
+
> **type**: `"ActionRequest"`
|
|
18
|
+
|
|
19
|
+
The type of the request.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### nodeIdentity
|
|
24
|
+
|
|
25
|
+
> **nodeIdentity**: `string`
|
|
26
|
+
|
|
27
|
+
The node identity.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### action
|
|
32
|
+
|
|
33
|
+
> **action**: `string`
|
|
34
|
+
|
|
35
|
+
The action.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Interface: IVerifiableCredentialAuthenticationGeneratorConfig
|
|
2
|
+
|
|
3
|
+
Configuration for the Verifiable Credential Authentication Generator.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### tokenTtlInSeconds?
|
|
8
|
+
|
|
9
|
+
> `optional` **tokenTtlInSeconds**: `number`
|
|
10
|
+
|
|
11
|
+
The time-to-live (TTL) for token in seconds.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
60 (1 minute)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### verificationMethodId
|
|
22
|
+
|
|
23
|
+
> **verificationMethodId**: `string`
|
|
24
|
+
|
|
25
|
+
The id of the identity method to use when creating/verifying tokens.
|
package/docs/reference/interfaces/IVerifiableCredentialAuthenticationGeneratorConstructorOptions.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Interface: IVerifiableCredentialAuthenticationGeneratorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the verifiable credential authentication generator constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### identityConnectorType?
|
|
8
|
+
|
|
9
|
+
> `optional` **identityConnectorType**: `string`
|
|
10
|
+
|
|
11
|
+
The type of identity connector to use.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
identity
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### loggingComponentType?
|
|
22
|
+
|
|
23
|
+
> `optional` **loggingComponentType**: `string`
|
|
24
|
+
|
|
25
|
+
The type of logging component to use.
|
|
26
|
+
|
|
27
|
+
#### Default
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
logging
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
***
|
|
34
|
+
|
|
35
|
+
### config
|
|
36
|
+
|
|
37
|
+
> **config**: [`IVerifiableCredentialAuthenticationGeneratorConfig`](IVerifiableCredentialAuthenticationGeneratorConfig.md)
|
|
38
|
+
|
|
39
|
+
The configuration for the verifiable credential authentication generator.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: IVerifiableCredentialAuthenticationProcessorConfig
|
|
2
|
+
|
|
3
|
+
Configuration for the Verifiable Credential Authentication Processor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### tokenTtlInSeconds?
|
|
8
|
+
|
|
9
|
+
> `optional` **tokenTtlInSeconds**: `number`
|
|
10
|
+
|
|
11
|
+
The time-to-live (TTL) for token in seconds.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
60 (1 minute)
|
|
17
|
+
```
|
package/docs/reference/interfaces/IVerifiableCredentialAuthenticationProcessorConstructorOptions.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Interface: IVerifiableCredentialAuthenticationProcessorConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the verifiable credential authentication processor constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### identityConnectorType?
|
|
8
|
+
|
|
9
|
+
> `optional` **identityConnectorType**: `string`
|
|
10
|
+
|
|
11
|
+
The type of identity connector to use.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
identity
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### loggingComponentType?
|
|
22
|
+
|
|
23
|
+
> `optional` **loggingComponentType**: `string`
|
|
24
|
+
|
|
25
|
+
The type of logging component to use.
|
|
26
|
+
|
|
27
|
+
#### Default
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
logging
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
***
|
|
34
|
+
|
|
35
|
+
### config?
|
|
36
|
+
|
|
37
|
+
> `optional` **config**: [`IVerifiableCredentialAuthenticationProcessorConfig`](IVerifiableCredentialAuthenticationProcessorConfig.md)
|
|
38
|
+
|
|
39
|
+
The configuration for the verifiable credential authentication processor.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Type Alias: IdentityAuthenticationContexts
|
|
2
|
+
|
|
3
|
+
> **IdentityAuthenticationContexts** = *typeof* [`IdentityAuthenticationContexts`](../variables/IdentityAuthenticationContexts.md)\[keyof *typeof* [`IdentityAuthenticationContexts`](../variables/IdentityAuthenticationContexts.md)\]
|
|
4
|
+
|
|
5
|
+
The LD Contexts concerning Identity Authentication.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Type Alias: IdentityAuthenticationTypes
|
|
2
|
+
|
|
3
|
+
> **IdentityAuthenticationTypes** = *typeof* [`IdentityAuthenticationTypes`](../variables/IdentityAuthenticationTypes.md)\[keyof *typeof* [`IdentityAuthenticationTypes`](../variables/IdentityAuthenticationTypes.md)\]
|
|
4
|
+
|
|
5
|
+
The types of Identity Authentication data.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Variable: IdentityAuthenticationContexts
|
|
2
|
+
|
|
3
|
+
> `const` **IdentityAuthenticationContexts**: `object`
|
|
4
|
+
|
|
5
|
+
The LD Contexts concerning Identity Authentication.
|
|
6
|
+
|
|
7
|
+
## Type Declaration
|
|
8
|
+
|
|
9
|
+
### ContextRoot
|
|
10
|
+
|
|
11
|
+
> `readonly` **ContextRoot**: `"https://schema.twindev.org/identity-authentication"` = `"https://schema.twindev.org/identity-authentication"`
|
|
12
|
+
|
|
13
|
+
The Identity Authentication LD Context.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Variable: IdentityAuthenticationTypes
|
|
2
|
+
|
|
3
|
+
> `const` **IdentityAuthenticationTypes**: `object`
|
|
4
|
+
|
|
5
|
+
The types of Identity Authentication data.
|
|
6
|
+
|
|
7
|
+
## Type Declaration
|
|
8
|
+
|
|
9
|
+
### ActionRequest
|
|
10
|
+
|
|
11
|
+
> `readonly` **ActionRequest**: `"ActionRequest"` = `"ActionRequest"`
|
|
12
|
+
|
|
13
|
+
Represents action request.
|
package/locales/en.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"error": {
|
|
3
|
+
"verifiableCredentialAuthenticationGenerator": {
|
|
4
|
+
"missingNodeIdentity": "The authenticator can not generate a token without a node identity"
|
|
5
|
+
},
|
|
6
|
+
"verifiableCredentialAuthenticationProcessor": {
|
|
7
|
+
"tokenFailed": "Failed to verify token",
|
|
8
|
+
"tokenNoCredential": "The token does not contain a verifiable credential",
|
|
9
|
+
"tokenNoIssuer": "The token does not contain an issuer",
|
|
10
|
+
"tokenMissingIssuanceDate": "The token is missing the 'issuanceDate' field for issuer \"{issuer}\"",
|
|
11
|
+
"tokenExpired": "The token has expired for issuer \"{issuer}\"",
|
|
12
|
+
"tokenMissingSubject": "The token is missing the 'credentialSubject' field for issuer \"{issuer}\""
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@twin.org/identity-authentication",
|
|
3
|
+
"version": "0.0.2-next.6",
|
|
4
|
+
"description": "Authentication components implemented using identity",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/twinfoundation/identity.git",
|
|
8
|
+
"directory": "packages/identity-authentication"
|
|
9
|
+
},
|
|
10
|
+
"author": "martyn.janes@iota.org",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@twin.org/api-models": "next",
|
|
18
|
+
"@twin.org/core": "next",
|
|
19
|
+
"@twin.org/crypto": "next",
|
|
20
|
+
"@twin.org/data-json-ld": "next",
|
|
21
|
+
"@twin.org/identity-models": "0.0.2-next.6",
|
|
22
|
+
"@twin.org/standards-w3c-did": "next",
|
|
23
|
+
"@twin.org/web": "next"
|
|
24
|
+
},
|
|
25
|
+
"main": "./dist/cjs/index.cjs",
|
|
26
|
+
"module": "./dist/esm/index.mjs",
|
|
27
|
+
"types": "./dist/types/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/types/index.d.ts",
|
|
31
|
+
"require": "./dist/cjs/index.cjs",
|
|
32
|
+
"import": "./dist/esm/index.mjs"
|
|
33
|
+
},
|
|
34
|
+
"./locales/*.json": "./locales/*.json"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist/cjs",
|
|
38
|
+
"dist/esm",
|
|
39
|
+
"dist/types",
|
|
40
|
+
"locales",
|
|
41
|
+
"docs"
|
|
42
|
+
]
|
|
43
|
+
}
|