@sd-jwt/present 0.6.1 → 0.6.2-next.2
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/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +6 -6
- package/src/present.ts +8 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hasher, PresentationFrame } from '@sd-jwt/types';
|
|
2
2
|
import { Disclosure } from '@sd-jwt/utils';
|
|
3
|
-
import { HasherSync } from '@sd-jwt/types/src/type';
|
|
3
|
+
import { HasherSync, Extensible } from '@sd-jwt/types/src/type';
|
|
4
4
|
|
|
5
5
|
declare const presentableKeys: (rawPayload: Record<string, unknown>, disclosures: Array<Disclosure>, hasher: Hasher) => Promise<string[]>;
|
|
6
6
|
declare const presentableKeysSync: (rawPayload: Record<string, unknown>, disclosures: Array<Disclosure>, hasher: HasherSync) => string[];
|
|
@@ -12,7 +12,7 @@ declare const presentSync: <T extends Record<string, unknown>>(sdJwt: string, pr
|
|
|
12
12
|
* @param prefix The prefix to add to the keys
|
|
13
13
|
* @returns
|
|
14
14
|
*/
|
|
15
|
-
declare const transformPresentationFrame:
|
|
15
|
+
declare const transformPresentationFrame: (obj: PresentationFrame<Extensible>, prefix?: string) => string[];
|
|
16
16
|
type SerializedDisclosure = {
|
|
17
17
|
digest: string;
|
|
18
18
|
encoded: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hasher, PresentationFrame } from '@sd-jwt/types';
|
|
2
2
|
import { Disclosure } from '@sd-jwt/utils';
|
|
3
|
-
import { HasherSync } from '@sd-jwt/types/src/type';
|
|
3
|
+
import { HasherSync, Extensible } from '@sd-jwt/types/src/type';
|
|
4
4
|
|
|
5
5
|
declare const presentableKeys: (rawPayload: Record<string, unknown>, disclosures: Array<Disclosure>, hasher: Hasher) => Promise<string[]>;
|
|
6
6
|
declare const presentableKeysSync: (rawPayload: Record<string, unknown>, disclosures: Array<Disclosure>, hasher: HasherSync) => string[];
|
|
@@ -12,7 +12,7 @@ declare const presentSync: <T extends Record<string, unknown>>(sdJwt: string, pr
|
|
|
12
12
|
* @param prefix The prefix to add to the keys
|
|
13
13
|
* @returns
|
|
14
14
|
*/
|
|
15
|
-
declare const transformPresentationFrame:
|
|
15
|
+
declare const transformPresentationFrame: (obj: PresentationFrame<Extensible>, prefix?: string) => string[];
|
|
16
16
|
type SerializedDisclosure = {
|
|
17
17
|
digest: string;
|
|
18
18
|
encoded: string;
|
package/dist/index.js
CHANGED
|
@@ -105,10 +105,13 @@ var transformPresentationFrame = (obj, prefix = "") => {
|
|
|
105
105
|
if (value) {
|
|
106
106
|
acc.push(newPrefix);
|
|
107
107
|
}
|
|
108
|
-
} else {
|
|
108
|
+
} else if (typeof value === "object" && value !== null) {
|
|
109
109
|
acc.push(
|
|
110
110
|
newPrefix,
|
|
111
|
-
...transformPresentationFrame(
|
|
111
|
+
...transformPresentationFrame(
|
|
112
|
+
value,
|
|
113
|
+
newPrefix
|
|
114
|
+
)
|
|
112
115
|
);
|
|
113
116
|
}
|
|
114
117
|
return acc;
|
package/dist/index.mjs
CHANGED
|
@@ -86,10 +86,13 @@ var transformPresentationFrame = (obj, prefix = "") => {
|
|
|
86
86
|
if (value) {
|
|
87
87
|
acc.push(newPrefix);
|
|
88
88
|
}
|
|
89
|
-
} else {
|
|
89
|
+
} else if (typeof value === "object" && value !== null) {
|
|
90
90
|
acc.push(
|
|
91
91
|
newPrefix,
|
|
92
|
-
...transformPresentationFrame(
|
|
92
|
+
...transformPresentationFrame(
|
|
93
|
+
value,
|
|
94
|
+
newPrefix
|
|
95
|
+
)
|
|
93
96
|
);
|
|
94
97
|
}
|
|
95
98
|
return acc;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sd-jwt/present",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2-next.2+2e92cb3",
|
|
4
4
|
"description": "sd-jwt draft 7 implementation in typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
},
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@sd-jwt/crypto-nodejs": "0.6.
|
|
41
|
+
"@sd-jwt/crypto-nodejs": "0.6.2-next.2+2e92cb3"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@sd-jwt/decode": "0.6.
|
|
45
|
-
"@sd-jwt/types": "0.6.
|
|
46
|
-
"@sd-jwt/utils": "0.6.
|
|
44
|
+
"@sd-jwt/decode": "0.6.2-next.2+2e92cb3",
|
|
45
|
+
"@sd-jwt/types": "0.6.2-next.2+2e92cb3",
|
|
46
|
+
"@sd-jwt/utils": "0.6.2-next.2+2e92cb3"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"esm"
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "2e92cb3abc27f6dbde19c7c016bc1f8ba60f9ff6"
|
|
65
65
|
}
|
package/src/present.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
unpackSync,
|
|
16
16
|
unpackObj,
|
|
17
17
|
} from '@sd-jwt/decode';
|
|
18
|
-
import type { HasherSync } from '@sd-jwt/types/src/type';
|
|
18
|
+
import type { Extensible, HasherSync } from '@sd-jwt/types/src/type';
|
|
19
19
|
|
|
20
20
|
// Presentable keys
|
|
21
21
|
// The presentable keys are the path of JSON object that are presentable in the SD JWT
|
|
@@ -119,8 +119,8 @@ export const presentSync = <T extends Record<string, unknown>>(
|
|
|
119
119
|
* @param prefix The prefix to add to the keys
|
|
120
120
|
* @returns
|
|
121
121
|
*/
|
|
122
|
-
export const transformPresentationFrame =
|
|
123
|
-
obj: PresentationFrame<
|
|
122
|
+
export const transformPresentationFrame = (
|
|
123
|
+
obj: PresentationFrame<Extensible>,
|
|
124
124
|
prefix = '',
|
|
125
125
|
): string[] => {
|
|
126
126
|
return Object.entries(obj).reduce<string[]>((acc, [key, value]) => {
|
|
@@ -130,10 +130,13 @@ export const transformPresentationFrame = <T extends object>(
|
|
|
130
130
|
if (value) {
|
|
131
131
|
acc.push(newPrefix);
|
|
132
132
|
}
|
|
133
|
-
} else {
|
|
133
|
+
} else if (typeof value === 'object' && value !== null) {
|
|
134
134
|
acc.push(
|
|
135
135
|
newPrefix,
|
|
136
|
-
...transformPresentationFrame(
|
|
136
|
+
...transformPresentationFrame(
|
|
137
|
+
value as PresentationFrame<Extensible>,
|
|
138
|
+
newPrefix,
|
|
139
|
+
),
|
|
137
140
|
);
|
|
138
141
|
}
|
|
139
142
|
return acc;
|