@triveria/wallet 0.0.158 → 0.0.160

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 (3) hide show
  1. package/api.d.ts +6 -0
  2. package/common.js +1 -40
  3. package/package.json +1 -1
package/api.d.ts CHANGED
@@ -490,6 +490,12 @@ export interface CredentialVerifierDefinition {
490
490
  * @memberof CredentialVerifierDefinition
491
491
  */
492
492
  'presentationDefinition': PresentationDefinition;
493
+ /**
494
+ * Additional JSON schema that will be used to validate credential. This can be used to narrow down the validation process to a specific set of attributes on top of the credential validity.
495
+ * @type {Array<PresentationDefinitionInputConstraintField>}
496
+ * @memberof CredentialVerifierDefinition
497
+ */
498
+ 'credentialValidationConstraints'?: Array<PresentationDefinitionInputConstraintField>;
493
499
  }
494
500
  /**
495
501
  * The wrapper contains Verifiable Credential in both, the Credential and as Base64 signed format alongside with metadata.
package/common.js CHANGED
@@ -135,49 +135,10 @@ 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 ? convertMapsAndSetsToPlain(value) : {})
138
+ ? JSON.stringify(value !== undefined ? 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
- }
181
142
  /**
182
143
  *
183
144
  * @export
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@triveria/wallet",
3
3
  "private": false,
4
- "version": "0.0.158",
4
+ "version": "0.0.160",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {