@gtsc/attestation-rest-client
Advanced tools
Comparing version 0.0.3-next.2 to 0.0.3-next.5
import { BaseRestClient, type IBaseRestClientConfig } from "@gtsc/api-models"; | ||
import type { IAttestation } from "@gtsc/attestation-models"; | ||
import type { IAttestation, IAttestationInformation } from "@gtsc/attestation-models"; | ||
import type { IRequestContext } from "@gtsc/services"; | ||
import type { IDidProof } from "@gtsc/standards-w3c-did"; | ||
/** | ||
@@ -15,16 +14,34 @@ * Client for performing attestation through to REST endpoints. | ||
/** | ||
* Sign the data and return the proof. | ||
* Attest the data and return the collated information. | ||
* @param requestContext The context for the request. | ||
* @param data The data to sign. | ||
* @returns The proof for the data with the id set as a unique identifier for the data. | ||
* @param controllerAddress The controller address for the attestation. | ||
* @param verificationMethodId The identity verification method to use for attesting the data. | ||
* @param data The data to attest. | ||
* @param options Additional options for the attestation service. | ||
* @param options.namespace The namespace of the connector to use for the attestation, defaults to service configured namespace. | ||
* @returns The collated attestation data. | ||
*/ | ||
sign(requestContext: IRequestContext, data: unknown): Promise<IDidProof>; | ||
attest<T = unknown>(requestContext: IRequestContext, controllerAddress: string, verificationMethodId: string, data: T, options?: { | ||
namespace?: string; | ||
}): Promise<IAttestationInformation<T>>; | ||
/** | ||
* Verify the data against the proof the proof. | ||
* Resolve and verify the attestation id. | ||
* @param requestContext The context for the request. | ||
* @param data The data to verify. | ||
* @param proof The proof to verify against. | ||
* @returns True if the verification is successful. | ||
* @param attestationId The attestation id to verify. | ||
* @returns The verified attestation details. | ||
*/ | ||
verify(requestContext: IRequestContext, data: unknown, proof: IDidProof): Promise<boolean>; | ||
verify<T>(requestContext: IRequestContext, attestationId: string): Promise<{ | ||
verified: boolean; | ||
failure?: string; | ||
information?: Partial<IAttestationInformation<T>>; | ||
}>; | ||
/** | ||
* Transfer the attestation to a new holder. | ||
* @param requestContext The context for the request. | ||
* @param attestationId The attestation to transfer. | ||
* @param holderControllerAddress The new controller address of the attestation belonging to the holder. | ||
* @param holderIdentity The holder identity of the attestation. | ||
* @returns The updated attestation details. | ||
*/ | ||
transfer<T = unknown>(requestContext: IRequestContext, attestationId: string, holderControllerAddress: string, holderIdentity: string): Promise<IAttestationInformation<T>>; | ||
} |
@@ -21,3 +21,3 @@ [**@gtsc/attestation-rest-client**](attestation-rest-client/overview.md) • **Docs** | ||
Detailed reference documentation for the API can be found in [docs/reference/modules.md](docs/reference/modules.md) | ||
Detailed reference documentation for the API can be found in [docs/reference/globals.md](docs/reference/globals.md) | ||
@@ -24,0 +24,0 @@ ## Changelog |
@@ -41,2 +41,20 @@ [**@gtsc/attestation-rest-client**](../overview.md) • **Docs** | ||
### getEndpointWithPrefix() | ||
> **getEndpointWithPrefix**(): `string` | ||
Get the endpoint with the prefix for the namespace. | ||
#### Returns | ||
`string` | ||
The endpoint with namespace prefix attached. | ||
#### Inherited from | ||
`BaseRestClient.getEndpointWithPrefix` | ||
*** | ||
### fetch() | ||
@@ -84,26 +102,60 @@ | ||
### getEndpointWithPrefix() | ||
### attest() | ||
> **getEndpointWithPrefix**(): `string` | ||
> **attest**\<`T`\>(`requestContext`, `controllerAddress`, `verificationMethodId`, `data`, `options`?): `Promise`\<`IAttestationInformation`\<`T`\>\> | ||
Get the endpoint with the prefix for the namespace. | ||
Attest the data and return the collated information. | ||
#### Type parameters | ||
• **T** = `unknown` | ||
#### Parameters | ||
• **requestContext**: `IRequestContext` | ||
The context for the request. | ||
• **controllerAddress**: `string` | ||
The controller address for the attestation. | ||
• **verificationMethodId**: `string` | ||
The identity verification method to use for attesting the data. | ||
• **data**: `T` | ||
The data to attest. | ||
• **options?** | ||
Additional options for the attestation service. | ||
• **options.namespace?**: `string` | ||
The namespace of the connector to use for the attestation, defaults to service configured namespace. | ||
#### Returns | ||
`string` | ||
`Promise`\<`IAttestationInformation`\<`T`\>\> | ||
The endpoint with namespace prefix attached. | ||
The collated attestation data. | ||
#### Inherited from | ||
#### Implementation of | ||
`BaseRestClient.getEndpointWithPrefix` | ||
`IAttestation.attest` | ||
*** | ||
### sign() | ||
### verify() | ||
> **sign**(`requestContext`, `data`): `Promise`\<`IDidProof`\> | ||
> **verify**\<`T`\>(`requestContext`, `attestationId`): `Promise`\<`object`\> | ||
Sign the data and return the proof. | ||
Resolve and verify the attestation id. | ||
#### Type parameters | ||
• **T** | ||
#### Parameters | ||
@@ -115,24 +167,40 @@ | ||
• **data**: `unknown` | ||
• **attestationId**: `string` | ||
The data to sign. | ||
The attestation id to verify. | ||
#### Returns | ||
`Promise`\<`IDidProof`\> | ||
`Promise`\<`object`\> | ||
The proof for the data with the id set as a unique identifier for the data. | ||
The verified attestation details. | ||
##### verified | ||
> **verified**: `boolean` | ||
##### failure? | ||
> `optional` **failure**: `string` | ||
##### information? | ||
> `optional` **information**: `Partial`\<`IAttestationInformation`\<`T`\>\> | ||
#### Implementation of | ||
`IAttestation.sign` | ||
`IAttestation.verify` | ||
*** | ||
### verify() | ||
### transfer() | ||
> **verify**(`requestContext`, `data`, `proof`): `Promise`\<`boolean`\> | ||
> **transfer**\<`T`\>(`requestContext`, `attestationId`, `holderControllerAddress`, `holderIdentity`): `Promise`\<`IAttestationInformation`\<`T`\>\> | ||
Verify the data against the proof the proof. | ||
Transfer the attestation to a new holder. | ||
#### Type parameters | ||
• **T** = `unknown` | ||
#### Parameters | ||
@@ -144,18 +212,22 @@ | ||
• **data**: `unknown` | ||
• **attestationId**: `string` | ||
The data to verify. | ||
The attestation to transfer. | ||
• **proof**: `IDidProof` | ||
• **holderControllerAddress**: `string` | ||
The proof to verify against. | ||
The new controller address of the attestation belonging to the holder. | ||
• **holderIdentity**: `string` | ||
The holder identity of the attestation. | ||
#### Returns | ||
`Promise`\<`boolean`\> | ||
`Promise`\<`IAttestationInformation`\<`T`\>\> | ||
True if the verification is successful. | ||
The updated attestation details. | ||
#### Implementation of | ||
`IAttestation.verify` | ||
`IAttestation.transfer` |
{ | ||
"name": "@gtsc/attestation-rest-client", | ||
"version": "0.0.3-next.2", | ||
"version": "0.0.3-next.5", | ||
"description": "Attestation contract implementation which can connect to REST endpoints", | ||
@@ -18,3 +18,3 @@ "repository": { | ||
"@gtsc/api-models": "next", | ||
"@gtsc/attestation-models": "0.0.3-next.2", | ||
"@gtsc/attestation-models": "0.0.3-next.5", | ||
"@gtsc/core": "next", | ||
@@ -21,0 +21,0 @@ "@gtsc/entity": "next", |
@@ -17,3 +17,3 @@ # GTSC Attestation REST Client | ||
Detailed reference documentation for the API can be found in [docs/reference/modules.md](docs/reference/modules.md) | ||
Detailed reference documentation for the API can be found in [docs/reference/globals.md](docs/reference/globals.md) | ||
@@ -20,0 +20,0 @@ ## Changelog |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29137
235
+ Added@gtsc/attestation-models@0.0.3-next.5(transitive)
- Removed@gtsc/attestation-models@0.0.3-next.2(transitive)