@sd-jwt/types 0.9.2-next.2 → 0.9.2-next.6

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 CHANGED
@@ -6,7 +6,8 @@ declare const KB_JWT_TYP = "kb+jwt";
6
6
  type SDJWTCompact = string;
7
7
  type Base64urlString = string;
8
8
  type DisclosureData<T> = [string, string, T] | [string, T];
9
- type HashAlgorithm = 'sha-256' | 'sha-256-128' | 'sha-256-120' | 'sha-256-96' | 'sha-256-64' | 'sha-256-32' | 'sha-384' | 'sha-512' | 'sha3-224' | 'sha3-256' | 'sha3-384' | 'sha3-512' | 'blake2s-256' | 'blake2b-256' | 'blake2b-512' | 'k12-256' | 'k12-512';
9
+ declare const IANA_HASH_ALGORITHMS: readonly ["sha-256", "sha-256-128", "sha-256-120", "sha-256-96", "sha-256-64", "sha-256-32", "sha-384", "sha-512", "sha3-224", "sha3-256", "sha3-384", "sha3-512", "blake2s-256", "blake2b-256", "blake2b-512", "k12-256", "k12-512"];
10
+ type HashAlgorithm = (typeof IANA_HASH_ALGORITHMS)[number];
10
11
  type SDJWTConfig = {
11
12
  omitTyp?: boolean;
12
13
  hasher?: Hasher;
@@ -183,4 +184,4 @@ type PFrame<Payload> = Payload extends Array<infer U> ? U extends object ? Recor
183
184
  };
184
185
  type PresentationFrame<T extends Extensible> = PFrame<T>;
185
186
 
186
- export { type Base64urlString, type DECOY, type DisclosureData, type DisclosureFrame, type Extensible, type HashAlgorithm, type Hasher, type HasherAndAlg, type HasherAndAlgSync, type HasherSync, type JwtPayload, type KBOptions, KB_JWT_TYP, type KbVerifier, type OrPromise, type PresentationFrame, type SD, type SDJWTCompact, type SDJWTConfig, SD_DECOY, SD_DIGEST, SD_LIST_KEY, SD_SEPARATOR, type SaltGenerator, type SaltGeneratorSync, type Signer, type SignerSync, type Verifier, type VerifierSync, type kbHeader, type kbPayload };
187
+ export { type Base64urlString, type DECOY, type DisclosureData, type DisclosureFrame, type Extensible, type HashAlgorithm, type Hasher, type HasherAndAlg, type HasherAndAlgSync, type HasherSync, IANA_HASH_ALGORITHMS, type JwtPayload, type KBOptions, KB_JWT_TYP, type KbVerifier, type OrPromise, type PresentationFrame, type SD, type SDJWTCompact, type SDJWTConfig, SD_DECOY, SD_DIGEST, SD_LIST_KEY, SD_SEPARATOR, type SaltGenerator, type SaltGeneratorSync, type Signer, type SignerSync, type Verifier, type VerifierSync, type kbHeader, type kbPayload };
package/dist/index.d.ts CHANGED
@@ -6,7 +6,8 @@ declare const KB_JWT_TYP = "kb+jwt";
6
6
  type SDJWTCompact = string;
7
7
  type Base64urlString = string;
8
8
  type DisclosureData<T> = [string, string, T] | [string, T];
9
- type HashAlgorithm = 'sha-256' | 'sha-256-128' | 'sha-256-120' | 'sha-256-96' | 'sha-256-64' | 'sha-256-32' | 'sha-384' | 'sha-512' | 'sha3-224' | 'sha3-256' | 'sha3-384' | 'sha3-512' | 'blake2s-256' | 'blake2b-256' | 'blake2b-512' | 'k12-256' | 'k12-512';
9
+ declare const IANA_HASH_ALGORITHMS: readonly ["sha-256", "sha-256-128", "sha-256-120", "sha-256-96", "sha-256-64", "sha-256-32", "sha-384", "sha-512", "sha3-224", "sha3-256", "sha3-384", "sha3-512", "blake2s-256", "blake2b-256", "blake2b-512", "k12-256", "k12-512"];
10
+ type HashAlgorithm = (typeof IANA_HASH_ALGORITHMS)[number];
10
11
  type SDJWTConfig = {
11
12
  omitTyp?: boolean;
12
13
  hasher?: Hasher;
@@ -183,4 +184,4 @@ type PFrame<Payload> = Payload extends Array<infer U> ? U extends object ? Recor
183
184
  };
184
185
  type PresentationFrame<T extends Extensible> = PFrame<T>;
185
186
 
186
- export { type Base64urlString, type DECOY, type DisclosureData, type DisclosureFrame, type Extensible, type HashAlgorithm, type Hasher, type HasherAndAlg, type HasherAndAlgSync, type HasherSync, type JwtPayload, type KBOptions, KB_JWT_TYP, type KbVerifier, type OrPromise, type PresentationFrame, type SD, type SDJWTCompact, type SDJWTConfig, SD_DECOY, SD_DIGEST, SD_LIST_KEY, SD_SEPARATOR, type SaltGenerator, type SaltGeneratorSync, type Signer, type SignerSync, type Verifier, type VerifierSync, type kbHeader, type kbPayload };
187
+ export { type Base64urlString, type DECOY, type DisclosureData, type DisclosureFrame, type Extensible, type HashAlgorithm, type Hasher, type HasherAndAlg, type HasherAndAlgSync, type HasherSync, IANA_HASH_ALGORITHMS, type JwtPayload, type KBOptions, KB_JWT_TYP, type KbVerifier, type OrPromise, type PresentationFrame, type SD, type SDJWTCompact, type SDJWTConfig, SD_DECOY, SD_DIGEST, SD_LIST_KEY, SD_SEPARATOR, type SaltGenerator, type SaltGeneratorSync, type Signer, type SignerSync, type Verifier, type VerifierSync, type kbHeader, type kbPayload };
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ IANA_HASH_ALGORITHMS: () => IANA_HASH_ALGORITHMS,
23
24
  KB_JWT_TYP: () => KB_JWT_TYP,
24
25
  SD_DECOY: () => SD_DECOY,
25
26
  SD_DIGEST: () => SD_DIGEST,
@@ -34,8 +35,28 @@ var SD_LIST_KEY = "...";
34
35
  var SD_DIGEST = "_sd";
35
36
  var SD_DECOY = "_sd_decoy";
36
37
  var KB_JWT_TYP = "kb+jwt";
38
+ var IANA_HASH_ALGORITHMS = [
39
+ "sha-256",
40
+ "sha-256-128",
41
+ "sha-256-120",
42
+ "sha-256-96",
43
+ "sha-256-64",
44
+ "sha-256-32",
45
+ "sha-384",
46
+ "sha-512",
47
+ "sha3-224",
48
+ "sha3-256",
49
+ "sha3-384",
50
+ "sha3-512",
51
+ "blake2s-256",
52
+ "blake2b-256",
53
+ "blake2b-512",
54
+ "k12-256",
55
+ "k12-512"
56
+ ];
37
57
  // Annotate the CommonJS export names for ESM import in node:
38
58
  0 && (module.exports = {
59
+ IANA_HASH_ALGORITHMS,
39
60
  KB_JWT_TYP,
40
61
  SD_DECOY,
41
62
  SD_DIGEST,
package/dist/index.mjs CHANGED
@@ -4,7 +4,27 @@ var SD_LIST_KEY = "...";
4
4
  var SD_DIGEST = "_sd";
5
5
  var SD_DECOY = "_sd_decoy";
6
6
  var KB_JWT_TYP = "kb+jwt";
7
+ var IANA_HASH_ALGORITHMS = [
8
+ "sha-256",
9
+ "sha-256-128",
10
+ "sha-256-120",
11
+ "sha-256-96",
12
+ "sha-256-64",
13
+ "sha-256-32",
14
+ "sha-384",
15
+ "sha-512",
16
+ "sha3-224",
17
+ "sha3-256",
18
+ "sha3-384",
19
+ "sha3-512",
20
+ "blake2s-256",
21
+ "blake2b-256",
22
+ "blake2b-512",
23
+ "k12-256",
24
+ "k12-512"
25
+ ];
7
26
  export {
27
+ IANA_HASH_ALGORITHMS,
8
28
  KB_JWT_TYP,
9
29
  SD_DECOY,
10
30
  SD_DIGEST,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sd-jwt/types",
3
- "version": "0.9.2-next.2+3c85e8e",
3
+ "version": "0.9.2-next.6+5e64551",
4
4
  "description": "sd-jwt draft 7 implementation in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -53,5 +53,5 @@
53
53
  "esm"
54
54
  ]
55
55
  },
56
- "gitHead": "3c85e8e283fa53e871a14c321b3a04fc4380b875"
56
+ "gitHead": "5e6455158648525d09320dd562422d9f9f33ffaa"
57
57
  }
package/src/type.ts CHANGED
@@ -10,24 +10,27 @@ export type Base64urlString = string;
10
10
  export type DisclosureData<T> = [string, string, T] | [string, T];
11
11
 
12
12
  // based on https://www.iana.org/assignments/named-information/named-information.xhtml
13
- export type HashAlgorithm =
14
- | 'sha-256'
15
- | 'sha-256-128'
16
- | 'sha-256-120'
17
- | 'sha-256-96'
18
- | 'sha-256-64'
19
- | 'sha-256-32'
20
- | 'sha-384'
21
- | 'sha-512'
22
- | 'sha3-224'
23
- | 'sha3-256'
24
- | 'sha3-384'
25
- | 'sha3-512'
26
- | 'blake2s-256'
27
- | 'blake2b-256'
28
- | 'blake2b-512'
29
- | 'k12-256'
30
- | 'k12-512';
13
+ export const IANA_HASH_ALGORITHMS = [
14
+ 'sha-256',
15
+ 'sha-256-128',
16
+ 'sha-256-120',
17
+ 'sha-256-96',
18
+ 'sha-256-64',
19
+ 'sha-256-32',
20
+ 'sha-384',
21
+ 'sha-512',
22
+ 'sha3-224',
23
+ 'sha3-256',
24
+ 'sha3-384',
25
+ 'sha3-512',
26
+ 'blake2s-256',
27
+ 'blake2b-256',
28
+ 'blake2b-512',
29
+ 'k12-256',
30
+ 'k12-512',
31
+ ] as const;
32
+
33
+ export type HashAlgorithm = (typeof IANA_HASH_ALGORITHMS)[number];
31
34
 
32
35
  export type SDJWTConfig = {
33
36
  omitTyp?: boolean;