@twin.org/immutable-proof-service 0.0.1-next.2 → 0.0.1-next.20

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.
@@ -1,16 +1,83 @@
1
- import { Guards, ComponentFactory, StringHelper, Validation, Converter, RandomHelper, ObjectHelper, Urn, GeneralError, Is, NotFoundError, JsonHelper } from '@twin.org/core';
2
- import { ImmutableProofTypes, ImmutableProofFailure } from '@twin.org/immutable-proof-models';
3
- import { DidContexts, DidTypes, DidCryptoSuites } from '@twin.org/standards-w3c-did';
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';
4
+ import { DidCryptoSuites, DidTypes, DidContexts } from '@twin.org/standards-w3c-did';
4
5
  import { HttpStatusCode, HeaderTypes, MimeTypes } from '@twin.org/web';
6
+ import { BackgroundTaskConnectorFactory, TaskStatus } from '@twin.org/background-task-models';
5
7
  import { Blake2b, Sha256 } from '@twin.org/crypto';
6
8
  import { JsonLdHelper, JsonLdProcessor } from '@twin.org/data-json-ld';
7
- import { SchemaOrgDataTypes, SchemaOrgTypes } from '@twin.org/data-schema-org';
8
- import { ComparisonOperator, SortDirection, property, entity, EntitySchemaFactory, EntitySchemaHelper } from '@twin.org/entity';
9
9
  import { EntityStorageConnectorFactory } from '@twin.org/entity-storage-models';
10
10
  import { IdentityConnectorFactory } from '@twin.org/identity-models';
11
- import { ImmutableStorageConnectorFactory } from '@twin.org/immutable-storage-models';
11
+ import { ImmutableStorageConnectorFactory, ImmutableStorageTypes } from '@twin.org/immutable-storage-models';
12
12
  import { VaultConnectorFactory } from '@twin.org/vault-models';
13
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", void 0);
53
+ __decorate([
54
+ property({ type: "string" }),
55
+ __metadata("design:type", String)
56
+ ], ImmutableProof.prototype, "nodeIdentity", void 0);
57
+ __decorate([
58
+ property({ type: "string" }),
59
+ __metadata("design:type", String)
60
+ ], ImmutableProof.prototype, "userIdentity", void 0);
61
+ __decorate([
62
+ property({ type: "string", format: "date-time", sortDirection: SortDirection.Descending }),
63
+ __metadata("design:type", String)
64
+ ], ImmutableProof.prototype, "dateCreated", void 0);
65
+ __decorate([
66
+ property({ type: "string" }),
67
+ __metadata("design:type", String)
68
+ ], ImmutableProof.prototype, "proofObjectId", void 0);
69
+ __decorate([
70
+ property({ type: "string" }),
71
+ __metadata("design:type", String)
72
+ ], ImmutableProof.prototype, "proofObjectHash", void 0);
73
+ __decorate([
74
+ property({ type: "string" }),
75
+ __metadata("design:type", String)
76
+ ], ImmutableProof.prototype, "immutableStorageId", void 0);
77
+ ImmutableProof = __decorate([
78
+ entity()
79
+ ], ImmutableProof);
80
+
14
81
  /**
15
82
  * The source used when communicating about these routes.
16
83
  */
@@ -46,7 +113,7 @@ function generateRestRoutesImmutableProof(baseRouteName, componentName) {
46
113
  request: {
47
114
  body: {
48
115
  proofObject: {
49
- "@context": "http://schema.org",
116
+ "@context": "https://schema.org",
50
117
  type: "Person",
51
118
  name: "John Smith"
52
119
  }
@@ -164,8 +231,8 @@ function generateRestRoutesImmutableProof(baseRouteName, componentName) {
164
231
  operationId: "immutableProofVerify",
165
232
  summary: "Verify a proof",
166
233
  tag: tagsImmutableProof[0].name,
167
- method: "POST",
168
- path: `${baseRouteName}/:id`,
234
+ method: "GET",
235
+ path: `${baseRouteName}/:id/verify`,
169
236
  handler: async (httpRequestContext, request) => immutableProofVerify(httpRequestContext, componentName, request),
170
237
  requestType: {
171
238
  type: "IImmutableProofVerifyRequest",
@@ -175,13 +242,6 @@ function generateRestRoutesImmutableProof(baseRouteName, componentName) {
175
242
  request: {
176
243
  pathParams: {
177
244
  id: "ais:1234567890"
178
- },
179
- body: {
180
- proofObject: {
181
- "@context": "http://schema.org",
182
- type: "Person",
183
- name: "John Smith"
184
- }
185
245
  }
186
246
  }
187
247
  }
@@ -277,10 +337,9 @@ async function immutableProofVerify(httpRequestContext, componentName, request)
277
337
  Guards.object(ROUTES_SOURCE, "request", request);
278
338
  Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
279
339
  Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
280
- Guards.object(ROUTES_SOURCE, "request.body.proofObject", request.body.proofObject);
281
340
  const mimeType = request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd ? "jsonld" : "json";
282
341
  const component = ComponentFactory.get(componentName);
283
- const result = await component.verify(request.pathParams.id, request.body.proofObject);
342
+ const result = await component.verify(request.pathParams.id);
284
343
  return {
285
344
  headers: {
286
345
  [HeaderTypes.ContentType]: mimeType === "json" ? MimeTypes.Json : MimeTypes.JsonLd
@@ -329,39 +388,50 @@ class ImmutableProofService {
329
388
  */
330
389
  _immutableStorage;
331
390
  /**
332
- * The assertion method id to use for the proofs.
391
+ * The background task connector.
392
+ * @internal
393
+ */
394
+ _backgroundTaskConnector;
395
+ /**
396
+ * The event bus component.
333
397
  * @internal
334
398
  */
335
- _assertionMethodId;
399
+ _eventBusComponent;
336
400
  /**
337
- * The proof config key id to use for the proofs.
401
+ * The verification method id to use for the proofs.
338
402
  * @internal
339
403
  */
340
- _proofConfigKeyId;
404
+ _verificationMethodId;
341
405
  /**
342
- * Are we currently processing proofs.
406
+ * The proof hash key id to use for the proofs.
343
407
  * @internal
344
408
  */
345
- _processing;
409
+ _proofHashKeyId;
410
+ /**
411
+ * The identity connector type.
412
+ * @internal
413
+ */
414
+ _identityConnectorType;
346
415
  /**
347
416
  * Create a new instance of ImmutableProofService.
348
417
  * @param options The dependencies for the immutable proof connector.
349
- * @param options.config The configuration for the connector.
350
- * @param options.vaultConnectorType The vault connector type, defaults to "vault".
351
- * @param options.immutableProofEntityStorageType The entity storage for proofs, defaults to "immutable-proof".
352
- * @param options.immutableStorageType The immutable storage, defaults to "immutable-proof".
353
- * @param options.identityConnectorType The identity connector type, defaults to "identity".
354
418
  */
355
419
  constructor(options) {
356
420
  this._vaultConnector = VaultConnectorFactory.get(options?.vaultConnectorType ?? "vault");
357
421
  this._proofStorage = EntityStorageConnectorFactory.get(options?.immutableProofEntityStorageType ?? StringHelper.kebabCase("ImmutableProof"));
358
- this._immutableStorage = ImmutableStorageConnectorFactory.get(options?.immutableStorageType ?? "immutable-proof");
359
- this._identityConnector = IdentityConnectorFactory.get(options?.identityConnectorType ?? "identity");
422
+ this._immutableStorage = ImmutableStorageConnectorFactory.get(options?.immutableStorageType ?? "immutable-storage");
423
+ this._identityConnectorType = options?.identityConnectorType ?? "identity";
424
+ this._identityConnector = IdentityConnectorFactory.get(this._identityConnectorType);
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
- this._assertionMethodId = this._config.assertionMethodId ?? "immutable-proof";
362
- this._proofConfigKeyId = this._config.proofConfigKeyId ?? "immutable-proof";
363
- SchemaOrgDataTypes.registerRedirects();
364
- this._processing = false;
430
+ this._verificationMethodId = this._config.verificationMethodId ?? "immutable-proof-assertion";
431
+ this._proofHashKeyId = this._config.proofHashKeyId ?? "immutable-proof-hash";
432
+ this._backgroundTaskConnector.registerHandler("immutable-proof", "@twin.org/immutable-proof-task", "processProofTask", async (task) => {
433
+ await this.finaliseTask(task);
434
+ });
365
435
  }
366
436
  /**
367
437
  * Create a new authentication proof.
@@ -391,7 +461,16 @@ class ImmutableProofService {
391
461
  proofObjectHash: Converter.bytesToBase64(hash)
392
462
  };
393
463
  await this._proofStorage.set(proofEntity);
394
- this.startProcessingProofs();
464
+ const immutableProof = this.proofEntityToJsonLd(proofEntity);
465
+ const hashData = await this.generateHashData(proofEntity.nodeIdentity, immutableProof);
466
+ const proofTaskPayload = {
467
+ proofId: id,
468
+ nodeIdentity,
469
+ identityConnectorType: this._identityConnectorType,
470
+ assertionMethodId: this._verificationMethodId,
471
+ hashData: Converter.bytesToHex(hashData)
472
+ };
473
+ await this._backgroundTaskConnector.create("immutable-proof", proofTaskPayload);
395
474
  return new Urn(ImmutableProofService.NAMESPACE, id).toString();
396
475
  }
397
476
  catch (error) {
@@ -414,7 +493,7 @@ class ImmutableProofService {
414
493
  });
415
494
  }
416
495
  try {
417
- const { immutableProof } = await this.internalGet(id);
496
+ const { immutableProof } = await this.internalGet(id, false);
418
497
  const compacted = await JsonLdProcessor.compact(immutableProof, immutableProof["@context"]);
419
498
  return compacted;
420
499
  }
@@ -425,11 +504,10 @@ class ImmutableProofService {
425
504
  /**
426
505
  * Verify an authentication proof.
427
506
  * @param id The id of the proof to verify.
428
- * @param proofObject The object to verify as JSON-LD.
429
507
  * @returns The result of the verification and any failures.
430
508
  * @throws NotFoundError if the proof is not found.
431
509
  */
432
- async verify(id, proofObject) {
510
+ async verify(id) {
433
511
  Guards.stringValue(this.CLASS_NAME, "id", id);
434
512
  const urnParsed = Urn.fromValidString(id);
435
513
  if (urnParsed.namespaceIdentifier() !== ImmutableProofService.NAMESPACE) {
@@ -439,7 +517,7 @@ class ImmutableProofService {
439
517
  });
440
518
  }
441
519
  try {
442
- const { verified, failure } = await this.internalGet(id, proofObject);
520
+ const { verified, failure } = await this.internalGet(id, true);
443
521
  return {
444
522
  "@context": ImmutableProofTypes.ContextRoot,
445
523
  type: ImmutableProofTypes.ImmutableProofVerification,
@@ -505,13 +583,9 @@ class ImmutableProofService {
505
583
  * @returns The model.
506
584
  * @internal
507
585
  */
508
- proofEntityToModel(proofEntity) {
586
+ proofEntityToJsonLd(proofEntity) {
509
587
  const model = {
510
- "@context": [
511
- ImmutableProofTypes.ContextRoot,
512
- SchemaOrgTypes.ContextRoot,
513
- DidContexts.ContextVCDataIntegrity
514
- ],
588
+ "@context": ImmutableProofTypes.ContextRoot,
515
589
  type: ImmutableProofTypes.ImmutableProof,
516
590
  id: proofEntity.id,
517
591
  userIdentity: proofEntity.userIdentity,
@@ -521,74 +595,61 @@ class ImmutableProofService {
521
595
  return model;
522
596
  }
523
597
  /**
524
- * Start processing proofs.
525
- * @returns Nothing.
598
+ * Process a proof.
599
+ * @param proofEntity The proof entity to process.
526
600
  * @internal
527
601
  */
528
- startProcessingProofs() {
529
- if (!this._processing) {
530
- setTimeout(async () => {
531
- await this.processProofs();
532
- }, 0);
533
- }
534
- }
535
- /**
536
- * Process the proofs.
537
- * @internal
538
- */
539
- async processProofs() {
540
- // Get the oldest pending proof, plus one more, we can then determine whether to
541
- // trigger another process after this one
542
- const pendingProofs = await this._proofStorage.query({
543
- property: "immutableStorageId",
544
- comparison: ComparisonOperator.Equals,
545
- value: undefined
546
- }, [
547
- {
548
- property: "dateCreated",
549
- sortDirection: SortDirection.Ascending
602
+ async finaliseTask(task) {
603
+ if (task.status === TaskStatus.Success && Is.object(task.payload) && Is.object(task.result)) {
604
+ const proofEntity = await this._proofStorage.get(task.payload.proofId);
605
+ if (Is.object(proofEntity)) {
606
+ const immutableProof = this.proofEntityToJsonLd(proofEntity);
607
+ // As we are adding the proof to the data we update its context
608
+ immutableProof["@context"] = [
609
+ ImmutableProofTypes.ContextRoot,
610
+ DidContexts.ContextVCDataIntegrity
611
+ ];
612
+ immutableProof.proof = task.result.proof;
613
+ if (Is.stringValue(immutableProof.proof.created)) {
614
+ proofEntity.dateCreated = immutableProof.proof.created;
615
+ }
616
+ const compacted = await JsonLdProcessor.compact(immutableProof, immutableProof["@context"]);
617
+ const immutableStoreResult = await this._immutableStorage.store(proofEntity.nodeIdentity, ObjectHelper.toBytes(compacted));
618
+ proofEntity.immutableStorageId = immutableStoreResult.id;
619
+ await this._proofStorage.set(proofEntity);
620
+ await this._eventBusComponent?.publish(ImmutableProofTopics.ProofCreated, { id: new Urn(ImmutableProofService.NAMESPACE, task.payload.proofId).toString() });
550
621
  }
551
- ], undefined, undefined, 2);
552
- if (pendingProofs.entities.length > 0) {
553
- const proofEntity = pendingProofs.entities[0];
554
- const immutableProof = this.proofEntityToModel(proofEntity);
555
- const hashData = await this.generateHashData(proofEntity.nodeIdentity, immutableProof);
556
- immutableProof.proof = await this._identityConnector.createProof(proofEntity.nodeIdentity, `${proofEntity.nodeIdentity}#${this._assertionMethodId}`, hashData);
557
- proofEntity.dateCreated = immutableProof.proof.created ?? new Date(Date.now()).toISOString();
558
- const compacted = await JsonLdProcessor.compact(immutableProof, immutableProof["@context"]);
559
- proofEntity.immutableStorageId = await this._immutableStorage.store(proofEntity.nodeIdentity, ObjectHelper.toBytes(compacted));
560
- await this._proofStorage.set(proofEntity);
561
- }
562
- // If there are still remaining proofs, start the timer again
563
- this._processing = false;
564
- if (pendingProofs.entities.length > 1) {
565
- this.startProcessingProofs();
566
622
  }
567
623
  }
568
624
  /**
569
625
  * Verify an authentication proof.
570
626
  * @param id The id of the proof to verify.
571
- * @param proofObject The object to verify as JSON-LD.
627
+ * @param verify Validate the proof.
572
628
  * @returns The result of the verification and any failures.
573
629
  * @throws NotFoundError if the proof is not found.
574
630
  * @internal
575
631
  */
576
- async internalGet(id, proofObject) {
632
+ async internalGet(id, verify) {
577
633
  const urnParsed = Urn.fromValidString(id);
578
634
  const proofId = urnParsed.namespaceSpecific(0);
579
635
  const proofEntity = await this._proofStorage.get(proofId);
580
636
  if (Is.empty(proofEntity)) {
581
637
  throw new NotFoundError(this.CLASS_NAME, "proofNotFound", id);
582
638
  }
583
- let proofModel = await this.proofEntityToModel(proofEntity);
639
+ let proofModel = await this.proofEntityToJsonLd(proofEntity);
584
640
  let verified = false;
585
641
  let failure = ImmutableProofFailure.NotIssued;
586
642
  if (Is.stringValue(proofEntity.immutableStorageId)) {
587
643
  failure = ImmutableProofFailure.ProofMissing;
588
- const immutableData = await this._immutableStorage.get(proofEntity.immutableStorageId);
589
- if (Is.uint8Array(immutableData)) {
590
- proofModel = ObjectHelper.fromBytes(immutableData);
591
- if (Is.object(proofModel.proof) && Is.object(proofObject)) {
644
+ const immutableResult = await this._immutableStorage.get(proofEntity.immutableStorageId);
645
+ if (Is.uint8Array(immutableResult.data)) {
646
+ proofModel = ObjectHelper.fromBytes(immutableResult.data);
647
+ proofModel.immutableReceipt = immutableResult.receipt;
648
+ // As we are adding the receipt to the data we update its context
649
+ if (Is.array(proofModel["@context"])) {
650
+ proofModel["@context"].push(ImmutableStorageTypes.ContextRoot);
651
+ }
652
+ if (verify && Is.object(proofModel.proof)) {
592
653
  if (proofModel.proof.cryptosuite !== DidCryptoSuites.EdDSAJcs2022) {
593
654
  failure = ImmutableProofFailure.CryptoSuiteMismatch;
594
655
  }
@@ -624,84 +685,21 @@ class ImmutableProofService {
624
685
  * @internal
625
686
  */
626
687
  async generateHashData(nodeIdentity, immutableProof) {
627
- const canonicalDocument = JsonHelper.canonicalize(ObjectHelper.omit(immutableProof, ["proof"]));
628
- const proofConfigKey = await this._vaultConnector.getKey(`${nodeIdentity}/${this._proofConfigKeyId}`);
629
- const proofConfigHash = Sha256.sum256(proofConfigKey.privateKey);
688
+ // We hash the data for the proof without the the proof or immutable receipt for the proof
689
+ // without these objects we can simplify the context
690
+ const object = ObjectHelper.omit(immutableProof, ["proof", "immutableReceipt"]);
691
+ object["@context"] = ImmutableProofTypes.ContextRoot;
692
+ const canonicalDocument = JsonHelper.canonicalize(object);
693
+ const proofKey = await this._vaultConnector.getKey(`${nodeIdentity}/${this._proofHashKeyId}`);
694
+ const proofHash = Sha256.sum256(proofKey.privateKey);
630
695
  const transformedDocumentHash = Sha256.sum256(Converter.utf8ToBytes(canonicalDocument));
631
- const hashData = new Uint8Array(proofConfigHash.length + transformedDocumentHash.length);
632
- hashData.set(proofConfigHash);
633
- hashData.set(transformedDocumentHash, proofConfigHash.length);
696
+ const hashData = new Uint8Array(proofHash.length + transformedDocumentHash.length);
697
+ hashData.set(proofHash);
698
+ hashData.set(transformedDocumentHash, proofHash.length);
634
699
  return hashData;
635
700
  }
636
701
  }
637
702
 
638
- // Copyright 2024 IOTA Stiftung.
639
- // SPDX-License-Identifier: Apache-2.0.
640
- /**
641
- * Class describing the immutable proof.
642
- */
643
- let ImmutableProof = class ImmutableProof {
644
- /**
645
- * The id of the proof.
646
- */
647
- id;
648
- /**
649
- * The identity of the node which controls the proof.
650
- */
651
- nodeIdentity;
652
- /**
653
- * The identity of the user which created the proof.
654
- */
655
- userIdentity;
656
- /**
657
- * The date/time of when the proof was created.
658
- */
659
- dateCreated;
660
- /**
661
- * The associated id for the item.
662
- */
663
- proofObjectId;
664
- /**
665
- * The associated hash for the item.
666
- */
667
- proofObjectHash;
668
- /**
669
- * The immutable storage id.
670
- */
671
- immutableStorageId;
672
- };
673
- __decorate([
674
- property({ type: "string", isPrimary: true }),
675
- __metadata("design:type", String)
676
- ], ImmutableProof.prototype, "id", void 0);
677
- __decorate([
678
- property({ type: "string" }),
679
- __metadata("design:type", String)
680
- ], ImmutableProof.prototype, "nodeIdentity", void 0);
681
- __decorate([
682
- property({ type: "string" }),
683
- __metadata("design:type", String)
684
- ], ImmutableProof.prototype, "userIdentity", void 0);
685
- __decorate([
686
- property({ type: "string", format: "date-time", sortDirection: SortDirection.Descending }),
687
- __metadata("design:type", String)
688
- ], ImmutableProof.prototype, "dateCreated", void 0);
689
- __decorate([
690
- property({ type: "string" }),
691
- __metadata("design:type", String)
692
- ], ImmutableProof.prototype, "proofObjectId", void 0);
693
- __decorate([
694
- property({ type: "string" }),
695
- __metadata("design:type", String)
696
- ], ImmutableProof.prototype, "proofObjectHash", void 0);
697
- __decorate([
698
- property({ type: "string" }),
699
- __metadata("design:type", String)
700
- ], ImmutableProof.prototype, "immutableStorageId", void 0);
701
- ImmutableProof = __decorate([
702
- entity()
703
- ], ImmutableProof);
704
-
705
703
  const restEntryPoints = [
706
704
  {
707
705
  name: "immutable-proof",
@@ -1,6 +1,6 @@
1
1
  import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
- import { type IImmutableProofVerification, type IImmutableProof, type IImmutableProofComponent } from "@twin.org/immutable-proof-models";
3
- import type { IImmutableProofServiceConfig } from "./models/IImmutableProofServiceConfig";
2
+ import { type IImmutableProof, type IImmutableProofComponent, type IImmutableProofVerification } from "@twin.org/immutable-proof-models";
3
+ import type { IImmutableProofServiceConstructorOptions } from "./models/IImmutableProofServiceConstructorOptions";
4
4
  /**
5
5
  * Class for performing immutable proof operations.
6
6
  */
@@ -16,19 +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-proof".
23
- * @param options.identityConnectorType The identity connector type, defaults to "identity".
24
19
  */
25
- constructor(options?: {
26
- vaultConnectorType?: string;
27
- immutableProofEntityStorageType?: string;
28
- immutableStorageType?: string;
29
- config?: IImmutableProofServiceConfig;
30
- identityConnectorType?: string;
31
- });
20
+ constructor(options?: IImmutableProofServiceConstructorOptions);
32
21
  /**
33
22
  * Create a new authentication proof.
34
23
  * @param proofObject The object for the proof as JSON-LD.
@@ -47,11 +36,10 @@ export declare class ImmutableProofService implements IImmutableProofComponent {
47
36
  /**
48
37
  * Verify an authentication proof.
49
38
  * @param id The id of the proof to verify.
50
- * @param proofObject The object to verify as JSON-LD.
51
39
  * @returns The result of the verification and any failures.
52
40
  * @throws NotFoundError if the proof is not found.
53
41
  */
54
- verify(id: string, proofObject: IJsonLdNodeObject): Promise<IImmutableProofVerification>;
42
+ verify(id: string): Promise<IImmutableProofVerification>;
55
43
  /**
56
44
  * Remove the immutable storage for the proof.
57
45
  * @param id The id of the proof to remove the storage from.
@@ -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";
@@ -3,13 +3,13 @@
3
3
  */
4
4
  export interface IImmutableProofServiceConfig {
5
5
  /**
6
- * The assertion method id to use for the stream.
7
- * @default immutable-proof
6
+ * The verification method id to use for the proof.
7
+ * @default immutable-proof-assertion
8
8
  */
9
- assertionMethodId?: string;
9
+ verificationMethodId?: string;
10
10
  /**
11
- * The key to use in the proof config.
12
- * @default immutable-proof
11
+ * The key to use in the proof hash.
12
+ * @default immutable-proof-hash
13
13
  */
14
- proofConfigKeyId?: string;
14
+ proofHashKeyId?: string;
15
15
  }
@@ -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
@@ -1,5 +1,5 @@
1
1
  # @twin.org/immutable-proof-service - Changelog
2
2
 
3
- ## v0.0.1-next.2
3
+ ## v0.0.1-next.20
4
4
 
5
5
  - Initial Release