@twin.org/immutable-proof-service 0.0.1-next.13 → 0.0.1-next.15
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/dist/cjs/index.cjs +77 -74
- package/dist/esm/index.mjs +79 -76
- package/dist/types/immutableProofService.d.ts +2 -15
- package/dist/types/index.d.ts +2 -1
- package/dist/types/models/IImmutableProofServiceConstructorOptions.d.ts +39 -0
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/ImmutableProofService.md +24 -32
- package/docs/reference/functions/generateRestRoutesImmutableProof.md +6 -2
- package/docs/reference/functions/immutableProofCreate.md +9 -3
- package/docs/reference/functions/immutableProofGet.md +9 -3
- package/docs/reference/functions/immutableProofVerify.md +9 -3
- package/docs/reference/index.md +1 -0
- package/docs/reference/interfaces/IImmutableProofServiceConstructorOptions.md +89 -0
- package/package.json +5 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var entity = require('@twin.org/entity');
|
|
3
4
|
var core = require('@twin.org/core');
|
|
4
5
|
var immutableProofModels = require('@twin.org/immutable-proof-models');
|
|
5
6
|
var standardsW3cDid = require('@twin.org/standards-w3c-did');
|
|
@@ -11,7 +12,73 @@ var entityStorageModels = require('@twin.org/entity-storage-models');
|
|
|
11
12
|
var identityModels = require('@twin.org/identity-models');
|
|
12
13
|
var immutableStorageModels = require('@twin.org/immutable-storage-models');
|
|
13
14
|
var vaultModels = require('@twin.org/vault-models');
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
// Copyright 2024 IOTA Stiftung.
|
|
17
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
18
|
+
/**
|
|
19
|
+
* Class describing the immutable proof.
|
|
20
|
+
*/
|
|
21
|
+
exports.ImmutableProof = class ImmutableProof {
|
|
22
|
+
/**
|
|
23
|
+
* The id of the proof.
|
|
24
|
+
*/
|
|
25
|
+
id;
|
|
26
|
+
/**
|
|
27
|
+
* The identity of the node which controls the proof.
|
|
28
|
+
*/
|
|
29
|
+
nodeIdentity;
|
|
30
|
+
/**
|
|
31
|
+
* The identity of the user which created the proof.
|
|
32
|
+
*/
|
|
33
|
+
userIdentity;
|
|
34
|
+
/**
|
|
35
|
+
* The date/time of when the proof was created.
|
|
36
|
+
*/
|
|
37
|
+
dateCreated;
|
|
38
|
+
/**
|
|
39
|
+
* The associated id for the item.
|
|
40
|
+
*/
|
|
41
|
+
proofObjectId;
|
|
42
|
+
/**
|
|
43
|
+
* The associated hash for the item.
|
|
44
|
+
*/
|
|
45
|
+
proofObjectHash;
|
|
46
|
+
/**
|
|
47
|
+
* The immutable storage id.
|
|
48
|
+
*/
|
|
49
|
+
immutableStorageId;
|
|
50
|
+
};
|
|
51
|
+
__decorate([
|
|
52
|
+
entity.property({ type: "string", isPrimary: true }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], exports.ImmutableProof.prototype, "id", undefined);
|
|
55
|
+
__decorate([
|
|
56
|
+
entity.property({ type: "string" }),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], exports.ImmutableProof.prototype, "nodeIdentity", undefined);
|
|
59
|
+
__decorate([
|
|
60
|
+
entity.property({ type: "string" }),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], exports.ImmutableProof.prototype, "userIdentity", undefined);
|
|
63
|
+
__decorate([
|
|
64
|
+
entity.property({ type: "string", format: "date-time", sortDirection: entity.SortDirection.Descending }),
|
|
65
|
+
__metadata("design:type", String)
|
|
66
|
+
], exports.ImmutableProof.prototype, "dateCreated", undefined);
|
|
67
|
+
__decorate([
|
|
68
|
+
entity.property({ type: "string" }),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], exports.ImmutableProof.prototype, "proofObjectId", undefined);
|
|
71
|
+
__decorate([
|
|
72
|
+
entity.property({ type: "string" }),
|
|
73
|
+
__metadata("design:type", String)
|
|
74
|
+
], exports.ImmutableProof.prototype, "proofObjectHash", undefined);
|
|
75
|
+
__decorate([
|
|
76
|
+
entity.property({ type: "string" }),
|
|
77
|
+
__metadata("design:type", String)
|
|
78
|
+
], exports.ImmutableProof.prototype, "immutableStorageId", undefined);
|
|
79
|
+
exports.ImmutableProof = __decorate([
|
|
80
|
+
entity.entity()
|
|
81
|
+
], exports.ImmutableProof);
|
|
15
82
|
|
|
16
83
|
/**
|
|
17
84
|
* The source used when communicating about these routes.
|
|
@@ -327,6 +394,11 @@ class ImmutableProofService {
|
|
|
327
394
|
* @internal
|
|
328
395
|
*/
|
|
329
396
|
_backgroundTaskConnector;
|
|
397
|
+
/**
|
|
398
|
+
* The event bus component.
|
|
399
|
+
* @internal
|
|
400
|
+
*/
|
|
401
|
+
_eventBusComponent;
|
|
330
402
|
/**
|
|
331
403
|
* The assertion method id to use for the proofs.
|
|
332
404
|
* @internal
|
|
@@ -345,12 +417,6 @@ class ImmutableProofService {
|
|
|
345
417
|
/**
|
|
346
418
|
* Create a new instance of ImmutableProofService.
|
|
347
419
|
* @param options The dependencies for the immutable proof connector.
|
|
348
|
-
* @param options.config The configuration for the connector.
|
|
349
|
-
* @param options.vaultConnectorType The vault connector type, defaults to "vault".
|
|
350
|
-
* @param options.immutableProofEntityStorageType The entity storage for proofs, defaults to "immutable-proof".
|
|
351
|
-
* @param options.immutableStorageType The immutable storage, defaults to "immutable-storage".
|
|
352
|
-
* @param options.identityConnectorType The identity connector type, defaults to "identity".
|
|
353
|
-
* @param options.backgroundTaskConnectorType The background task connector type, defaults to "background-task".
|
|
354
420
|
*/
|
|
355
421
|
constructor(options) {
|
|
356
422
|
this._vaultConnector = vaultModels.VaultConnectorFactory.get(options?.vaultConnectorType ?? "vault");
|
|
@@ -359,6 +425,9 @@ class ImmutableProofService {
|
|
|
359
425
|
this._identityConnectorType = options?.identityConnectorType ?? "identity";
|
|
360
426
|
this._identityConnector = identityModels.IdentityConnectorFactory.get(this._identityConnectorType);
|
|
361
427
|
this._backgroundTaskConnector = backgroundTaskModels.BackgroundTaskConnectorFactory.get(options?.backgroundTaskConnectorType ?? "background-task");
|
|
428
|
+
if (core.Is.stringValue(options?.eventBusComponentType)) {
|
|
429
|
+
this._eventBusComponent = core.ComponentFactory.get(options.eventBusComponentType);
|
|
430
|
+
}
|
|
362
431
|
this._config = options?.config ?? {};
|
|
363
432
|
this._assertionMethodId = this._config.assertionMethodId ?? "immutable-proof-assertion";
|
|
364
433
|
this._proofHashKeyId = this._config.proofHashKeyId ?? "immutable-proof-hash";
|
|
@@ -550,6 +619,7 @@ class ImmutableProofService {
|
|
|
550
619
|
const immutableStoreResult = await this._immutableStorage.store(proofEntity.nodeIdentity, core.ObjectHelper.toBytes(compacted));
|
|
551
620
|
proofEntity.immutableStorageId = immutableStoreResult.id;
|
|
552
621
|
await this._proofStorage.set(proofEntity);
|
|
622
|
+
await this._eventBusComponent?.publish(immutableProofModels.ImmutableProofTopics.ProofCreated, { id: new core.Urn(ImmutableProofService.NAMESPACE, task.payload.proofId).toString() });
|
|
553
623
|
}
|
|
554
624
|
}
|
|
555
625
|
}
|
|
@@ -632,73 +702,6 @@ class ImmutableProofService {
|
|
|
632
702
|
}
|
|
633
703
|
}
|
|
634
704
|
|
|
635
|
-
// Copyright 2024 IOTA Stiftung.
|
|
636
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
637
|
-
/**
|
|
638
|
-
* Class describing the immutable proof.
|
|
639
|
-
*/
|
|
640
|
-
exports.ImmutableProof = class ImmutableProof {
|
|
641
|
-
/**
|
|
642
|
-
* The id of the proof.
|
|
643
|
-
*/
|
|
644
|
-
id;
|
|
645
|
-
/**
|
|
646
|
-
* The identity of the node which controls the proof.
|
|
647
|
-
*/
|
|
648
|
-
nodeIdentity;
|
|
649
|
-
/**
|
|
650
|
-
* The identity of the user which created the proof.
|
|
651
|
-
*/
|
|
652
|
-
userIdentity;
|
|
653
|
-
/**
|
|
654
|
-
* The date/time of when the proof was created.
|
|
655
|
-
*/
|
|
656
|
-
dateCreated;
|
|
657
|
-
/**
|
|
658
|
-
* The associated id for the item.
|
|
659
|
-
*/
|
|
660
|
-
proofObjectId;
|
|
661
|
-
/**
|
|
662
|
-
* The associated hash for the item.
|
|
663
|
-
*/
|
|
664
|
-
proofObjectHash;
|
|
665
|
-
/**
|
|
666
|
-
* The immutable storage id.
|
|
667
|
-
*/
|
|
668
|
-
immutableStorageId;
|
|
669
|
-
};
|
|
670
|
-
__decorate([
|
|
671
|
-
entity.property({ type: "string", isPrimary: true }),
|
|
672
|
-
__metadata("design:type", String)
|
|
673
|
-
], exports.ImmutableProof.prototype, "id", void 0);
|
|
674
|
-
__decorate([
|
|
675
|
-
entity.property({ type: "string" }),
|
|
676
|
-
__metadata("design:type", String)
|
|
677
|
-
], exports.ImmutableProof.prototype, "nodeIdentity", void 0);
|
|
678
|
-
__decorate([
|
|
679
|
-
entity.property({ type: "string" }),
|
|
680
|
-
__metadata("design:type", String)
|
|
681
|
-
], exports.ImmutableProof.prototype, "userIdentity", void 0);
|
|
682
|
-
__decorate([
|
|
683
|
-
entity.property({ type: "string", format: "date-time", sortDirection: entity.SortDirection.Descending }),
|
|
684
|
-
__metadata("design:type", String)
|
|
685
|
-
], exports.ImmutableProof.prototype, "dateCreated", void 0);
|
|
686
|
-
__decorate([
|
|
687
|
-
entity.property({ type: "string" }),
|
|
688
|
-
__metadata("design:type", String)
|
|
689
|
-
], exports.ImmutableProof.prototype, "proofObjectId", void 0);
|
|
690
|
-
__decorate([
|
|
691
|
-
entity.property({ type: "string" }),
|
|
692
|
-
__metadata("design:type", String)
|
|
693
|
-
], exports.ImmutableProof.prototype, "proofObjectHash", void 0);
|
|
694
|
-
__decorate([
|
|
695
|
-
entity.property({ type: "string" }),
|
|
696
|
-
__metadata("design:type", String)
|
|
697
|
-
], exports.ImmutableProof.prototype, "immutableStorageId", void 0);
|
|
698
|
-
exports.ImmutableProof = __decorate([
|
|
699
|
-
entity.entity()
|
|
700
|
-
], exports.ImmutableProof);
|
|
701
|
-
|
|
702
705
|
const restEntryPoints = [
|
|
703
706
|
{
|
|
704
707
|
name: "immutable-proof",
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { property, SortDirection, entity, EntitySchemaFactory, EntitySchemaHelper } from '@twin.org/entity';
|
|
2
|
+
import { Guards, ComponentFactory, StringHelper, Is, Validation, Converter, RandomHelper, ObjectHelper, Urn, GeneralError, NotFoundError, JsonHelper } from '@twin.org/core';
|
|
3
|
+
import { ImmutableProofTypes, ImmutableProofFailure, ImmutableProofTopics } from '@twin.org/immutable-proof-models';
|
|
3
4
|
import { DidContexts, DidTypes, DidCryptoSuites } from '@twin.org/standards-w3c-did';
|
|
4
5
|
import { HttpStatusCode, HeaderTypes, MimeTypes } from '@twin.org/web';
|
|
5
6
|
import { BackgroundTaskConnectorFactory, TaskStatus } from '@twin.org/background-task-models';
|
|
@@ -9,7 +10,73 @@ import { EntityStorageConnectorFactory } from '@twin.org/entity-storage-models';
|
|
|
9
10
|
import { IdentityConnectorFactory } from '@twin.org/identity-models';
|
|
10
11
|
import { ImmutableStorageConnectorFactory, ImmutableStorageTypes } from '@twin.org/immutable-storage-models';
|
|
11
12
|
import { VaultConnectorFactory } from '@twin.org/vault-models';
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
// Copyright 2024 IOTA Stiftung.
|
|
15
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
16
|
+
/**
|
|
17
|
+
* Class describing the immutable proof.
|
|
18
|
+
*/
|
|
19
|
+
let ImmutableProof = class ImmutableProof {
|
|
20
|
+
/**
|
|
21
|
+
* The id of the proof.
|
|
22
|
+
*/
|
|
23
|
+
id;
|
|
24
|
+
/**
|
|
25
|
+
* The identity of the node which controls the proof.
|
|
26
|
+
*/
|
|
27
|
+
nodeIdentity;
|
|
28
|
+
/**
|
|
29
|
+
* The identity of the user which created the proof.
|
|
30
|
+
*/
|
|
31
|
+
userIdentity;
|
|
32
|
+
/**
|
|
33
|
+
* The date/time of when the proof was created.
|
|
34
|
+
*/
|
|
35
|
+
dateCreated;
|
|
36
|
+
/**
|
|
37
|
+
* The associated id for the item.
|
|
38
|
+
*/
|
|
39
|
+
proofObjectId;
|
|
40
|
+
/**
|
|
41
|
+
* The associated hash for the item.
|
|
42
|
+
*/
|
|
43
|
+
proofObjectHash;
|
|
44
|
+
/**
|
|
45
|
+
* The immutable storage id.
|
|
46
|
+
*/
|
|
47
|
+
immutableStorageId;
|
|
48
|
+
};
|
|
49
|
+
__decorate([
|
|
50
|
+
property({ type: "string", isPrimary: true }),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], ImmutableProof.prototype, "id", undefined);
|
|
53
|
+
__decorate([
|
|
54
|
+
property({ type: "string" }),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], ImmutableProof.prototype, "nodeIdentity", undefined);
|
|
57
|
+
__decorate([
|
|
58
|
+
property({ type: "string" }),
|
|
59
|
+
__metadata("design:type", String)
|
|
60
|
+
], ImmutableProof.prototype, "userIdentity", undefined);
|
|
61
|
+
__decorate([
|
|
62
|
+
property({ type: "string", format: "date-time", sortDirection: SortDirection.Descending }),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], ImmutableProof.prototype, "dateCreated", undefined);
|
|
65
|
+
__decorate([
|
|
66
|
+
property({ type: "string" }),
|
|
67
|
+
__metadata("design:type", String)
|
|
68
|
+
], ImmutableProof.prototype, "proofObjectId", undefined);
|
|
69
|
+
__decorate([
|
|
70
|
+
property({ type: "string" }),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], ImmutableProof.prototype, "proofObjectHash", undefined);
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ type: "string" }),
|
|
75
|
+
__metadata("design:type", String)
|
|
76
|
+
], ImmutableProof.prototype, "immutableStorageId", undefined);
|
|
77
|
+
ImmutableProof = __decorate([
|
|
78
|
+
entity()
|
|
79
|
+
], ImmutableProof);
|
|
13
80
|
|
|
14
81
|
/**
|
|
15
82
|
* The source used when communicating about these routes.
|
|
@@ -325,6 +392,11 @@ class ImmutableProofService {
|
|
|
325
392
|
* @internal
|
|
326
393
|
*/
|
|
327
394
|
_backgroundTaskConnector;
|
|
395
|
+
/**
|
|
396
|
+
* The event bus component.
|
|
397
|
+
* @internal
|
|
398
|
+
*/
|
|
399
|
+
_eventBusComponent;
|
|
328
400
|
/**
|
|
329
401
|
* The assertion method id to use for the proofs.
|
|
330
402
|
* @internal
|
|
@@ -343,12 +415,6 @@ class ImmutableProofService {
|
|
|
343
415
|
/**
|
|
344
416
|
* Create a new instance of ImmutableProofService.
|
|
345
417
|
* @param options The dependencies for the immutable proof connector.
|
|
346
|
-
* @param options.config The configuration for the connector.
|
|
347
|
-
* @param options.vaultConnectorType The vault connector type, defaults to "vault".
|
|
348
|
-
* @param options.immutableProofEntityStorageType The entity storage for proofs, defaults to "immutable-proof".
|
|
349
|
-
* @param options.immutableStorageType The immutable storage, defaults to "immutable-storage".
|
|
350
|
-
* @param options.identityConnectorType The identity connector type, defaults to "identity".
|
|
351
|
-
* @param options.backgroundTaskConnectorType The background task connector type, defaults to "background-task".
|
|
352
418
|
*/
|
|
353
419
|
constructor(options) {
|
|
354
420
|
this._vaultConnector = VaultConnectorFactory.get(options?.vaultConnectorType ?? "vault");
|
|
@@ -357,6 +423,9 @@ class ImmutableProofService {
|
|
|
357
423
|
this._identityConnectorType = options?.identityConnectorType ?? "identity";
|
|
358
424
|
this._identityConnector = IdentityConnectorFactory.get(this._identityConnectorType);
|
|
359
425
|
this._backgroundTaskConnector = BackgroundTaskConnectorFactory.get(options?.backgroundTaskConnectorType ?? "background-task");
|
|
426
|
+
if (Is.stringValue(options?.eventBusComponentType)) {
|
|
427
|
+
this._eventBusComponent = ComponentFactory.get(options.eventBusComponentType);
|
|
428
|
+
}
|
|
360
429
|
this._config = options?.config ?? {};
|
|
361
430
|
this._assertionMethodId = this._config.assertionMethodId ?? "immutable-proof-assertion";
|
|
362
431
|
this._proofHashKeyId = this._config.proofHashKeyId ?? "immutable-proof-hash";
|
|
@@ -548,6 +617,7 @@ class ImmutableProofService {
|
|
|
548
617
|
const immutableStoreResult = await this._immutableStorage.store(proofEntity.nodeIdentity, ObjectHelper.toBytes(compacted));
|
|
549
618
|
proofEntity.immutableStorageId = immutableStoreResult.id;
|
|
550
619
|
await this._proofStorage.set(proofEntity);
|
|
620
|
+
await this._eventBusComponent?.publish(ImmutableProofTopics.ProofCreated, { id: new Urn(ImmutableProofService.NAMESPACE, task.payload.proofId).toString() });
|
|
551
621
|
}
|
|
552
622
|
}
|
|
553
623
|
}
|
|
@@ -630,73 +700,6 @@ class ImmutableProofService {
|
|
|
630
700
|
}
|
|
631
701
|
}
|
|
632
702
|
|
|
633
|
-
// Copyright 2024 IOTA Stiftung.
|
|
634
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
635
|
-
/**
|
|
636
|
-
* Class describing the immutable proof.
|
|
637
|
-
*/
|
|
638
|
-
let ImmutableProof = class ImmutableProof {
|
|
639
|
-
/**
|
|
640
|
-
* The id of the proof.
|
|
641
|
-
*/
|
|
642
|
-
id;
|
|
643
|
-
/**
|
|
644
|
-
* The identity of the node which controls the proof.
|
|
645
|
-
*/
|
|
646
|
-
nodeIdentity;
|
|
647
|
-
/**
|
|
648
|
-
* The identity of the user which created the proof.
|
|
649
|
-
*/
|
|
650
|
-
userIdentity;
|
|
651
|
-
/**
|
|
652
|
-
* The date/time of when the proof was created.
|
|
653
|
-
*/
|
|
654
|
-
dateCreated;
|
|
655
|
-
/**
|
|
656
|
-
* The associated id for the item.
|
|
657
|
-
*/
|
|
658
|
-
proofObjectId;
|
|
659
|
-
/**
|
|
660
|
-
* The associated hash for the item.
|
|
661
|
-
*/
|
|
662
|
-
proofObjectHash;
|
|
663
|
-
/**
|
|
664
|
-
* The immutable storage id.
|
|
665
|
-
*/
|
|
666
|
-
immutableStorageId;
|
|
667
|
-
};
|
|
668
|
-
__decorate([
|
|
669
|
-
property({ type: "string", isPrimary: true }),
|
|
670
|
-
__metadata("design:type", String)
|
|
671
|
-
], ImmutableProof.prototype, "id", void 0);
|
|
672
|
-
__decorate([
|
|
673
|
-
property({ type: "string" }),
|
|
674
|
-
__metadata("design:type", String)
|
|
675
|
-
], ImmutableProof.prototype, "nodeIdentity", void 0);
|
|
676
|
-
__decorate([
|
|
677
|
-
property({ type: "string" }),
|
|
678
|
-
__metadata("design:type", String)
|
|
679
|
-
], ImmutableProof.prototype, "userIdentity", void 0);
|
|
680
|
-
__decorate([
|
|
681
|
-
property({ type: "string", format: "date-time", sortDirection: SortDirection.Descending }),
|
|
682
|
-
__metadata("design:type", String)
|
|
683
|
-
], ImmutableProof.prototype, "dateCreated", void 0);
|
|
684
|
-
__decorate([
|
|
685
|
-
property({ type: "string" }),
|
|
686
|
-
__metadata("design:type", String)
|
|
687
|
-
], ImmutableProof.prototype, "proofObjectId", void 0);
|
|
688
|
-
__decorate([
|
|
689
|
-
property({ type: "string" }),
|
|
690
|
-
__metadata("design:type", String)
|
|
691
|
-
], ImmutableProof.prototype, "proofObjectHash", void 0);
|
|
692
|
-
__decorate([
|
|
693
|
-
property({ type: "string" }),
|
|
694
|
-
__metadata("design:type", String)
|
|
695
|
-
], ImmutableProof.prototype, "immutableStorageId", void 0);
|
|
696
|
-
ImmutableProof = __decorate([
|
|
697
|
-
entity()
|
|
698
|
-
], ImmutableProof);
|
|
699
|
-
|
|
700
703
|
const restEntryPoints = [
|
|
701
704
|
{
|
|
702
705
|
name: "immutable-proof",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
2
|
import { type IImmutableProof, type IImmutableProofComponent, type IImmutableProofVerification } from "@twin.org/immutable-proof-models";
|
|
3
|
-
import type {
|
|
3
|
+
import type { IImmutableProofServiceConstructorOptions } from "./models/IImmutableProofServiceConstructorOptions";
|
|
4
4
|
/**
|
|
5
5
|
* Class for performing immutable proof operations.
|
|
6
6
|
*/
|
|
@@ -16,21 +16,8 @@ export declare class ImmutableProofService implements IImmutableProofComponent {
|
|
|
16
16
|
/**
|
|
17
17
|
* Create a new instance of ImmutableProofService.
|
|
18
18
|
* @param options The dependencies for the immutable proof connector.
|
|
19
|
-
* @param options.config The configuration for the connector.
|
|
20
|
-
* @param options.vaultConnectorType The vault connector type, defaults to "vault".
|
|
21
|
-
* @param options.immutableProofEntityStorageType The entity storage for proofs, defaults to "immutable-proof".
|
|
22
|
-
* @param options.immutableStorageType The immutable storage, defaults to "immutable-storage".
|
|
23
|
-
* @param options.identityConnectorType The identity connector type, defaults to "identity".
|
|
24
|
-
* @param options.backgroundTaskConnectorType The background task connector type, defaults to "background-task".
|
|
25
19
|
*/
|
|
26
|
-
constructor(options?:
|
|
27
|
-
vaultConnectorType?: string;
|
|
28
|
-
immutableProofEntityStorageType?: string;
|
|
29
|
-
immutableStorageType?: string;
|
|
30
|
-
identityConnectorType?: string;
|
|
31
|
-
backgroundTaskConnectorType?: string;
|
|
32
|
-
config?: IImmutableProofServiceConfig;
|
|
33
|
-
});
|
|
20
|
+
constructor(options?: IImmutableProofServiceConstructorOptions);
|
|
34
21
|
/**
|
|
35
22
|
* Create a new authentication proof.
|
|
36
23
|
* @param proofObject The object for the proof as JSON-LD.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export * from "./entities/immutableProof";
|
|
1
2
|
export * from "./immutableProofRoutes";
|
|
2
3
|
export * from "./immutableProofService";
|
|
3
|
-
export * from "./entities/immutableProof";
|
|
4
4
|
export * from "./models/IImmutableProofServiceConfig";
|
|
5
|
+
export * from "./models/IImmutableProofServiceConstructorOptions";
|
|
5
6
|
export * from "./restEntryPoints";
|
|
6
7
|
export * from "./schema";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { IImmutableProofServiceConfig } from "./IImmutableProofServiceConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the immutable proof service constructor.
|
|
4
|
+
*/
|
|
5
|
+
export interface IImmutableProofServiceConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The vault connector type.
|
|
8
|
+
* @default vault
|
|
9
|
+
*/
|
|
10
|
+
vaultConnectorType?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The entity storage for proofs.
|
|
13
|
+
* @default immutable-proof
|
|
14
|
+
*/
|
|
15
|
+
immutableProofEntityStorageType?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The immutable storage.
|
|
18
|
+
* @default immutable-storage
|
|
19
|
+
*/
|
|
20
|
+
immutableStorageType?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The identity connector type.
|
|
23
|
+
* @default identity
|
|
24
|
+
*/
|
|
25
|
+
identityConnectorType?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The background task connector type.
|
|
28
|
+
* @default background-task
|
|
29
|
+
*/
|
|
30
|
+
backgroundTaskConnectorType?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The event bus component type, defaults to no event bus.
|
|
33
|
+
*/
|
|
34
|
+
eventBusComponentType?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The configuration for the connector.
|
|
37
|
+
*/
|
|
38
|
+
config?: IImmutableProofServiceConfig;
|
|
39
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -16,33 +16,11 @@ Create a new instance of ImmutableProofService.
|
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### options?
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
• **options.vaultConnectorType?**: `string`
|
|
24
|
-
|
|
25
|
-
The vault connector type, defaults to "vault".
|
|
26
|
-
|
|
27
|
-
• **options.immutableProofEntityStorageType?**: `string`
|
|
28
|
-
|
|
29
|
-
The entity storage for proofs, defaults to "immutable-proof".
|
|
30
|
-
|
|
31
|
-
• **options.immutableStorageType?**: `string`
|
|
32
|
-
|
|
33
|
-
The immutable storage, defaults to "immutable-storage".
|
|
34
|
-
|
|
35
|
-
• **options.identityConnectorType?**: `string`
|
|
36
|
-
|
|
37
|
-
The identity connector type, defaults to "identity".
|
|
38
|
-
|
|
39
|
-
• **options.backgroundTaskConnectorType?**: `string`
|
|
21
|
+
[`IImmutableProofServiceConstructorOptions`](../interfaces/IImmutableProofServiceConstructorOptions.md)
|
|
40
22
|
|
|
41
|
-
The
|
|
42
|
-
|
|
43
|
-
• **options.config?**: [`IImmutableProofServiceConfig`](../interfaces/IImmutableProofServiceConfig.md)
|
|
44
|
-
|
|
45
|
-
The configuration for the connector.
|
|
23
|
+
The dependencies for the immutable proof connector.
|
|
46
24
|
|
|
47
25
|
#### Returns
|
|
48
26
|
|
|
@@ -78,15 +56,21 @@ Create a new authentication proof.
|
|
|
78
56
|
|
|
79
57
|
#### Parameters
|
|
80
58
|
|
|
81
|
-
|
|
59
|
+
##### proofObject
|
|
60
|
+
|
|
61
|
+
`IJsonLdNodeObject`
|
|
82
62
|
|
|
83
63
|
The object for the proof as JSON-LD.
|
|
84
64
|
|
|
85
|
-
|
|
65
|
+
##### userIdentity?
|
|
66
|
+
|
|
67
|
+
`string`
|
|
86
68
|
|
|
87
69
|
The identity to create the immutable proof operation with.
|
|
88
70
|
|
|
89
|
-
|
|
71
|
+
##### nodeIdentity?
|
|
72
|
+
|
|
73
|
+
`string`
|
|
90
74
|
|
|
91
75
|
The node identity to use for vault operations.
|
|
92
76
|
|
|
@@ -110,7 +94,9 @@ Get an authentication proof.
|
|
|
110
94
|
|
|
111
95
|
#### Parameters
|
|
112
96
|
|
|
113
|
-
|
|
97
|
+
##### id
|
|
98
|
+
|
|
99
|
+
`string`
|
|
114
100
|
|
|
115
101
|
The id of the proof to get.
|
|
116
102
|
|
|
@@ -138,7 +124,9 @@ Verify an authentication proof.
|
|
|
138
124
|
|
|
139
125
|
#### Parameters
|
|
140
126
|
|
|
141
|
-
|
|
127
|
+
##### id
|
|
128
|
+
|
|
129
|
+
`string`
|
|
142
130
|
|
|
143
131
|
The id of the proof to verify.
|
|
144
132
|
|
|
@@ -166,11 +154,15 @@ Remove the immutable storage for the proof.
|
|
|
166
154
|
|
|
167
155
|
#### Parameters
|
|
168
156
|
|
|
169
|
-
|
|
157
|
+
##### id
|
|
158
|
+
|
|
159
|
+
`string`
|
|
170
160
|
|
|
171
161
|
The id of the proof to remove the storage from.
|
|
172
162
|
|
|
173
|
-
|
|
163
|
+
##### nodeIdentity?
|
|
164
|
+
|
|
165
|
+
`string`
|
|
174
166
|
|
|
175
167
|
The node identity to use for vault operations.
|
|
176
168
|
|
|
@@ -6,11 +6,15 @@ The REST routes for immutable proof.
|
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### baseRouteName
|
|
10
|
+
|
|
11
|
+
`string`
|
|
10
12
|
|
|
11
13
|
Prefix to prepend to the paths.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
14
18
|
|
|
15
19
|
The name of the component to use in the routes stored in the ComponentFactory.
|
|
16
20
|
|
|
@@ -6,15 +6,21 @@ Create a proof.
|
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
10
12
|
|
|
11
13
|
The request context for the API.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
14
18
|
|
|
15
19
|
The name of the component to use in the routes.
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IImmutableProofCreateRequest`
|
|
18
24
|
|
|
19
25
|
The request.
|
|
20
26
|
|
|
@@ -6,15 +6,21 @@ Get the proof.
|
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
10
12
|
|
|
11
13
|
The request context for the API.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
14
18
|
|
|
15
19
|
The name of the component to use in the routes.
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IImmutableProofGetRequest`
|
|
18
24
|
|
|
19
25
|
The request.
|
|
20
26
|
|
|
@@ -6,15 +6,21 @@ Verify the proof.
|
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
10
12
|
|
|
11
13
|
The request context for the API.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
14
18
|
|
|
15
19
|
The name of the component to use in the routes.
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
`IImmutableProofVerifyRequest`
|
|
18
24
|
|
|
19
25
|
The request.
|
|
20
26
|
|
package/docs/reference/index.md
CHANGED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Interface: IImmutableProofServiceConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the immutable proof service constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### vaultConnectorType?
|
|
8
|
+
|
|
9
|
+
> `optional` **vaultConnectorType**: `string`
|
|
10
|
+
|
|
11
|
+
The vault connector type.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
vault
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### immutableProofEntityStorageType?
|
|
22
|
+
|
|
23
|
+
> `optional` **immutableProofEntityStorageType**: `string`
|
|
24
|
+
|
|
25
|
+
The entity storage for proofs.
|
|
26
|
+
|
|
27
|
+
#### Default
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
immutable-proof
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
***
|
|
34
|
+
|
|
35
|
+
### immutableStorageType?
|
|
36
|
+
|
|
37
|
+
> `optional` **immutableStorageType**: `string`
|
|
38
|
+
|
|
39
|
+
The immutable storage.
|
|
40
|
+
|
|
41
|
+
#### Default
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
immutable-storage
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
***
|
|
48
|
+
|
|
49
|
+
### identityConnectorType?
|
|
50
|
+
|
|
51
|
+
> `optional` **identityConnectorType**: `string`
|
|
52
|
+
|
|
53
|
+
The identity connector type.
|
|
54
|
+
|
|
55
|
+
#### Default
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
identity
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### backgroundTaskConnectorType?
|
|
64
|
+
|
|
65
|
+
> `optional` **backgroundTaskConnectorType**: `string`
|
|
66
|
+
|
|
67
|
+
The background task connector type.
|
|
68
|
+
|
|
69
|
+
#### Default
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
background-task
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
***
|
|
76
|
+
|
|
77
|
+
### eventBusComponentType?
|
|
78
|
+
|
|
79
|
+
> `optional` **eventBusComponentType**: `string`
|
|
80
|
+
|
|
81
|
+
The event bus component type, defaults to no event bus.
|
|
82
|
+
|
|
83
|
+
***
|
|
84
|
+
|
|
85
|
+
### config?
|
|
86
|
+
|
|
87
|
+
> `optional` **config**: [`IImmutableProofServiceConfig`](IImmutableProofServiceConfig.md)
|
|
88
|
+
|
|
89
|
+
The configuration for the connector.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/immutable-proof-service",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.15",
|
|
4
4
|
"description": "Immutable proof contract implementation and REST endpoint definitions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,15 +22,16 @@
|
|
|
22
22
|
"@twin.org/data-schema-org": "next",
|
|
23
23
|
"@twin.org/entity": "next",
|
|
24
24
|
"@twin.org/entity-storage-models": "next",
|
|
25
|
+
"@twin.org/event-bus-models": "next",
|
|
25
26
|
"@twin.org/identity-models": "next",
|
|
26
|
-
"@twin.org/immutable-proof-models": "0.0.1-next.
|
|
27
|
-
"@twin.org/immutable-proof-task": "0.0.1-next.
|
|
27
|
+
"@twin.org/immutable-proof-models": "0.0.1-next.15",
|
|
28
|
+
"@twin.org/immutable-proof-task": "0.0.1-next.15",
|
|
28
29
|
"@twin.org/immutable-storage-models": "next",
|
|
29
30
|
"@twin.org/nameof": "next",
|
|
30
31
|
"@twin.org/standards-w3c-did": "next",
|
|
31
32
|
"@twin.org/vault-models": "next",
|
|
32
33
|
"@twin.org/web": "next",
|
|
33
|
-
"jsonschema": "1.
|
|
34
|
+
"jsonschema": "1.5.0"
|
|
34
35
|
},
|
|
35
36
|
"main": "./dist/cjs/index.cjs",
|
|
36
37
|
"module": "./dist/esm/index.mjs",
|