@triveria/wallet 0.0.116 → 0.0.117

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.
Files changed (4) hide show
  1. package/api.d.ts +72 -0
  2. package/api.js +90 -0
  3. package/common.js +40 -1
  4. package/package.json +1 -1
package/api.d.ts CHANGED
@@ -13,6 +13,31 @@ import type { Configuration } from './configuration';
13
13
  import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
14
14
  import type { RequestArgs } from './base';
15
15
  import { BaseAPI } from './base';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface AccessTokenResponse
20
+ */
21
+ export interface AccessTokenResponse {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof AccessTokenResponse
26
+ */
27
+ 'access_token': string;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof AccessTokenResponse
32
+ */
33
+ 'token_type': string;
34
+ /**
35
+ *
36
+ * @type {string}
37
+ * @memberof AccessTokenResponse
38
+ */
39
+ 'expires_in': string;
40
+ }
16
41
  /**
17
42
  * TBD
18
43
  * @export
@@ -1207,6 +1232,12 @@ export interface VerifyInitRequest {
1207
1232
  * @memberof VerifyInitRequest
1208
1233
  */
1209
1234
  'verifierScope': string;
1235
+ /**
1236
+ * Unique ID of a verifier state to which can be used later to retrieve verified data from a temporary storage.
1237
+ * @type {string}
1238
+ * @memberof VerifyInitRequest
1239
+ */
1240
+ 'verifierState'?: string;
1210
1241
  }
1211
1242
  /**
1212
1243
  *
@@ -1530,6 +1561,16 @@ export declare const DefaultApiAxiosParamCreator: (configuration?: Configuration
1530
1561
  * @throws {RequiredError}
1531
1562
  */
1532
1563
  issuerCredentialTypesList: (url: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
1564
+ /**
1565
+ *
1566
+ * @param {string} grantType Value MUST be set to \\\&quot;authorization_code\\\&quot;.
1567
+ * @param {string} code The authorization code received from the.
1568
+ * @param {string} [redirectUri] REQUIRED, if the \\\&quot;redirect_uri\\\&quot; parameter was included in the authorization request.
1569
+ * @param {string} [clientId] REQUIRED, if the client is not authenticating with the authorization server.
1570
+ * @param {*} [options] Override http request option.
1571
+ * @throws {RequiredError}
1572
+ */
1573
+ oauth2Token: (grantType: string, code: string, redirectUri?: string, clientId?: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
1533
1574
  /**
1534
1575
  * Issue verifiable credential using OIDC4VCI offer acceptance
1535
1576
  * @param {string} walletId
@@ -1812,6 +1853,16 @@ export declare const DefaultApiFp: (configuration?: Configuration) => {
1812
1853
  * @throws {RequiredError}
1813
1854
  */
1814
1855
  issuerCredentialTypesList(url: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<CredentialType>>>;
1856
+ /**
1857
+ *
1858
+ * @param {string} grantType Value MUST be set to \\\&quot;authorization_code\\\&quot;.
1859
+ * @param {string} code The authorization code received from the.
1860
+ * @param {string} [redirectUri] REQUIRED, if the \\\&quot;redirect_uri\\\&quot; parameter was included in the authorization request.
1861
+ * @param {string} [clientId] REQUIRED, if the client is not authenticating with the authorization server.
1862
+ * @param {*} [options] Override http request option.
1863
+ * @throws {RequiredError}
1864
+ */
1865
+ oauth2Token(grantType: string, code: string, redirectUri?: string, clientId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AccessTokenResponse>>;
1815
1866
  /**
1816
1867
  * Issue verifiable credential using OIDC4VCI offer acceptance
1817
1868
  * @param {string} walletId
@@ -2094,6 +2145,16 @@ export declare const DefaultApiFactory: (configuration?: Configuration, basePath
2094
2145
  * @throws {RequiredError}
2095
2146
  */
2096
2147
  issuerCredentialTypesList(url: string, options?: any): AxiosPromise<Array<CredentialType>>;
2148
+ /**
2149
+ *
2150
+ * @param {string} grantType Value MUST be set to \\\&quot;authorization_code\\\&quot;.
2151
+ * @param {string} code The authorization code received from the.
2152
+ * @param {string} [redirectUri] REQUIRED, if the \\\&quot;redirect_uri\\\&quot; parameter was included in the authorization request.
2153
+ * @param {string} [clientId] REQUIRED, if the client is not authenticating with the authorization server.
2154
+ * @param {*} [options] Override http request option.
2155
+ * @throws {RequiredError}
2156
+ */
2157
+ oauth2Token(grantType: string, code: string, redirectUri?: string, clientId?: string, options?: any): AxiosPromise<AccessTokenResponse>;
2097
2158
  /**
2098
2159
  * Issue verifiable credential using OIDC4VCI offer acceptance
2099
2160
  * @param {string} walletId
@@ -2394,6 +2455,17 @@ export declare class DefaultApi extends BaseAPI {
2394
2455
  * @memberof DefaultApi
2395
2456
  */
2396
2457
  issuerCredentialTypesList(url: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<CredentialType[], any>>;
2458
+ /**
2459
+ *
2460
+ * @param {string} grantType Value MUST be set to \\\&quot;authorization_code\\\&quot;.
2461
+ * @param {string} code The authorization code received from the.
2462
+ * @param {string} [redirectUri] REQUIRED, if the \\\&quot;redirect_uri\\\&quot; parameter was included in the authorization request.
2463
+ * @param {string} [clientId] REQUIRED, if the client is not authenticating with the authorization server.
2464
+ * @param {*} [options] Override http request option.
2465
+ * @throws {RequiredError}
2466
+ * @memberof DefaultApi
2467
+ */
2468
+ oauth2Token(grantType: string, code: string, redirectUri?: string, clientId?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<AccessTokenResponse, any>>;
2397
2469
  /**
2398
2470
  * Issue verifiable credential using OIDC4VCI offer acceptance
2399
2471
  * @param {string} walletId
package/api.js CHANGED
@@ -663,6 +663,53 @@ const DefaultApiAxiosParamCreator = function (configuration) {
663
663
  options: localVarRequestOptions,
664
664
  };
665
665
  }),
666
+ /**
667
+ *
668
+ * @param {string} grantType Value MUST be set to \\\&quot;authorization_code\\\&quot;.
669
+ * @param {string} code The authorization code received from the.
670
+ * @param {string} [redirectUri] REQUIRED, if the \\\&quot;redirect_uri\\\&quot; parameter was included in the authorization request.
671
+ * @param {string} [clientId] REQUIRED, if the client is not authenticating with the authorization server.
672
+ * @param {*} [options] Override http request option.
673
+ * @throws {RequiredError}
674
+ */
675
+ oauth2Token: (grantType, code, redirectUri, clientId, options = {}) => __awaiter(this, void 0, void 0, function* () {
676
+ // verify required parameter 'grantType' is not null or undefined
677
+ (0, common_1.assertParamExists)('oauth2Token', 'grantType', grantType);
678
+ // verify required parameter 'code' is not null or undefined
679
+ (0, common_1.assertParamExists)('oauth2Token', 'code', code);
680
+ const localVarPath = `/oauth2/token`;
681
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
682
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
683
+ let baseOptions;
684
+ if (configuration) {
685
+ baseOptions = configuration.baseOptions;
686
+ }
687
+ const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
688
+ const localVarHeaderParameter = {};
689
+ const localVarQueryParameter = {};
690
+ const localVarFormParams = new URLSearchParams();
691
+ if (grantType !== undefined) {
692
+ localVarFormParams.set('grant_type', grantType);
693
+ }
694
+ if (code !== undefined) {
695
+ localVarFormParams.set('code', code);
696
+ }
697
+ if (redirectUri !== undefined) {
698
+ localVarFormParams.set('redirect_uri', redirectUri);
699
+ }
700
+ if (clientId !== undefined) {
701
+ localVarFormParams.set('client_id', clientId);
702
+ }
703
+ localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';
704
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
705
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
706
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
707
+ localVarRequestOptions.data = localVarFormParams.toString();
708
+ return {
709
+ url: (0, common_1.toPathString)(localVarUrlObj),
710
+ options: localVarRequestOptions,
711
+ };
712
+ }),
666
713
  /**
667
714
  * Issue verifiable credential using OIDC4VCI offer acceptance
668
715
  * @param {string} walletId
@@ -1581,6 +1628,24 @@ const DefaultApiFp = function (configuration) {
1581
1628
  return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1582
1629
  });
1583
1630
  },
1631
+ /**
1632
+ *
1633
+ * @param {string} grantType Value MUST be set to \\\&quot;authorization_code\\\&quot;.
1634
+ * @param {string} code The authorization code received from the.
1635
+ * @param {string} [redirectUri] REQUIRED, if the \\\&quot;redirect_uri\\\&quot; parameter was included in the authorization request.
1636
+ * @param {string} [clientId] REQUIRED, if the client is not authenticating with the authorization server.
1637
+ * @param {*} [options] Override http request option.
1638
+ * @throws {RequiredError}
1639
+ */
1640
+ oauth2Token(grantType, code, redirectUri, clientId, options) {
1641
+ var _a, _b, _c;
1642
+ return __awaiter(this, void 0, void 0, function* () {
1643
+ const localVarAxiosArgs = yield localVarAxiosParamCreator.oauth2Token(grantType, code, redirectUri, clientId, options);
1644
+ const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1645
+ const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['DefaultApi.oauth2Token']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1646
+ return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1647
+ });
1648
+ },
1584
1649
  /**
1585
1650
  * Issue verifiable credential using OIDC4VCI offer acceptance
1586
1651
  * @param {string} walletId
@@ -2051,6 +2116,18 @@ const DefaultApiFactory = function (configuration, basePath, axios) {
2051
2116
  issuerCredentialTypesList(url, options) {
2052
2117
  return localVarFp.issuerCredentialTypesList(url, options).then((request) => request(axios, basePath));
2053
2118
  },
2119
+ /**
2120
+ *
2121
+ * @param {string} grantType Value MUST be set to \\\&quot;authorization_code\\\&quot;.
2122
+ * @param {string} code The authorization code received from the.
2123
+ * @param {string} [redirectUri] REQUIRED, if the \\\&quot;redirect_uri\\\&quot; parameter was included in the authorization request.
2124
+ * @param {string} [clientId] REQUIRED, if the client is not authenticating with the authorization server.
2125
+ * @param {*} [options] Override http request option.
2126
+ * @throws {RequiredError}
2127
+ */
2128
+ oauth2Token(grantType, code, redirectUri, clientId, options) {
2129
+ return localVarFp.oauth2Token(grantType, code, redirectUri, clientId, options).then((request) => request(axios, basePath));
2130
+ },
2054
2131
  /**
2055
2132
  * Issue verifiable credential using OIDC4VCI offer acceptance
2056
2133
  * @param {string} walletId
@@ -2423,6 +2500,19 @@ class DefaultApi extends base_1.BaseAPI {
2423
2500
  issuerCredentialTypesList(url, options) {
2424
2501
  return (0, exports.DefaultApiFp)(this.configuration).issuerCredentialTypesList(url, options).then((request) => request(this.axios, this.basePath));
2425
2502
  }
2503
+ /**
2504
+ *
2505
+ * @param {string} grantType Value MUST be set to \\\&quot;authorization_code\\\&quot;.
2506
+ * @param {string} code The authorization code received from the.
2507
+ * @param {string} [redirectUri] REQUIRED, if the \\\&quot;redirect_uri\\\&quot; parameter was included in the authorization request.
2508
+ * @param {string} [clientId] REQUIRED, if the client is not authenticating with the authorization server.
2509
+ * @param {*} [options] Override http request option.
2510
+ * @throws {RequiredError}
2511
+ * @memberof DefaultApi
2512
+ */
2513
+ oauth2Token(grantType, code, redirectUri, clientId, options) {
2514
+ return (0, exports.DefaultApiFp)(this.configuration).oauth2Token(grantType, code, redirectUri, clientId, options).then((request) => request(this.axios, this.basePath));
2515
+ }
2426
2516
  /**
2427
2517
  * Issue verifiable credential using OIDC4VCI offer acceptance
2428
2518
  * @param {string} walletId
package/common.js CHANGED
@@ -135,10 +135,49 @@ const serializeDataIfNeeded = function (value, requestOptions, configuration) {
135
135
  ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
136
136
  : nonString;
137
137
  return needsSerialization
138
- ? JSON.stringify(value !== undefined ? value : {})
138
+ ? JSON.stringify(value !== undefined ? convertMapsAndSetsToPlain(value) : {})
139
139
  : (value || "");
140
140
  };
141
141
  exports.serializeDataIfNeeded = serializeDataIfNeeded;
142
+ function convertMapsAndSetsToPlain(value) {
143
+ if (typeof Set === "undefined")
144
+ return value;
145
+ if (typeof Map === "undefined")
146
+ return value;
147
+ if (typeof value !== "object" || !value) {
148
+ return value;
149
+ }
150
+ if (value instanceof Set) {
151
+ return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
152
+ }
153
+ if (value instanceof Map) {
154
+ const entries = [];
155
+ value.forEach((value, key) => {
156
+ entries.push([key, convertMapsAndSetsToPlain(value)]);
157
+ });
158
+ return objectFromEntries(entries);
159
+ }
160
+ if (Array.isArray(value)) {
161
+ return value.map(it => convertMapsAndSetsToPlain(it));
162
+ }
163
+ return objectFromEntries(objectEntries(value)
164
+ .map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
165
+ }
166
+ /**
167
+ * Ponyfill for Object.entries
168
+ */
169
+ function objectEntries(object) {
170
+ return Object.keys(object).map(key => [key, object[key]]);
171
+ }
172
+ /**
173
+ * Ponyfill for Object.fromEntries
174
+ */
175
+ function objectFromEntries(entries) {
176
+ return [...entries].reduce((object, [key, val]) => {
177
+ object[key] = val;
178
+ return object;
179
+ }, {});
180
+ }
142
181
  /**
143
182
  *
144
183
  * @export
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@triveria/wallet",
3
3
  "private": false,
4
- "version": "0.0.116",
4
+ "version": "0.0.117",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {