@twin.org/immutable-proof-service 0.0.1-next.1

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.
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Class describing the immutable proof.
3
+ */
4
+ export declare class ImmutableProof {
5
+ /**
6
+ * The id of the proof.
7
+ */
8
+ id: string;
9
+ /**
10
+ * The identity of the node which controls the proof.
11
+ */
12
+ nodeIdentity: string;
13
+ /**
14
+ * The identity of the user which created the proof.
15
+ */
16
+ userIdentity: string;
17
+ /**
18
+ * The date/time of when the proof was created.
19
+ */
20
+ dateCreated: string;
21
+ /**
22
+ * The associated id for the item.
23
+ */
24
+ proofObjectId?: string;
25
+ /**
26
+ * The associated hash for the item.
27
+ */
28
+ proofObjectHash: string;
29
+ /**
30
+ * The immutable storage id.
31
+ */
32
+ immutableStorageId?: string;
33
+ }
@@ -0,0 +1,37 @@
1
+ import type { ICreatedResponse, IHttpRequestContext, IRestRoute, ITag } from "@twin.org/api-models";
2
+ import { type IImmutableProofCreateRequest, type IImmutableProofGetRequest, type IImmutableProofGetResponse, type IImmutableProofVerifyRequest, type IImmutableProofVerifyResponse } from "@twin.org/immutable-proof-models";
3
+ /**
4
+ * The tag to associate with the routes.
5
+ */
6
+ export declare const tagsImmutableProof: ITag[];
7
+ /**
8
+ * The REST routes for immutable proof.
9
+ * @param baseRouteName Prefix to prepend to the paths.
10
+ * @param componentName The name of the component to use in the routes stored in the ComponentFactory.
11
+ * @returns The generated routes.
12
+ */
13
+ export declare function generateRestRoutesImmutableProof(baseRouteName: string, componentName: string): IRestRoute[];
14
+ /**
15
+ * Create a proof.
16
+ * @param httpRequestContext The request context for the API.
17
+ * @param componentName The name of the component to use in the routes.
18
+ * @param request The request.
19
+ * @returns The response object with additional http response properties.
20
+ */
21
+ export declare function immutableProofCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: IImmutableProofCreateRequest): Promise<ICreatedResponse>;
22
+ /**
23
+ * Get the proof.
24
+ * @param httpRequestContext The request context for the API.
25
+ * @param componentName The name of the component to use in the routes.
26
+ * @param request The request.
27
+ * @returns The response object with additional http response properties.
28
+ */
29
+ export declare function immutableProofGet(httpRequestContext: IHttpRequestContext, componentName: string, request: IImmutableProofGetRequest): Promise<IImmutableProofGetResponse>;
30
+ /**
31
+ * Verify the proof.
32
+ * @param httpRequestContext The request context for the API.
33
+ * @param componentName The name of the component to use in the routes.
34
+ * @param request The request.
35
+ * @returns The response object with additional http response properties.
36
+ */
37
+ export declare function immutableProofVerify(httpRequestContext: IHttpRequestContext, componentName: string, request: IImmutableProofVerifyRequest): Promise<IImmutableProofVerifyResponse>;
@@ -0,0 +1,66 @@
1
+ import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import { ImmutableProofFailure, type IImmutableProof, type IImmutableProofComponent } from "@twin.org/immutable-proof-models";
3
+ import type { IImmutableProofServiceConfig } from "./models/IImmutableProofServiceConfig";
4
+ /**
5
+ * Class for performing immutable proof operations.
6
+ */
7
+ export declare class ImmutableProofService implements IImmutableProofComponent {
8
+ /**
9
+ * The namespace for the service.
10
+ */
11
+ static readonly NAMESPACE: string;
12
+ /**
13
+ * Runtime name for the class.
14
+ */
15
+ readonly CLASS_NAME: string;
16
+ /**
17
+ * Create a new instance of ImmutableProofService.
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
+ */
25
+ constructor(options?: {
26
+ vaultConnectorType?: string;
27
+ immutableProofEntityStorageType?: string;
28
+ immutableStorageType?: string;
29
+ config?: IImmutableProofServiceConfig;
30
+ identityConnectorType?: string;
31
+ });
32
+ /**
33
+ * Create a new authentication proof.
34
+ * @param proofObject The object for the proof as JSON-LD.
35
+ * @param userIdentity The identity to create the immutable proof operation with.
36
+ * @param nodeIdentity The node identity to use for vault operations.
37
+ * @returns The id of the new authentication proof.
38
+ */
39
+ create(proofObject: IJsonLdNodeObject, userIdentity?: string, nodeIdentity?: string): Promise<string>;
40
+ /**
41
+ * Get an authentication proof.
42
+ * @param id The id of the proof to get.
43
+ * @returns The proof.
44
+ * @throws NotFoundError if the proof is not found.
45
+ */
46
+ get(id: string): Promise<IImmutableProof>;
47
+ /**
48
+ * Verify an authentication proof.
49
+ * @param id The id of the proof to verify.
50
+ * @param proofObject The object to verify as JSON-LD.
51
+ * @returns The result of the verification and any failures.
52
+ * @throws NotFoundError if the proof is not found.
53
+ */
54
+ verify(id: string, proofObject: IJsonLdNodeObject): Promise<{
55
+ verified: boolean;
56
+ failure?: ImmutableProofFailure;
57
+ }>;
58
+ /**
59
+ * Remove the immutable storage for the proof.
60
+ * @param id The id of the proof to remove the storage from.
61
+ * @param nodeIdentity The node identity to use for vault operations.
62
+ * @returns Nothing.
63
+ * @throws NotFoundError if the proof is not found.
64
+ */
65
+ removeImmutable(id: string, nodeIdentity?: string): Promise<void>;
66
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./immutableProofRoutes";
2
+ export * from "./immutableProofService";
3
+ export * from "./entities/immutableProof";
4
+ export * from "./models/IImmutableProofServiceConfig";
5
+ export * from "./restEntryPoints";
6
+ export * from "./schema";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Configuration for the immutable proof service.
3
+ */
4
+ export interface IImmutableProofServiceConfig {
5
+ /**
6
+ * The assertion method id to use for the stream.
7
+ * @default immutable-proof
8
+ */
9
+ assertionMethodId?: string;
10
+ /**
11
+ * The key to use in the proof config.
12
+ * @default immutable-proof
13
+ */
14
+ proofConfigKeyId?: string;
15
+ }
@@ -0,0 +1,2 @@
1
+ import type { IRestRouteEntryPoint } from "@twin.org/api-models";
2
+ export declare const restEntryPoints: IRestRouteEntryPoint[];
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Initialize the schema for the immutable proof entity storage connector.
3
+ */
4
+ export declare function initSchema(): void;
@@ -0,0 +1,5 @@
1
+ # @twin.org/immutable-proof-service - Changelog
2
+
3
+ ## v0.0.1-next.1
4
+
5
+ - Initial Release
@@ -0,0 +1 @@
1
+ # @twin.org/immutable-proof-service - Examples