@triveria/wallet 0.0.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.
- package/api.js +1116 -0
- package/auth.js +27 -0
- package/base.js +68 -0
- package/client.js +31 -0
- package/common.js +161 -0
- package/configuration.js +43 -0
- package/index.js +33 -0
- package/package.json +21 -0
package/auth.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.RequestToken = void 0;
|
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
|
17
|
+
const baseURL = process.env.AUTH_BASE_URL || "https://dev-f64e1ekbjnqzle8o.eu.auth0.com";
|
|
18
|
+
function RequestToken(clientId, clientSecret) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const body = `{"client_id":"${clientId}","client_secret":"${clientSecret}","audience":"https://wallet.dev.triveria.io","grant_type":"client_credentials"}`, headers = { 'content-type': 'application/json' };
|
|
21
|
+
const { data: { access_token } } = yield axios_1.default.post(`${baseURL}/oauth/token`, body, {
|
|
22
|
+
headers,
|
|
23
|
+
});
|
|
24
|
+
return access_token;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.RequestToken = RequestToken;
|
package/base.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Triveria Wallet API
|
|
6
|
+
* Triveria Wallet API allows to manage credentials inside a specific wallet and interactions between wallets as specified by the OIDC4VC specification.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.operationServerMap = exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
|
|
20
|
+
const axios_1 = __importDefault(require("axios"));
|
|
21
|
+
exports.BASE_PATH = "/api/v1".replace(/\/+$/, "");
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @export
|
|
25
|
+
*/
|
|
26
|
+
exports.COLLECTION_FORMATS = {
|
|
27
|
+
csv: ",",
|
|
28
|
+
ssv: " ",
|
|
29
|
+
tsv: "\t",
|
|
30
|
+
pipes: "|",
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @export
|
|
35
|
+
* @class BaseAPI
|
|
36
|
+
*/
|
|
37
|
+
class BaseAPI {
|
|
38
|
+
constructor(configuration, basePath = exports.BASE_PATH, axios = axios_1.default) {
|
|
39
|
+
var _a;
|
|
40
|
+
this.basePath = basePath;
|
|
41
|
+
this.axios = axios;
|
|
42
|
+
if (configuration) {
|
|
43
|
+
this.configuration = configuration;
|
|
44
|
+
this.basePath = (_a = configuration.basePath) !== null && _a !== void 0 ? _a : basePath;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.BaseAPI = BaseAPI;
|
|
49
|
+
;
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @export
|
|
53
|
+
* @class RequiredError
|
|
54
|
+
* @extends {Error}
|
|
55
|
+
*/
|
|
56
|
+
class RequiredError extends Error {
|
|
57
|
+
constructor(field, msg) {
|
|
58
|
+
super(msg);
|
|
59
|
+
this.field = field;
|
|
60
|
+
this.name = "RequiredError";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.RequiredError = RequiredError;
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @export
|
|
67
|
+
*/
|
|
68
|
+
exports.operationServerMap = {};
|
package/client.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Client = void 0;
|
|
7
|
+
const api_1 = require("./api");
|
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
const auth_1 = require("./auth");
|
|
10
|
+
/**
|
|
11
|
+
* DefaultApi - object-oriented interface
|
|
12
|
+
* @export
|
|
13
|
+
* @class DefaultApi
|
|
14
|
+
* @extends {DefaultApi}
|
|
15
|
+
*/
|
|
16
|
+
class Client extends api_1.DefaultApi {
|
|
17
|
+
constructor(clientId, clientSecret, baseURL = "https://wallet.dev.triveria.io/api/v1", axios = axios_1.default) {
|
|
18
|
+
super({
|
|
19
|
+
accessToken: (0, auth_1.RequestToken)(clientId, clientSecret),
|
|
20
|
+
basePath: baseURL,
|
|
21
|
+
isJsonMime,
|
|
22
|
+
}, baseURL, axios);
|
|
23
|
+
this.baseURL = baseURL;
|
|
24
|
+
this.axios = axios;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.Client = Client;
|
|
28
|
+
function isJsonMime(mime) {
|
|
29
|
+
const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
30
|
+
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
31
|
+
}
|
package/common.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Triveria Wallet API
|
|
6
|
+
* Triveria Wallet API allows to manage credentials inside a specific wallet and interactions between wallets as specified by the OIDC4VC specification.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
|
|
26
|
+
const base_1 = require("./base");
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @export
|
|
30
|
+
*/
|
|
31
|
+
exports.DUMMY_BASE_URL = 'https://example.com';
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @throws {RequiredError}
|
|
35
|
+
* @export
|
|
36
|
+
*/
|
|
37
|
+
const assertParamExists = function (functionName, paramName, paramValue) {
|
|
38
|
+
if (paramValue === null || paramValue === undefined) {
|
|
39
|
+
throw new base_1.RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.assertParamExists = assertParamExists;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @export
|
|
46
|
+
*/
|
|
47
|
+
const setApiKeyToObject = function (object, keyParamName, configuration) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
if (configuration && configuration.apiKey) {
|
|
50
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
51
|
+
? yield configuration.apiKey(keyParamName)
|
|
52
|
+
: yield configuration.apiKey;
|
|
53
|
+
object[keyParamName] = localVarApiKeyValue;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
exports.setApiKeyToObject = setApiKeyToObject;
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @export
|
|
61
|
+
*/
|
|
62
|
+
const setBasicAuthToObject = function (object, configuration) {
|
|
63
|
+
if (configuration && (configuration.username || configuration.password)) {
|
|
64
|
+
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.setBasicAuthToObject = setBasicAuthToObject;
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @export
|
|
71
|
+
*/
|
|
72
|
+
const setBearerAuthToObject = function (object, configuration) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
if (configuration && configuration.accessToken) {
|
|
75
|
+
const accessToken = typeof configuration.accessToken === 'function'
|
|
76
|
+
? yield configuration.accessToken()
|
|
77
|
+
: yield configuration.accessToken;
|
|
78
|
+
object["Authorization"] = "Bearer " + accessToken;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
exports.setBearerAuthToObject = setBearerAuthToObject;
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @export
|
|
86
|
+
*/
|
|
87
|
+
const setOAuthToObject = function (object, name, scopes, configuration) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
if (configuration && configuration.accessToken) {
|
|
90
|
+
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
91
|
+
? yield configuration.accessToken(name, scopes)
|
|
92
|
+
: yield configuration.accessToken;
|
|
93
|
+
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
exports.setOAuthToObject = setOAuthToObject;
|
|
98
|
+
function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
|
|
99
|
+
if (parameter == null)
|
|
100
|
+
return;
|
|
101
|
+
if (typeof parameter === "object") {
|
|
102
|
+
if (Array.isArray(parameter)) {
|
|
103
|
+
parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
if (urlSearchParams.has(key)) {
|
|
111
|
+
urlSearchParams.append(key, parameter);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
urlSearchParams.set(key, parameter);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
*
|
|
120
|
+
* @export
|
|
121
|
+
*/
|
|
122
|
+
const setSearchParams = function (url, ...objects) {
|
|
123
|
+
const searchParams = new URLSearchParams(url.search);
|
|
124
|
+
setFlattenedQueryParams(searchParams, objects);
|
|
125
|
+
url.search = searchParams.toString();
|
|
126
|
+
};
|
|
127
|
+
exports.setSearchParams = setSearchParams;
|
|
128
|
+
/**
|
|
129
|
+
*
|
|
130
|
+
* @export
|
|
131
|
+
*/
|
|
132
|
+
const serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
|
133
|
+
const nonString = typeof value !== 'string';
|
|
134
|
+
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
135
|
+
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
136
|
+
: nonString;
|
|
137
|
+
return needsSerialization
|
|
138
|
+
? JSON.stringify(value !== undefined ? value : {})
|
|
139
|
+
: (value || "");
|
|
140
|
+
};
|
|
141
|
+
exports.serializeDataIfNeeded = serializeDataIfNeeded;
|
|
142
|
+
/**
|
|
143
|
+
*
|
|
144
|
+
* @export
|
|
145
|
+
*/
|
|
146
|
+
const toPathString = function (url) {
|
|
147
|
+
return url.pathname + url.search + url.hash;
|
|
148
|
+
};
|
|
149
|
+
exports.toPathString = toPathString;
|
|
150
|
+
/**
|
|
151
|
+
*
|
|
152
|
+
* @export
|
|
153
|
+
*/
|
|
154
|
+
const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
155
|
+
return (axios = globalAxios, basePath = BASE_PATH) => {
|
|
156
|
+
var _a;
|
|
157
|
+
const axiosRequestArgs = Object.assign(Object.assign({}, axiosArgs.options), { url: (axios.defaults.baseURL ? '' : (_a = configuration === null || configuration === void 0 ? void 0 : configuration.basePath) !== null && _a !== void 0 ? _a : basePath) + axiosArgs.url });
|
|
158
|
+
return axios.request(axiosRequestArgs);
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
exports.createRequestFunction = createRequestFunction;
|
package/configuration.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Triveria Wallet API
|
|
6
|
+
* Triveria Wallet API allows to manage credentials inside a specific wallet and interactions between wallets as specified by the OIDC4VC specification.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.Configuration = void 0;
|
|
17
|
+
class Configuration {
|
|
18
|
+
constructor(param = {}) {
|
|
19
|
+
this.apiKey = param.apiKey;
|
|
20
|
+
this.username = param.username;
|
|
21
|
+
this.password = param.password;
|
|
22
|
+
this.accessToken = param.accessToken;
|
|
23
|
+
this.basePath = param.basePath;
|
|
24
|
+
this.serverIndex = param.serverIndex;
|
|
25
|
+
this.baseOptions = param.baseOptions;
|
|
26
|
+
this.formDataCtor = param.formDataCtor;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check if the given MIME is a JSON MIME.
|
|
30
|
+
* JSON MIME examples:
|
|
31
|
+
* application/json
|
|
32
|
+
* application/json; charset=UTF8
|
|
33
|
+
* APPLICATION/JSON
|
|
34
|
+
* application/vnd.company+json
|
|
35
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
36
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
37
|
+
*/
|
|
38
|
+
isJsonMime(mime) {
|
|
39
|
+
const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
40
|
+
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.Configuration = Configuration;
|
package/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Triveria Wallet API
|
|
6
|
+
* Triveria Wallet API allows to manage credentials inside a specific wallet and interactions between wallets as specified by the OIDC4VC specification.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
27
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
__exportStar(require("./api"), exports);
|
|
31
|
+
__exportStar(require("./configuration"), exports);
|
|
32
|
+
__exportStar(require("./client"), exports);
|
|
33
|
+
__exportStar(require("./auth"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@triveria/wallet",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"description": "",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"build": "tsc && cp package.json dist/"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"axios": "^1.6.5"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^20.10.6",
|
|
19
|
+
"typescript": "^5.3.3"
|
|
20
|
+
}
|
|
21
|
+
}
|