@sd-jwt/core 0.20.1 → 0.21.0-alpha-20260916100413

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 (68) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +82 -80
  3. package/dist/index.cjs +1526 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +696 -0
  6. package/dist/index.d.mts +537 -527
  7. package/dist/index.mjs +1422 -1998
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +29 -49
  10. package/CHANGELOG.md +0 -39
  11. package/dist/index.d.ts +0 -686
  12. package/dist/index.js +0 -2100
  13. package/src/decode/decode.ts +0 -407
  14. package/src/decode/index.ts +0 -1
  15. package/src/decoy.ts +0 -15
  16. package/src/flattenJSON.ts +0 -99
  17. package/src/generalJSON.ts +0 -157
  18. package/src/index.ts +0 -1000
  19. package/src/jwt.ts +0 -286
  20. package/src/kbjwt.ts +0 -101
  21. package/src/present/index.ts +0 -1
  22. package/src/present/present.ts +0 -216
  23. package/src/sdjwt.ts +0 -384
  24. package/src/test/decode/decode.spec.ts +0 -197
  25. package/src/test/decoy.spec.ts +0 -30
  26. package/src/test/flattenJSON.spec.ts +0 -122
  27. package/src/test/generalJSON.spec.ts +0 -198
  28. package/src/test/index.spec.ts +0 -986
  29. package/src/test/jwt.spec.ts +0 -301
  30. package/src/test/kbjwt.spec.ts +0 -555
  31. package/src/test/pass.spec.ts +0 -7
  32. package/src/test/present/present.spec.ts +0 -305
  33. package/src/test/sdjwt.spec.ts +0 -384
  34. package/src/test/types/type.spec.ts +0 -88
  35. package/src/test/utils/base64url.spec.ts +0 -33
  36. package/src/test/utils/disclosure.spec.ts +0 -170
  37. package/src/test/utils/error.spec.ts +0 -15
  38. package/src/types/index.ts +0 -2
  39. package/src/types/type.ts +0 -270
  40. package/src/types/verification-error.ts +0 -55
  41. package/src/utils/base64url.ts +0 -6
  42. package/src/utils/disclosure.ts +0 -121
  43. package/src/utils/error.ts +0 -25
  44. package/src/utils/index.ts +0 -3
  45. package/src/utils/strict-json.ts +0 -17
  46. package/test/app-e2e.spec.ts +0 -292
  47. package/test/array_data_types.json +0 -31
  48. package/test/array_full_sd.json +0 -21
  49. package/test/array_in_sd.json +0 -13
  50. package/test/array_nested_in_plain.json +0 -29
  51. package/test/array_none_disclosed.json +0 -17
  52. package/test/array_of_nulls.json +0 -15
  53. package/test/array_of_objects.json +0 -65
  54. package/test/array_of_scalars.json +0 -19
  55. package/test/array_recursive_sd.json +0 -35
  56. package/test/array_recursive_sd_some_disclosed.json +0 -63
  57. package/test/complex.json +0 -43
  58. package/test/header_mod.json +0 -48
  59. package/test/json_serialization.json +0 -48
  60. package/test/key_binding.json +0 -48
  61. package/test/no_sd.json +0 -36
  62. package/test/object_data_types.json +0 -62
  63. package/test/recursions.json +0 -117
  64. package/test/rfc9901-audit-fixes.spec.ts +0 -252
  65. package/test/rfc9901-validation.spec.ts +0 -150
  66. package/test/tsconfig.json +0 -4
  67. package/tsconfig.json +0 -7
  68. package/vitest.config.mts +0 -4
@@ -1,88 +0,0 @@
1
- import { describe, expect, test } from 'vitest';
2
- import {
3
- type DisclosureFrame,
4
- KB_JWT_TYP,
5
- type PresentationFrame,
6
- SD_DECOY,
7
- SD_DIGEST,
8
- SD_LIST_KEY,
9
- SD_SEPARATOR,
10
- } from '../../types';
11
-
12
- const claims = {
13
- firstname: 'John',
14
- lastname: 'Doe',
15
- ssn: '123-45-6789',
16
- id: '1234',
17
- data: {
18
- firstname: 'John',
19
- lastname: 'Doe',
20
- ssn: '123-45-6789',
21
- list: [{ r: 'd' }, 'b', 'c'],
22
- list2: ['1', '2', '3'],
23
- list3: ['1', null, 2],
24
- },
25
- data2: {
26
- hi: 'bye',
27
- },
28
- };
29
-
30
- describe('Variable tests', () => {
31
- test('SD_SEPARATOR', () => {
32
- expect(SD_SEPARATOR).toBe('~');
33
- });
34
-
35
- test('SD_LIST_KEY', () => {
36
- expect(SD_LIST_KEY).toBe('...');
37
- });
38
-
39
- test('SD_DIGEST', () => {
40
- expect(SD_DIGEST).toBe('_sd');
41
- });
42
-
43
- test('SD_DECOY', () => {
44
- expect(SD_DECOY).toBe('_sd_decoy');
45
- });
46
-
47
- test('KB_JWT_TYP', () => {
48
- expect(KB_JWT_TYP).toBe('kb+jwt');
49
- });
50
-
51
- test('DisclosureFrameType test', () => {
52
- const disclosureFrame: DisclosureFrame<typeof claims> = {
53
- _sd: ['data', 'firstname', 'data2'],
54
- data: {
55
- _sd: ['list', 'ssn'],
56
- _sd_decoy: 2,
57
- list: {
58
- _sd: [0, 2],
59
- 0: {
60
- _sd: ['r'],
61
- },
62
- },
63
- },
64
- };
65
- expect(disclosureFrame).toBeDefined();
66
- });
67
-
68
- test('PresentationFrameType test', () => {
69
- const presentationFrame: PresentationFrame<typeof claims> = {
70
- firstname: true,
71
- data: {
72
- firstname: true,
73
- list: {
74
- 1: true,
75
- 0: {
76
- r: true,
77
- },
78
- },
79
- list2: {
80
- 1: true,
81
- },
82
- list3: true,
83
- },
84
- data2: true,
85
- };
86
- expect(presentationFrame).toBeDefined();
87
- });
88
- });
@@ -1,33 +0,0 @@
1
- import { describe, expect, test } from 'vitest';
2
- import {
3
- base64UrlToUint8Array,
4
- base64urlDecode,
5
- base64urlEncode,
6
- uint8ArrayToBase64Url,
7
- } from '../../utils/base64url';
8
-
9
- describe('Base64url', () => {
10
- const raw = 'abcdefghijklmnopqrstuvwxyz';
11
- const encoded = 'YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo';
12
- test('Encode', () => {
13
- expect(base64urlEncode(raw)).toStrictEqual(encoded);
14
- });
15
- test('Decode', () => {
16
- expect(base64urlDecode(encoded)).toStrictEqual(raw);
17
- });
18
- test('Encode and decode', () => {
19
- const str = 'hello world';
20
- expect(base64urlDecode(base64urlEncode(str))).toStrictEqual(str);
21
- });
22
- test('Uint8Array', () => {
23
- const str = 'hello world';
24
- const uint8 = new TextEncoder().encode(str);
25
- expect(uint8ArrayToBase64Url(uint8)).toStrictEqual(base64urlEncode(str));
26
- });
27
-
28
- test('Base64Url to Uint8Array', () => {
29
- const str = 'hello world';
30
- const uint8 = new TextEncoder().encode(str);
31
- expect(base64UrlToUint8Array(base64urlEncode(str))).toStrictEqual(uint8);
32
- });
33
- });
@@ -1,170 +0,0 @@
1
- import { generateSalt, hasher } from '@owf/crypto';
2
- import { describe, expect, test } from 'vitest';
3
- import { base64urlEncode, type SDJWTException } from '../../utils';
4
- import { Disclosure } from '../../utils/disclosure';
5
-
6
- const hash = { alg: 'SHA256', hasher };
7
-
8
- /*
9
- ref draft-ietf-oauth-selective-disclosure-jwt-07
10
- Claim given_name:
11
- SHA-256 Hash: jsu9yVulwQQlhFlM_3JlzMaSFzglhQG0DpfayQwLUK4
12
- Disclosure: WyIyR0xDNDJzS1F2ZUNmR2ZyeU5STjl3IiwgImdpdmVuX25hbWUiLCAiSm9obiJd
13
- Contents: ["2GLC42sKQveCfGfryNRN9w", "given_name", "John"]
14
- For example, the SHA-256 digest of the Disclosure
15
- WyI2cU1RdlJMNWhhaiIsICJmYW1pbHlfbmFtZSIsICJNw7ZiaXVzIl0 would be uutlBuYeMDyjLLTpf6Jxi7yNkEF35jdyWMn9U7b_RYY.
16
- The SHA-256 digest of the Disclosure
17
- WyJsa2x4RjVqTVlsR1RQVW92TU5JdkNBIiwgIkZSIl0 would be w0I8EKcdCtUPkGCNUrfwVp2xEgNjtoIDlOxc9-PlOhs.
18
- */
19
- const TestDataDraft7 = {
20
- claimTests: [
21
- {
22
- contents: '["2GLC42sKQveCfGfryNRN9w", "given_name", "John"]',
23
- digest: 'jsu9yVulwQQlhFlM_3JlzMaSFzglhQG0DpfayQwLUK4',
24
- disclosure:
25
- 'WyIyR0xDNDJzS1F2ZUNmR2ZyeU5STjl3IiwgImdpdmVuX25hbWUiLCAiSm9obiJd',
26
- },
27
- ],
28
- sha256Tests: [
29
- {
30
- digest: 'uutlBuYeMDyjLLTpf6Jxi7yNkEF35jdyWMn9U7b_RYY',
31
- disclosure: 'WyI2cU1RdlJMNWhhaiIsICJmYW1pbHlfbmFtZSIsICJNw7ZiaXVzIl0',
32
- },
33
- {
34
- digest: 'w0I8EKcdCtUPkGCNUrfwVp2xEgNjtoIDlOxc9-PlOhs',
35
- disclosure: 'WyJsa2x4RjVqTVlsR1RQVW92TU5JdkNBIiwgIkZSIl0',
36
- },
37
- ],
38
- };
39
-
40
- describe('Disclosure', () => {
41
- test('create object disclosure', async () => {
42
- const salt = generateSalt(16);
43
- const disclosure = new Disclosure([salt, 'name', 'James']);
44
- expect(disclosure).toBeDefined();
45
- expect(disclosure.key).toBe('name');
46
- expect(disclosure.value).toBe('James');
47
- expect(disclosure.salt).toBe(salt);
48
- });
49
-
50
- test('create array disclosure', async () => {
51
- const salt = generateSalt(16);
52
- const disclosure = new Disclosure([salt, 'US']);
53
- expect(disclosure).toBeDefined();
54
- expect(disclosure.key).toBe(undefined);
55
- expect(disclosure.value).toBe('US');
56
- expect(disclosure.salt).toBe(salt);
57
- });
58
-
59
- test('create disclosure error', async () => {
60
- const salt = generateSalt(16);
61
- const data: [string, string, string] = [salt, 'name', 'James'];
62
- data.push('any');
63
- expect(() => new Disclosure(data)).toThrow();
64
- try {
65
- new Disclosure(data);
66
- } catch (e: unknown) {
67
- const error = e as SDJWTException;
68
- expect(typeof error.getFullMessage()).toBe('string');
69
- }
70
- });
71
-
72
- test('encode disclosure', async () => {
73
- const salt = generateSalt(16);
74
- const disclosure = new Disclosure([salt, 'name', 'James']);
75
- const encodedDisclosure = disclosure.encode();
76
- expect(encodedDisclosure).toBeDefined();
77
- expect(typeof encodedDisclosure).toBe('string');
78
- });
79
-
80
- test('decode disclosure', async () => {
81
- const salt = generateSalt(16);
82
- const disclosure = new Disclosure([salt, 'name', 'James']);
83
- const encodedDisclosure = disclosure.encode();
84
- const newDisclosure = await Disclosure.fromEncode(encodedDisclosure, {
85
- alg: 'SHA256',
86
- hasher,
87
- });
88
-
89
- expect(newDisclosure).toBeDefined();
90
- expect(newDisclosure.key).toBe('name');
91
- expect(newDisclosure.value).toBe('James');
92
- expect(newDisclosure.salt).toBe(salt);
93
- });
94
-
95
- test('decode disclosure sync', () => {
96
- const salt = generateSalt(16);
97
- const disclosure = new Disclosure([salt, 'name', 'James']);
98
- const encodedDisclosure = disclosure.encode();
99
- const newDisclosure = Disclosure.fromEncodeSync(encodedDisclosure, {
100
- alg: 'SHA256',
101
- hasher,
102
- });
103
-
104
- expect(newDisclosure).toBeDefined();
105
- expect(newDisclosure.key).toBe('name');
106
- expect(newDisclosure.value).toBe('James');
107
- expect(newDisclosure.salt).toBe(salt);
108
- });
109
-
110
- test('digest disclosure #1', async () => {
111
- const salt = generateSalt(16);
112
- const disclosure = new Disclosure([salt, 'name', 'James']);
113
- const digest = await disclosure.digest({ alg: 'SHA256', hasher });
114
- expect(digest).toBeDefined();
115
- expect(typeof digest).toBe('string');
116
- });
117
-
118
- test('digest disclosure #2', async () => {
119
- const disclosure = new Disclosure([
120
- '2GLC42sKQveCfGfryNRN9w',
121
- 'given_name',
122
- 'John',
123
- ]);
124
- const encode = disclosure.encode();
125
- expect(encode).toBe(
126
- 'WyIyR0xDNDJzS1F2ZUNmR2ZyeU5STjl3IiwiZ2l2ZW5fbmFtZSIsIkpvaG4iXQ',
127
- );
128
- const digest = await disclosure.digest(hash);
129
- expect(digest).toBe('8VHiz7qTXavxvpiTYDCSr_shkUO6qRcVXjkhEnt1os4');
130
- });
131
-
132
- test('digest disclosure #2 sync', () => {
133
- const disclosure = new Disclosure([
134
- '2GLC42sKQveCfGfryNRN9w',
135
- 'given_name',
136
- 'John',
137
- ]);
138
- const encode = disclosure.encode();
139
- expect(encode).toBe(
140
- 'WyIyR0xDNDJzS1F2ZUNmR2ZyeU5STjl3IiwiZ2l2ZW5fbmFtZSIsIkpvaG4iXQ',
141
- );
142
- const digest = disclosure.digestSync(hash);
143
- expect(digest).toBe('8VHiz7qTXavxvpiTYDCSr_shkUO6qRcVXjkhEnt1os4');
144
- });
145
-
146
- test('digest disclosure #3', async () => {
147
- const encoded = base64urlEncode(TestDataDraft7.claimTests[0].contents);
148
- expect(encoded).toStrictEqual(TestDataDraft7.claimTests[0].disclosure);
149
-
150
- const disclosure = await Disclosure.fromEncode(
151
- TestDataDraft7.claimTests[0].disclosure,
152
- hash,
153
- );
154
-
155
- const digest = await disclosure.digest(hash);
156
- expect(digest).toBe(TestDataDraft7.claimTests[0].digest);
157
- });
158
-
159
- test('digest disclosure #4', async () => {
160
- for (const sha256Test of TestDataDraft7.sha256Tests) {
161
- const disclosure = await Disclosure.fromEncode(
162
- sha256Test.disclosure,
163
- hash,
164
- );
165
-
166
- const digest = await disclosure.digest(hash);
167
- expect(digest).toBe(sha256Test.digest);
168
- }
169
- });
170
- });
@@ -1,15 +0,0 @@
1
- import { describe, expect, test } from 'vitest';
2
- import { SDJWTException } from '../../utils/error';
3
-
4
- describe('Error tests', () => {
5
- test('Detail', () => {
6
- try {
7
- throw new SDJWTException('msg', { info: 'details' });
8
- } catch (e: unknown) {
9
- const exception = e as SDJWTException;
10
- expect(exception.getFullMessage()).toEqual(
11
- 'SDJWTException: msg - {"info":"details"}',
12
- );
13
- }
14
- });
15
- });
@@ -1,2 +0,0 @@
1
- export * from './type';
2
- export * from './verification-error';
package/src/types/type.ts DELETED
@@ -1,270 +0,0 @@
1
- export const SD_SEPARATOR = '~';
2
- export const SD_LIST_KEY = '...';
3
- export const SD_DIGEST = '_sd';
4
- export const SD_DECOY = '_sd_decoy';
5
- export const KB_JWT_TYP = 'kb+jwt';
6
-
7
- export type SDJWTCompact = string;
8
- export type Base64urlString = string;
9
-
10
- export type DisclosureData<T> = [string, string, T] | [string, T];
11
-
12
- export const encodePathSegment = (segment: string) =>
13
- segment.replace(/~/g, '~0').replace(/\./g, '~1');
14
-
15
- export const encodePath = (segments: string[]) =>
16
- segments.map(encodePathSegment).join('.');
17
-
18
- // based on https://www.iana.org/assignments/named-information/named-information.xhtml
19
- export const IANA_HASH_ALGORITHMS = [
20
- 'sha-256',
21
- 'sha-256-128',
22
- 'sha-256-120',
23
- 'sha-256-96',
24
- 'sha-256-64',
25
- 'sha-256-32',
26
- 'sha-384',
27
- 'sha-512',
28
- 'sha3-224',
29
- 'sha3-256',
30
- 'sha3-384',
31
- 'sha3-512',
32
- 'blake2s-256',
33
- 'blake2b-256',
34
- 'blake2b-512',
35
- 'k12-256',
36
- 'k12-512',
37
- ] as const;
38
-
39
- export type HashAlgorithm = (typeof IANA_HASH_ALGORITHMS)[number];
40
-
41
- export const DEFAULT_SECURE_HASH_ALGORITHMS = [
42
- 'sha-256',
43
- 'sha-384',
44
- 'sha-512',
45
- 'sha3-256',
46
- 'sha3-384',
47
- 'sha3-512',
48
- 'blake2s-256',
49
- 'blake2b-256',
50
- 'blake2b-512',
51
- 'k12-256',
52
- 'k12-512',
53
- ] as const satisfies ReadonlyArray<HashAlgorithm>;
54
-
55
- export type SDJWTConfig<T = unknown> = {
56
- omitTyp?: boolean;
57
- hasher?: Hasher;
58
- hashAlg?: HashAlgorithm;
59
- allowedDisclosureHashAlgorithms?: ReadonlyArray<HashAlgorithm>;
60
- saltGenerator?: SaltGenerator;
61
- signer?: Signer;
62
- signAlg?: string;
63
- verifier?: Verifier<T>;
64
- kbSigner?: Signer;
65
- kbSignAlg?: string;
66
- kbVerifier?: KbVerifier;
67
- };
68
-
69
- export type kbHeader = { typ: 'kb+jwt'; alg: string };
70
- export type kbPayload = {
71
- iat: number;
72
- aud: string;
73
- nonce: string;
74
- sd_hash: string;
75
- };
76
-
77
- export type KBOptions = {
78
- payload: Omit<kbPayload, 'sd_hash'>;
79
- };
80
-
81
- // This type declaration is from lib.dom.ts
82
- interface RsaOtherPrimesInfo {
83
- d?: string;
84
- r?: string;
85
- t?: string;
86
- }
87
-
88
- interface JsonWebKey {
89
- alg?: string;
90
- crv?: string;
91
- d?: string;
92
- dp?: string;
93
- dq?: string;
94
- e?: string;
95
- ext?: boolean;
96
- k?: string;
97
- key_ops?: string[];
98
- kty?: string;
99
- n?: string;
100
- oth?: RsaOtherPrimesInfo[];
101
- p?: string;
102
- q?: string;
103
- qi?: string;
104
- use?: string;
105
- x?: string;
106
- y?: string;
107
- }
108
-
109
- export interface JwtPayload {
110
- cnf?: {
111
- jwk: JsonWebKey;
112
- };
113
- exp?: number;
114
- [key: string]: unknown;
115
- }
116
-
117
- export type OrPromise<T> = T | Promise<T>;
118
-
119
- export type Signer = (data: string) => OrPromise<string>;
120
- export type Verifier<T = unknown> = (
121
- data: string,
122
- sig: string,
123
- options?: T,
124
- ) => OrPromise<boolean>;
125
- export type KbVerifier = (
126
- data: string,
127
- sig: string,
128
- payload: JwtPayload,
129
- ) => OrPromise<boolean>;
130
- export type Hasher = (
131
- data: string | ArrayBuffer,
132
- alg: string,
133
- ) => OrPromise<Uint8Array>;
134
- export type SaltGenerator = (length: number) => OrPromise<string>;
135
- export type HasherAndAlg = {
136
- hasher: Hasher;
137
- alg: string;
138
- };
139
-
140
- // This functions are sync versions
141
- export type SignerSync = (data: string) => string;
142
- export type VerifierSync = (data: string, sig: string) => boolean;
143
- export type HasherSync = (data: string, alg: string) => Uint8Array;
144
- export type SaltGeneratorSync = (length: number) => string;
145
- export type HasherAndAlgSync = {
146
- hasher: HasherSync;
147
- alg: string;
148
- };
149
-
150
- type NonNever<T> = {
151
- [P in keyof T as T[P] extends never ? never : P]: T[P];
152
- };
153
-
154
- export type SD<Payload> = { [SD_DIGEST]?: Array<keyof Payload> };
155
- export type DECOY = { [SD_DECOY]?: number };
156
-
157
- /**
158
- * This is a disclosureFrame type that is used to represent the structure of what is being disclosed.
159
- * DisclosureFrame is made from the payload type.
160
- *
161
- * For example, if the payload is
162
- * {
163
- * foo: 'bar',
164
- * test: {
165
- * zzz: 'yyy',
166
- * }
167
- * arr: ['1', '2', {a: 'b'}]
168
- * }
169
- *
170
- * The disclosureFrame can be subset of:
171
- * {
172
- * _sd: ["foo", "test", "arr"],
173
- * test: {
174
- * _sd: ["zzz"],
175
- * },
176
- * arr: {
177
- * _sd: ["0", "1", "2"],
178
- * "2": {
179
- * _sd: ["a"],
180
- * }
181
- * }
182
- * }
183
- *
184
- * The disclosureFrame can be used with decoy.
185
- * Decoy can be used like this:
186
- * {
187
- * ...
188
- * _sd: ...
189
- * _sd_decoy: 1 // number of decoy in this layer
190
- * }
191
- *
192
- */
193
- type Frame<Payload> =
194
- Payload extends Array<infer U>
195
- ? U extends object
196
- ? Record<number, Frame<U>> & SD<Payload> & DECOY
197
- : SD<Payload> & DECOY
198
- : Payload extends Record<string, unknown>
199
- ? NonNever<
200
- {
201
- [K in keyof Payload]?: NonNullable<Payload[K]> extends object
202
- ? Frame<Payload[K]>
203
- : never;
204
- } & SD<Payload> &
205
- DECOY
206
- >
207
- : SD<Payload> & DECOY;
208
-
209
- /**
210
- * This is a disclosureFrame type that is used to represent the structure of what is being disclosed.
211
- */
212
- export type Extensible = Record<string, unknown | boolean>;
213
-
214
- export type DisclosureFrame<T extends Extensible> = Frame<T>;
215
-
216
- /**
217
- * This is a presentationFrame type that is used to represent the structure of what is being presented.
218
- * PresentationFrame is made from the payload type.
219
- * const claims = {
220
- firstname: 'John',
221
- lastname: 'Doe',
222
- ssn: '123-45-6789',
223
- id: '1234',
224
- data: {
225
- firstname: 'John',
226
- lastname: 'Doe',
227
- ssn: '123-45-6789',
228
- list: [{ r: 'd' }, 'b', 'c'],
229
- list2: ['1', '2', '3'],
230
- list3: ['1', null, 2],
231
- },
232
- data2: {
233
- hi: 'bye',
234
- },
235
- };
236
-
237
- Example of a presentationFrame:
238
- const presentationFrame: PresentationFrame<typeof claims> = {
239
- firstname: true,
240
- lastname: true,
241
- ssn: true,
242
- id: 'true',
243
- data: {
244
- firstname: true,
245
- list: {
246
- 1: true,
247
- 0: {
248
- r: true,
249
- },
250
- },
251
- list2: {
252
- 1: true,
253
- },
254
- list3: true,
255
- },
256
- data2: true,
257
- };
258
- */
259
- type PFrame<Payload> =
260
- Payload extends Array<infer U>
261
- ? U extends object
262
- ? Record<number, PFrame<U> | boolean> | boolean
263
- : Record<number, boolean> | boolean
264
- : {
265
- [K in keyof Payload]?: NonNullable<Payload[K]> extends object
266
- ? PFrame<Payload[K]> | boolean
267
- : boolean;
268
- };
269
-
270
- export type PresentationFrame<T extends Extensible> = PFrame<T>;
@@ -1,55 +0,0 @@
1
- /**
2
- * Error codes for SD-JWT verification errors.
3
- */
4
- export type VerificationErrorCode =
5
- | 'HASHER_NOT_FOUND'
6
- | 'VERIFIER_NOT_FOUND'
7
- | 'INVALID_SD_JWT'
8
- | 'INVALID_JWT_FORMAT'
9
- | 'JWT_NOT_YET_VALID'
10
- | 'JWT_EXPIRED'
11
- | 'INVALID_JWT_SIGNATURE'
12
- | 'MISSING_REQUIRED_CLAIMS'
13
- | 'KEY_BINDING_JWT_MISSING'
14
- | 'KEY_BINDING_VERIFIER_NOT_FOUND'
15
- | 'KEY_BINDING_SIGNATURE_INVALID'
16
- | 'KEY_BINDING_SD_HASH_INVALID'
17
- | 'STATUS_VERIFICATION_FAILED'
18
- | 'STATUS_INVALID'
19
- | 'VCT_VERIFICATION_FAILED'
20
- | 'UNKNOWN_ERROR';
21
-
22
- /**
23
- * Represents a single verification error.
24
- */
25
- export type VerificationError = {
26
- /**
27
- * The error code identifying the type of error.
28
- */
29
- code: VerificationErrorCode;
30
-
31
- /**
32
- * Human-readable error message.
33
- */
34
- message: string;
35
-
36
- /**
37
- * Optional additional details about the error.
38
- */
39
- details?: unknown;
40
- };
41
-
42
- /**
43
- * Result type for safe verification that collects all errors.
44
- */
45
- export type SafeVerifyResult<T> =
46
- | {
47
- success: true;
48
- data: T;
49
- errors?: never;
50
- }
51
- | {
52
- success: false;
53
- data?: never;
54
- errors: VerificationError[];
55
- };
@@ -1,6 +0,0 @@
1
- export {
2
- base64UrlToUint8Array,
3
- base64urlDecode,
4
- base64urlEncode,
5
- uint8ArrayToBase64Url,
6
- } from '@owf/identity-common';