@twin.org/trust-service 0.0.3-next.11 → 0.0.3-next.12
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/README.md +1 -1
- package/docs/changelog.md +35 -21
- package/docs/examples.md +69 -1
- package/docs/reference/classes/TrustService.md +4 -4
- package/docs/reference/interfaces/ITrustServiceConfig.md +2 -2
- package/docs/reference/interfaces/ITrustServiceConstructorOptions.md +4 -4
- package/package.json +5 -5
package/README.md
CHANGED
package/docs/changelog.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.0.3-next.
|
|
3
|
+
## [0.0.3-next.12](https://github.com/iotaledger/twin-trust/compare/trust-service-v0.0.3-next.11...trust-service-v0.0.3-next.12) (2026-05-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* typescript 6 update ([a232da2](https://github.com/iotaledger/twin-trust/commit/a232da293afbd3b42843e187e4952dabd7917397))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/trust-models bumped from 0.0.3-next.11 to 0.0.3-next.12
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.11](https://github.com/iotaledger/twin-trust/compare/trust-service-v0.0.3-next.10...trust-service-v0.0.3-next.11) (2026-03-04)
|
|
4
18
|
|
|
5
19
|
|
|
6
20
|
### Miscellaneous Chores
|
|
@@ -14,7 +28,7 @@
|
|
|
14
28
|
* dependencies
|
|
15
29
|
* @twin.org/trust-models bumped from 0.0.3-next.10 to 0.0.3-next.11
|
|
16
30
|
|
|
17
|
-
## [0.0.3-next.10](https://github.com/
|
|
31
|
+
## [0.0.3-next.10](https://github.com/iotaledger/twin-trust/compare/trust-service-v0.0.3-next.9...trust-service-v0.0.3-next.10) (2026-02-27)
|
|
18
32
|
|
|
19
33
|
|
|
20
34
|
### Miscellaneous Chores
|
|
@@ -28,12 +42,12 @@
|
|
|
28
42
|
* dependencies
|
|
29
43
|
* @twin.org/trust-models bumped from 0.0.3-next.9 to 0.0.3-next.10
|
|
30
44
|
|
|
31
|
-
## [0.0.3-next.9](https://github.com/
|
|
45
|
+
## [0.0.3-next.9](https://github.com/iotaledger/twin-trust/compare/trust-service-v0.0.3-next.8...trust-service-v0.0.3-next.9) (2026-02-26)
|
|
32
46
|
|
|
33
47
|
|
|
34
48
|
### Features
|
|
35
49
|
|
|
36
|
-
* error if no verifiers registered ([aa1cef6](https://github.com/
|
|
50
|
+
* error if no verifiers registered ([aa1cef6](https://github.com/iotaledger/twin-trust/commit/aa1cef6a130b008144073696077fd0a41d4bc533))
|
|
37
51
|
|
|
38
52
|
|
|
39
53
|
### Dependencies
|
|
@@ -42,12 +56,12 @@
|
|
|
42
56
|
* dependencies
|
|
43
57
|
* @twin.org/trust-models bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
44
58
|
|
|
45
|
-
## [0.0.3-next.8](https://github.com/
|
|
59
|
+
## [0.0.3-next.8](https://github.com/iotaledger/twin-trust/compare/trust-service-v0.0.3-next.7...trust-service-v0.0.3-next.8) (2026-01-30)
|
|
46
60
|
|
|
47
61
|
|
|
48
62
|
### Features
|
|
49
63
|
|
|
50
|
-
* verification info structure ([#10](https://github.com/
|
|
64
|
+
* verification info structure ([#10](https://github.com/iotaledger/twin-trust/issues/10)) ([8b09ec8](https://github.com/iotaledger/twin-trust/commit/8b09ec8128214b659f427fc3a985eb8ced9ed5dc))
|
|
51
65
|
|
|
52
66
|
|
|
53
67
|
### Dependencies
|
|
@@ -56,7 +70,7 @@
|
|
|
56
70
|
* dependencies
|
|
57
71
|
* @twin.org/trust-models bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
58
72
|
|
|
59
|
-
## [0.0.3-next.7](https://github.com/
|
|
73
|
+
## [0.0.3-next.7](https://github.com/iotaledger/twin-trust/compare/trust-service-v0.0.3-next.6...trust-service-v0.0.3-next.7) (2025-12-04)
|
|
60
74
|
|
|
61
75
|
|
|
62
76
|
### Miscellaneous Chores
|
|
@@ -70,12 +84,12 @@
|
|
|
70
84
|
* dependencies
|
|
71
85
|
* @twin.org/trust-models bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
72
86
|
|
|
73
|
-
## [0.0.3-next.6](https://github.com/
|
|
87
|
+
## [0.0.3-next.6](https://github.com/iotaledger/twin-trust/compare/trust-service-v0.0.3-next.5...trust-service-v0.0.3-next.6) (2025-12-04)
|
|
74
88
|
|
|
75
89
|
|
|
76
90
|
### Features
|
|
77
91
|
|
|
78
|
-
* always include identity in verification info ([9594d19](https://github.com/
|
|
92
|
+
* always include identity in verification info ([9594d19](https://github.com/iotaledger/twin-trust/commit/9594d19e9d718bd42b82964750ae3bcfb7df51bf))
|
|
79
93
|
|
|
80
94
|
|
|
81
95
|
### Dependencies
|
|
@@ -84,12 +98,12 @@
|
|
|
84
98
|
* dependencies
|
|
85
99
|
* @twin.org/trust-models bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
86
100
|
|
|
87
|
-
## [0.0.3-next.5](https://github.com/
|
|
101
|
+
## [0.0.3-next.5](https://github.com/iotaledger/twin-trust/compare/trust-service-v0.0.3-next.4...trust-service-v0.0.3-next.5) (2025-12-04)
|
|
88
102
|
|
|
89
103
|
|
|
90
104
|
### Features
|
|
91
105
|
|
|
92
|
-
* add default generator config ([54d98ba](https://github.com/
|
|
106
|
+
* add default generator config ([54d98ba](https://github.com/iotaledger/twin-trust/commit/54d98ba53b7450b56337daeda504437be0d21943))
|
|
93
107
|
|
|
94
108
|
|
|
95
109
|
### Dependencies
|
|
@@ -98,12 +112,12 @@
|
|
|
98
112
|
* dependencies
|
|
99
113
|
* @twin.org/trust-models bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
100
114
|
|
|
101
|
-
## [0.0.3-next.4](https://github.com/
|
|
115
|
+
## [0.0.3-next.4](https://github.com/iotaledger/twin-trust/compare/trust-service-v0.0.3-next.3...trust-service-v0.0.3-next.4) (2025-12-04)
|
|
102
116
|
|
|
103
117
|
|
|
104
118
|
### Features
|
|
105
119
|
|
|
106
|
-
* add generators ([6228c88](https://github.com/
|
|
120
|
+
* add generators ([6228c88](https://github.com/iotaledger/twin-trust/commit/6228c88a8f0244b7bdfc76b8624c427c81d23f7b))
|
|
107
121
|
|
|
108
122
|
|
|
109
123
|
### Dependencies
|
|
@@ -112,12 +126,12 @@
|
|
|
112
126
|
* dependencies
|
|
113
127
|
* @twin.org/trust-models bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
114
128
|
|
|
115
|
-
## [0.0.3-next.3](https://github.com/
|
|
129
|
+
## [0.0.3-next.3](https://github.com/iotaledger/twin-trust/compare/trust-service-v0.0.3-next.2...trust-service-v0.0.3-next.3) (2025-12-04)
|
|
116
130
|
|
|
117
131
|
|
|
118
132
|
### Features
|
|
119
133
|
|
|
120
|
-
* flatten error structure ([5fdd665](https://github.com/
|
|
134
|
+
* flatten error structure ([5fdd665](https://github.com/iotaledger/twin-trust/commit/5fdd665d0fc523a655563a0c20d1d82b634534e2))
|
|
121
135
|
|
|
122
136
|
|
|
123
137
|
### Dependencies
|
|
@@ -126,12 +140,12 @@
|
|
|
126
140
|
* dependencies
|
|
127
141
|
* @twin.org/trust-models bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
128
142
|
|
|
129
|
-
## [0.0.3-next.2](https://github.com/
|
|
143
|
+
## [0.0.3-next.2](https://github.com/iotaledger/twin-trust/compare/trust-service-v0.0.3-next.1...trust-service-v0.0.3-next.2) (2025-12-03)
|
|
130
144
|
|
|
131
145
|
|
|
132
146
|
### Features
|
|
133
147
|
|
|
134
|
-
* support pass through of info between verifiers ([1ce64b9](https://github.com/
|
|
148
|
+
* support pass through of info between verifiers ([1ce64b9](https://github.com/iotaledger/twin-trust/commit/1ce64b97a949278b447cc12b576ce5de537f30f3))
|
|
135
149
|
|
|
136
150
|
|
|
137
151
|
### Dependencies
|
|
@@ -140,13 +154,13 @@
|
|
|
140
154
|
* dependencies
|
|
141
155
|
* @twin.org/trust-models bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
142
156
|
|
|
143
|
-
## [0.0.3-next.1](https://github.com/
|
|
157
|
+
## [0.0.3-next.1](https://github.com/iotaledger/twin-trust/compare/trust-service-v0.0.3-next.0...trust-service-v0.0.3-next.1) (2025-12-02)
|
|
144
158
|
|
|
145
159
|
|
|
146
160
|
### Features
|
|
147
161
|
|
|
148
|
-
* add verifier overrides ([bb16a35](https://github.com/
|
|
149
|
-
* initial commit ([d378ef4](https://github.com/
|
|
162
|
+
* add verifier overrides ([bb16a35](https://github.com/iotaledger/twin-trust/commit/bb16a35e0d6966e050cbdcc9e32a8c78839431d4))
|
|
163
|
+
* initial commit ([d378ef4](https://github.com/iotaledger/twin-trust/commit/d378ef4cd66c98fa188aaf3b23152d1e47d88a37))
|
|
150
164
|
|
|
151
165
|
|
|
152
166
|
### Dependencies
|
|
@@ -155,4 +169,4 @@
|
|
|
155
169
|
* dependencies
|
|
156
170
|
* @twin.org/trust-models bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
157
171
|
|
|
158
|
-
##
|
|
172
|
+
## Changelog
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,69 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Trust Service Examples
|
|
2
|
+
|
|
3
|
+
The following snippets show a practical end-to-end flow where generators and verifiers are registered once and reused for trust operations.
|
|
4
|
+
|
|
5
|
+
## TrustService
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { TrustService } from '@twin.org/trust-service';
|
|
9
|
+
import {
|
|
10
|
+
TrustGeneratorFactory,
|
|
11
|
+
TrustVerifierFactory,
|
|
12
|
+
type ITrustGenerator,
|
|
13
|
+
type ITrustVerifier
|
|
14
|
+
} from '@twin.org/trust-models';
|
|
15
|
+
import type { IError } from '@twin.org/core';
|
|
16
|
+
|
|
17
|
+
const generator: ITrustGenerator = {
|
|
18
|
+
className: () => 'JwtGenerator',
|
|
19
|
+
generate: async (identity, info) => ({
|
|
20
|
+
token: 'eyJhbGciOiJFZERTQSJ9.eyJpc3MiOiJkaWQ6ZXhhbXBsZTppc3N1ZXIifQ.signature',
|
|
21
|
+
identity,
|
|
22
|
+
subject: info?.subject
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const verifier: ITrustVerifier = {
|
|
27
|
+
className: () => 'JwtVerifier',
|
|
28
|
+
verify: async (payload, info, _errors) => {
|
|
29
|
+
const hasToken = typeof payload === 'object' && payload !== null && 'token' in payload;
|
|
30
|
+
if (!hasToken) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
info.identity = 'did:example:issuer';
|
|
35
|
+
info.data = {
|
|
36
|
+
subject: {
|
|
37
|
+
id: 'did:example:subject',
|
|
38
|
+
status: 'active'
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
TrustGeneratorFactory.register('jwt', () => generator);
|
|
46
|
+
TrustVerifierFactory.register('jwt', () => verifier);
|
|
47
|
+
|
|
48
|
+
const trustService = new TrustService({
|
|
49
|
+
config: {
|
|
50
|
+
defaultGeneratorType: 'jwt'
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
console.log(trustService.className()); // TrustService
|
|
55
|
+
|
|
56
|
+
const payload = await trustService.generate('did:example:issuer', 'jwt', {
|
|
57
|
+
subject: {
|
|
58
|
+
id: 'did:example:subject',
|
|
59
|
+
level: 'gold'
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
console.log(payload); // { token: "eyJhbGciOiJFZERTQSJ9.eyJpc3MiOiJkaWQ6ZXhhbXBsZTppc3N1ZXIifQ.signature", identity: "did:example:issuer", subject: { id: "did:example:subject", level: "gold" } }
|
|
64
|
+
|
|
65
|
+
const verification = await trustService.verify(payload, ['jwt']);
|
|
66
|
+
|
|
67
|
+
console.log(verification.verified); // true
|
|
68
|
+
console.log(verification.info?.identity); // did:example:issuer
|
|
69
|
+
```
|
|
@@ -28,7 +28,7 @@ The options for the service.
|
|
|
28
28
|
|
|
29
29
|
## Properties
|
|
30
30
|
|
|
31
|
-
### CLASS\_NAME
|
|
31
|
+
### CLASS\_NAME {#class_name}
|
|
32
32
|
|
|
33
33
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ Runtime name for the class.
|
|
|
36
36
|
|
|
37
37
|
## Methods
|
|
38
38
|
|
|
39
|
-
### className()
|
|
39
|
+
### className() {#classname}
|
|
40
40
|
|
|
41
41
|
> **className**(): `string`
|
|
42
42
|
|
|
@@ -54,7 +54,7 @@ The class name of the component.
|
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
57
|
-
### verify()
|
|
57
|
+
### verify() {#verify}
|
|
58
58
|
|
|
59
59
|
> **verify**(`payload`, `overrideVerifiers?`): `Promise`\<\{ `verified`: `boolean`; `info?`: `ITrustVerificationInfo`; `errors?`: `IError`[]; \}\>
|
|
60
60
|
|
|
@@ -86,7 +86,7 @@ Whether the payload is verified and any additional information extracted from th
|
|
|
86
86
|
|
|
87
87
|
***
|
|
88
88
|
|
|
89
|
-
### generate()
|
|
89
|
+
### generate() {#generate}
|
|
90
90
|
|
|
91
91
|
> **generate**(`identity`, `generatorType?`, `info?`): `Promise`\<`unknown`\>
|
|
92
92
|
|
|
@@ -4,8 +4,8 @@ The options for the trust service.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### defaultGeneratorType?
|
|
7
|
+
### defaultGeneratorType? {#defaultgeneratortype}
|
|
8
8
|
|
|
9
|
-
> `optional` **defaultGeneratorType
|
|
9
|
+
> `optional` **defaultGeneratorType?**: `string`
|
|
10
10
|
|
|
11
11
|
The default generator type, uses first in factory if not specified.
|
|
@@ -4,9 +4,9 @@ The options for the trust service.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### loggingComponentType?
|
|
7
|
+
### loggingComponentType? {#loggingcomponenttype}
|
|
8
8
|
|
|
9
|
-
> `optional` **loggingComponentType
|
|
9
|
+
> `optional` **loggingComponentType?**: `string`
|
|
10
10
|
|
|
11
11
|
The logging component type.
|
|
12
12
|
|
|
@@ -18,8 +18,8 @@ logging
|
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
|
-
### config?
|
|
21
|
+
### config? {#config}
|
|
22
22
|
|
|
23
|
-
> `optional` **config
|
|
23
|
+
> `optional` **config?**: [`ITrustServiceConfig`](ITrustServiceConfig.md)
|
|
24
24
|
|
|
25
25
|
The trust service configuration.
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/trust-service",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.12",
|
|
4
|
+
"description": "Provides an orchestrating trust service that composes generators and verifiers into a unified API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/iotaledger/trust.git",
|
|
8
8
|
"directory": "packages/trust-service"
|
|
9
9
|
},
|
|
10
10
|
"author": "martyn.janes@iota.org",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@twin.org/core": "next",
|
|
18
18
|
"@twin.org/logging-models": "next",
|
|
19
19
|
"@twin.org/nameof": "next",
|
|
20
|
-
"@twin.org/trust-models": "0.0.3-next.
|
|
20
|
+
"@twin.org/trust-models": "0.0.3-next.12"
|
|
21
21
|
},
|
|
22
22
|
"main": "./dist/es/index.js",
|
|
23
23
|
"types": "./dist/types/index.d.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"business-logic"
|
|
49
49
|
],
|
|
50
50
|
"bugs": {
|
|
51
|
-
"url": "git+https://github.com/
|
|
51
|
+
"url": "git+https://github.com/iotaledger/trust/issues"
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://twindev.org"
|
|
54
54
|
}
|