## @affinidi-tdk/wallets-client@1.33.0

This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:

Environment

- Node.js
- Webpack
- Browserify

Language level

- ES5 - you must have a Promises/A+ library installed
- ES6

Module system

- CommonJS
- ES6 module system

It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html))

### Building

To build and compile the typescript sources to javascript use:

```
npm install
npm run build
```

### Publishing

First build the package then run `npm publish`

### Consuming

navigate to the folder of your consuming project and run one of the following commands.

_published:_

```
npm install @affinidi-tdk/wallets-client@1.33.0 --save
```

_unPublished (not recommended):_

```
npm install PATH_TO_GENERATED_PACKAGE --save
```

### Documentation for API Endpoints

All URIs are relative to *https://apse1.api.affinidi.io/cwe*

| Class           | Method                                                                                   | HTTP request                                                                       | Description                        |
| --------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------- |
| _RevocationApi_ | [**getRevocationCredentialStatus**](docs/RevocationApi.md#getrevocationcredentialstatus) | **GET** /v1/projects/{projectId}/wallets/{walletId}/revocation-statuses/{statusId} |
| _RevocationApi_ | [**getRevocationListCredential**](docs/RevocationApi.md#getrevocationlistcredential)     | **GET** /v1/wallets/{walletId}/revocation-list/{listId}                            | Return revocation list credential. |
| _RevocationApi_ | [**revokeCredential**](docs/RevocationApi.md#revokecredential)                           | **POST** /v1/wallets/{walletId}/revoke                                             | Revoke Credential.                 |
| _RevocationApi_ | [**revokeCredentials**](docs/RevocationApi.md#revokecredentials)                         | **POST** /v2/wallets/{walletId}/credentials/revoke                                 | Revoke Credentials.                |
| _WalletApi_     | [**createServiceEndpoint**](docs/WalletApi.md#createserviceendpoint)                     | **POST** /v2/wallets/{walletId}/services                                           |
| _WalletApi_     | [**createWallet**](docs/WalletApi.md#createwallet)                                       | **POST** /v1/wallets                                                               |
| _WalletApi_     | [**createWalletKey**](docs/WalletApi.md#createwalletkey)                                 | **POST** /v2/wallets/{walletId}/keys                                               |
| _WalletApi_     | [**createWalletV2**](docs/WalletApi.md#createwalletv2)                                   | **POST** /v2/wallets                                                               |
| _WalletApi_     | [**deleteWallet**](docs/WalletApi.md#deletewallet)                                       | **DELETE** /v1/wallets/{walletId}                                                  |
| _WalletApi_     | [**getWallet**](docs/WalletApi.md#getwallet)                                             | **GET** /v1/wallets/{walletId}                                                     |
| _WalletApi_     | [**listServiceEndpoints**](docs/WalletApi.md#listserviceendpoints)                       | **GET** /v2/wallets/{walletId}/services                                            |
| _WalletApi_     | [**listWalletKeys**](docs/WalletApi.md#listwalletkeys)                                   | **GET** /v2/wallets/{walletId}/keys                                                |
| _WalletApi_     | [**listWallets**](docs/WalletApi.md#listwallets)                                         | **GET** /v1/wallets                                                                |
| _WalletApi_     | [**removeServiceEndpoint**](docs/WalletApi.md#removeserviceendpoint)                     | **DELETE** /v2/wallets/{walletId}/services/{serviceId}                             |
| _WalletApi_     | [**removeWalletKey**](docs/WalletApi.md#removewalletkey)                                 | **DELETE** /v2/wallets/{walletId}/keys/{keyId}                                     |
| _WalletApi_     | [**signCredential**](docs/WalletApi.md#signcredential)                                   | **POST** /v1/wallets/{walletId}/sign-credential                                    |
| _WalletApi_     | [**signCredentialsJwt**](docs/WalletApi.md#signcredentialsjwt)                           | **POST** /v2/wallets/{walletId}/credentials/jwt/sign                               |
| _WalletApi_     | [**signCredentialsLdp**](docs/WalletApi.md#signcredentialsldp)                           | **POST** /v2/wallets/{walletId}/credentials/ldp/sign                               |
| _WalletApi_     | [**signCredentialsSdJwt**](docs/WalletApi.md#signcredentialssdjwt)                       | **POST** /v2/wallets/{walletId}/credentials/sd-jwt/sign                            |
| _WalletApi_     | [**signJwtToken**](docs/WalletApi.md#signjwttoken)                                       | **POST** /v1/wallets/{walletId}/sign-jwt                                           |
| _WalletApi_     | [**signJwtV2**](docs/WalletApi.md#signjwtv2)                                             | **POST** /v2/wallets/{walletId}/jwt/sign                                           | Sign JWT.                          |
| _WalletApi_     | [**signPresentationsLdp**](docs/WalletApi.md#signpresentationsldp)                       | **POST** /v2/wallets/{walletId}/presentations/ldp/sign                             |
| _WalletApi_     | [**updateServiceEndpoint**](docs/WalletApi.md#updateserviceendpoint)                     | **PATCH** /v2/wallets/{walletId}/services/{serviceId}                              |
| _WalletApi_     | [**updateWallet**](docs/WalletApi.md#updatewallet)                                       | **PATCH** /v1/wallets/{walletId}                                                   |
| _WalletApi_     | [**updateWalletKey**](docs/WalletApi.md#updatewalletkey)                                 | **PATCH** /v2/wallets/{walletId}/keys/{keyId}                                      |

### Documentation For Models

- [CreateWalletInput](docs/CreateWalletInput.md)
- [CreateWalletKeyInput](docs/CreateWalletKeyInput.md)
- [CreateWalletResponse](docs/CreateWalletResponse.md)
- [CreateWalletV2Input](docs/CreateWalletV2Input.md)
- [CreateWalletV2Response](docs/CreateWalletV2Response.md)
- [EntityNotFoundError](docs/EntityNotFoundError.md)
- [GetRevocationListCredentialResultDto](docs/GetRevocationListCredentialResultDto.md)
- [InvalidParameterError](docs/InvalidParameterError.md)
- [ListServiceEndpointsOK](docs/ListServiceEndpointsOK.md)
- [ListWalletKeysOK](docs/ListWalletKeysOK.md)
- [NotFoundError](docs/NotFoundError.md)
- [NotFoundErrorDetailsInner](docs/NotFoundErrorDetailsInner.md)
- [OperationForbiddenError](docs/OperationForbiddenError.md)
- [RevokeCredentialInput](docs/RevokeCredentialInput.md)
- [RevokeCredentialsInput](docs/RevokeCredentialsInput.md)
- [ServiceEndpointDto](docs/ServiceEndpointDto.md)
- [ServiceEndpointInput](docs/ServiceEndpointInput.md)
- [SignCredential400Response](docs/SignCredential400Response.md)
- [SignCredentialInputDto](docs/SignCredentialInputDto.md)
- [SignCredentialInputDtoUnsignedCredentialParams](docs/SignCredentialInputDtoUnsignedCredentialParams.md)
- [SignCredentialResultDto](docs/SignCredentialResultDto.md)
- [SignCredentialsDm2SdJwtInputDto](docs/SignCredentialsDm2SdJwtInputDto.md)
- [SignCredentialsDm2SdJwtResultDto](docs/SignCredentialsDm2SdJwtResultDto.md)
- [SignCredentialsJwtInputDto](docs/SignCredentialsJwtInputDto.md)
- [SignCredentialsJwtResultDto](docs/SignCredentialsJwtResultDto.md)
- [SignCredentialsLdpInputDto](docs/SignCredentialsLdpInputDto.md)
- [SignCredentialsLdpResultDto](docs/SignCredentialsLdpResultDto.md)
- [SignJwtToken](docs/SignJwtToken.md)
- [SignJwtTokenOK](docs/SignJwtTokenOK.md)
- [SignJwtV2InputDto](docs/SignJwtV2InputDto.md)
- [SignJwtV2ResultDto](docs/SignJwtV2ResultDto.md)
- [SignPresentationLdpInputDto](docs/SignPresentationLdpInputDto.md)
- [SignPresentationLdpResultDto](docs/SignPresentationLdpResultDto.md)
- [SigningFailedError](docs/SigningFailedError.md)
- [TooManyRequestsError](docs/TooManyRequestsError.md)
- [UpdateServiceEndpointInput](docs/UpdateServiceEndpointInput.md)
- [UpdateWalletInput](docs/UpdateWalletInput.md)
- [UpdateWalletKeyInput](docs/UpdateWalletKeyInput.md)
- [VerificationRelationship](docs/VerificationRelationship.md)
- [WalletDidType](docs/WalletDidType.md)
- [WalletDto](docs/WalletDto.md)
- [WalletDtoKeysInner](docs/WalletDtoKeysInner.md)
- [WalletKeyDto](docs/WalletKeyDto.md)
- [WalletV2Dto](docs/WalletV2Dto.md)
- [WalletsListDto](docs/WalletsListDto.md)

<a id="documentation-for-authorization"></a>

## Documentation For Authorization

Authentication schemes defined for the API:
<a id="ProjectTokenAuth"></a>

### ProjectTokenAuth

- **Type**: API key
- **API key parameter name**: authorization
- **Location**: HTTP header

#### Obtaining auth token

💡 To create personal access token (PAT), use Affinidi CLI's [create-token](https://github.com/affinidi/affinidi-cli/blob/main/docs/token.md#affinidi-token-create-token) command.

Login to your Affinidi Vault.

```bash
affinidi login
```

Check for command details if you want to set optional passphrase and keyId:

```bash
affinidi token --help
```

Create PAT:

```bash
affinidi token create-token -n YourTokenName -g -w --no-input
```

This command will return you variables to initialize AuthProvider as required below.

```ts
import { SomeClassApi, Configuration } from '@affinidi-tdk/wallets-client'
import { AuthProvider } from '@affinidi-tdk/auth-provider'

const authProvider = new AuthProvider({ tokenId, privateKey, projectId })

const api = new SomeClassApi(
  new Configuration({
    apiKey: authProvider.fetchProjectScopedToken.bind(authProvider),
  }),
)

await api.oneOfMethods()
```
