UNPKG

@affinidi/internal-api-clients

Version:
52 lines 2.46 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const tools_common_1 = require("@affinidi/tools-common"); const tools_openapi_1 = require("@affinidi/tools-openapi"); const _affinidiVault_1 = __importDefault(require("../spec/_affinidiVault")); const { CreateDidAuthRequest, ...otherMethods } = (0, tools_openapi_1.createClientMethods)(_affinidiVault_1.default); const clientMethods = (0, tools_openapi_1.wrapWithDidAuth)(CreateDidAuthRequest, otherMethods); let AffinidiVaultApiService = class AffinidiVaultApiService { constructor(options) { const didAuthSession = (0, tools_openapi_1.createDidAuthSession)(options.didAuthAdapter); this.client = (0, tools_openapi_1.createDidAuthClient)(clientMethods, didAuthSession, options.vaultUrl, options); } async searchCredentials(storageRegion, types) { return this.client.SearchCredentials({ storageRegion, queryParams: types ? { types: JSON.stringify(types) } : {}, }); } async getCredential(storageRegion, id) { return this.client.GetCredential({ storageRegion, pathParams: { id }, }); } async storeCredential(storageRegion, id, params) { return this.client.StoreCredential({ storageRegion, params, pathParams: { id }, }); } async deleteCredential(storageRegion, id) { return this.client.DeleteCredential({ storageRegion, pathParams: { id }, }); } }; AffinidiVaultApiService = __decorate([ (0, tools_common_1.profile)() ], AffinidiVaultApiService); exports.default = AffinidiVaultApiService; //# sourceMappingURL=AffinidiVaultApiService.js.map