@twin.org/immutable-proof-models 0.0.1-next.1 → 0.0.1-next.3

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.
@@ -16,7 +16,11 @@ const ImmutableProofTypes = {
16
16
  /**
17
17
  * Represents Immutable Proof.
18
18
  */
19
- ImmutableProof: "ImmutableProof"
19
+ ImmutableProof: "ImmutableProof",
20
+ /**
21
+ * Represents Immutable Proof Verification.
22
+ */
23
+ ImmutableProofVerification: "ImmutableProofVerification"
20
24
  };
21
25
 
22
26
  var type = "object";
@@ -14,7 +14,11 @@ const ImmutableProofTypes = {
14
14
  /**
15
15
  * Represents Immutable Proof.
16
16
  */
17
- ImmutableProof: "ImmutableProof"
17
+ ImmutableProof: "ImmutableProof",
18
+ /**
19
+ * Represents Immutable Proof Verification.
20
+ */
21
+ ImmutableProofVerification: "ImmutableProofVerification"
18
22
  };
19
23
 
20
24
  var type = "object";
@@ -5,6 +5,7 @@ export * from "./models/api/IImmutableProofGetResponse";
5
5
  export * from "./models/api/IImmutableProofVerifyRequest";
6
6
  export * from "./models/api/IImmutableProofVerifyResponse";
7
7
  export * from "./models/IImmutableProof";
8
+ export * from "./models/IImmutableProofVerification";
8
9
  export * from "./models/IImmutableProofComponent";
9
10
  export * from "./models/immutableProofFailure";
10
11
  export * from "./models/immutableProofTypes";
@@ -1,7 +1,7 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
2
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
3
3
  import type { IImmutableProof } from "./IImmutableProof";
4
- import type { ImmutableProofFailure } from "./immutableProofFailure";
4
+ import type { IImmutableProofVerification } from "./IImmutableProofVerification";
5
5
  /**
6
6
  * Interface describing an immutable proof contract.
7
7
  */
@@ -28,10 +28,7 @@ export interface IImmutableProofComponent extends IComponent {
28
28
  * @returns The result of the verification and any failures.
29
29
  * @throws NotFoundError if the proof is not found.
30
30
  */
31
- verify(id: string, proofObject: IJsonLdNodeObject): Promise<{
32
- verified: boolean;
33
- failure?: ImmutableProofFailure;
34
- }>;
31
+ verify(id: string, proofObject: IJsonLdNodeObject): Promise<IImmutableProofVerification>;
35
32
  /**
36
33
  * Remove the immutable storage for the proof.
37
34
  * @param id The id of the proof to remove the storage from.
@@ -0,0 +1,23 @@
1
+ import type { ImmutableProofFailure } from "./immutableProofFailure";
2
+ import type { ImmutableProofTypes } from "./immutableProofTypes";
3
+ /**
4
+ * Interface describing an immutable proof verification.
5
+ */
6
+ export interface IImmutableProofVerification {
7
+ /**
8
+ * JSON-LD Context.
9
+ */
10
+ "@context": typeof ImmutableProofTypes.ContextRoot;
11
+ /**
12
+ * JSON-LD Type.
13
+ */
14
+ type: typeof ImmutableProofTypes.ImmutableProofVerification;
15
+ /**
16
+ * Was the verification successful.
17
+ */
18
+ verified: boolean;
19
+ /**
20
+ * If the verification was unsuccessful the failure reason.
21
+ */
22
+ failure?: ImmutableProofFailure;
23
+ }
@@ -1,8 +1,15 @@
1
1
  import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
3
  /**
3
4
  * Verify a proof.
4
5
  */
5
6
  export interface IImmutableProofVerifyRequest {
7
+ /**
8
+ * The headers which can be used to determine the response data type.
9
+ */
10
+ headers?: {
11
+ [HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
12
+ };
6
13
  /**
7
14
  * The parameters from the path.
8
15
  */
@@ -1,19 +1,17 @@
1
- import type { ImmutableProofFailure } from "../immutableProofFailure";
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
+ import type { IImmutableProofVerification } from "../IImmutableProofVerification";
2
3
  /**
3
4
  * Response to verifying an immutable proof.
4
5
  */
5
6
  export interface IImmutableProofVerifyResponse {
6
7
  /**
7
- * The response body.
8
+ * The headers which can be used to determine the response data type.
8
9
  */
9
- body: {
10
- /**
11
- * Was the proof verified.
12
- */
13
- verified: boolean;
14
- /**
15
- * If not verified what was the failure.
16
- */
17
- failure?: ImmutableProofFailure;
10
+ headers?: {
11
+ [HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
18
12
  };
13
+ /**
14
+ * The response body.
15
+ */
16
+ body: IImmutableProofVerification;
19
17
  }
@@ -10,6 +10,10 @@ export declare const ImmutableProofTypes: {
10
10
  * Represents Immutable Proof.
11
11
  */
12
12
  readonly ImmutableProof: "ImmutableProof";
13
+ /**
14
+ * Represents Immutable Proof Verification.
15
+ */
16
+ readonly ImmutableProofVerification: "ImmutableProofVerification";
13
17
  };
14
18
  /**
15
19
  * The types of immutable proof data.
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/immutable-proof-models - Changelog
2
2
 
3
- ## v0.0.1-next.1
3
+ ## v0.0.1-next.3
4
4
 
5
5
  - Initial Release
@@ -8,6 +8,7 @@
8
8
 
9
9
  - [IImmutableProof](interfaces/IImmutableProof.md)
10
10
  - [IImmutableProofComponent](interfaces/IImmutableProofComponent.md)
11
+ - [IImmutableProofVerification](interfaces/IImmutableProofVerification.md)
11
12
  - [IImmutableProofCreateRequest](interfaces/IImmutableProofCreateRequest.md)
12
13
  - [IImmutableProofGetRequest](interfaces/IImmutableProofGetRequest.md)
13
14
  - [IImmutableProofGetResponse](interfaces/IImmutableProofGetResponse.md)
@@ -62,7 +62,7 @@ NotFoundError if the proof is not found.
62
62
 
63
63
  ### verify()
64
64
 
65
- > **verify**(`id`, `proofObject`): `Promise`\<`object`\>
65
+ > **verify**(`id`, `proofObject`): `Promise`\<[`IImmutableProofVerification`](IImmutableProofVerification.md)\>
66
66
 
67
67
  Verify an authentication proof.
68
68
 
@@ -78,18 +78,10 @@ The object to verify as JSON-LD.
78
78
 
79
79
  #### Returns
80
80
 
81
- `Promise`\<`object`\>
81
+ `Promise`\<[`IImmutableProofVerification`](IImmutableProofVerification.md)\>
82
82
 
83
83
  The result of the verification and any failures.
84
84
 
85
- ##### verified
86
-
87
- > **verified**: `boolean`
88
-
89
- ##### failure?
90
-
91
- > `optional` **failure**: [`ImmutableProofFailure`](../type-aliases/ImmutableProofFailure.md)
92
-
93
85
  #### Throws
94
86
 
95
87
  NotFoundError if the proof is not found.
@@ -0,0 +1,35 @@
1
+ # Interface: IImmutableProofVerification
2
+
3
+ Interface describing an immutable proof verification.
4
+
5
+ ## Properties
6
+
7
+ ### @context
8
+
9
+ > **@context**: `"https://schema.twindev.org/immutable-proof/"`
10
+
11
+ JSON-LD Context.
12
+
13
+ ***
14
+
15
+ ### type
16
+
17
+ > **type**: `"ImmutableProofVerification"`
18
+
19
+ JSON-LD Type.
20
+
21
+ ***
22
+
23
+ ### verified
24
+
25
+ > **verified**: `boolean`
26
+
27
+ Was the verification successful.
28
+
29
+ ***
30
+
31
+ ### failure?
32
+
33
+ > `optional` **failure**: [`ImmutableProofFailure`](../type-aliases/ImmutableProofFailure.md)
34
+
35
+ If the verification was unsuccessful the failure reason.
@@ -4,6 +4,18 @@ Verify a proof.
4
4
 
5
5
  ## Properties
6
6
 
7
+ ### headers?
8
+
9
+ > `optional` **headers**: `object`
10
+
11
+ The headers which can be used to determine the response data type.
12
+
13
+ #### accept
14
+
15
+ > **accept**: `"application/json"` \| `"application/ld+json"`
16
+
17
+ ***
18
+
7
19
  ### pathParams
8
20
 
9
21
  > **pathParams**: `object`
@@ -4,20 +4,20 @@ Response to verifying an immutable proof.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### body
7
+ ### headers?
8
8
 
9
- > **body**: `object`
9
+ > `optional` **headers**: `object`
10
10
 
11
- The response body.
11
+ The headers which can be used to determine the response data type.
12
12
 
13
- #### verified
13
+ #### content-type
14
14
 
15
- > **verified**: `boolean`
15
+ > **content-type**: `"application/json"` \| `"application/ld+json"`
16
16
 
17
- Was the proof verified.
17
+ ***
18
18
 
19
- #### failure?
19
+ ### body
20
20
 
21
- > `optional` **failure**: [`ImmutableProofFailure`](../type-aliases/ImmutableProofFailure.md)
21
+ > **body**: [`IImmutableProofVerification`](IImmutableProofVerification.md)
22
22
 
23
- If not verified what was the failure.
23
+ The response body.
@@ -17,3 +17,9 @@ The context root for the immutable proof types.
17
17
  > `readonly` **ImmutableProof**: `"ImmutableProof"` = `"ImmutableProof"`
18
18
 
19
19
  Represents Immutable Proof.
20
+
21
+ ### ImmutableProofVerification
22
+
23
+ > `readonly` **ImmutableProofVerification**: `"ImmutableProofVerification"` = `"ImmutableProofVerification"`
24
+
25
+ Represents Immutable Proof Verification.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/immutable-proof-models",
3
- "version": "0.0.1-next.1",
3
+ "version": "0.0.1-next.3",
4
4
  "description": "Models which define the structure of the immutable proof connectors and services",
5
5
  "repository": {
6
6
  "type": "git",