File tree Expand file tree Collapse file tree 2 files changed +23
-38
lines changed Expand file tree Collapse file tree 2 files changed +23
-38
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
17
17
type SDJWTConfig ,
18
18
type JwtPayload ,
19
19
type Signer ,
20
+ IANA_HASH_ALGORITHMS ,
20
21
type HashAlgorithm ,
21
22
} from '@sd-jwt/types' ;
22
23
import { getSDAlgAndPayload } from '@sd-jwt/decode' ;
@@ -32,26 +33,6 @@ export * from './generalJSON';
32
33
33
34
export type SdJwtPayload = Record < string , unknown > ;
34
35
35
- const IANA_HASH_ALGORITHMS : HashAlgorithm [ ] = [
36
- 'sha-256' ,
37
- 'sha-256-128' ,
38
- 'sha-256-120' ,
39
- 'sha-256-96' ,
40
- 'sha-256-64' ,
41
- 'sha-256-32' ,
42
- 'sha-384' ,
43
- 'sha-512' ,
44
- 'sha3-224' ,
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
- ] ;
54
-
55
36
export class SDJwtInstance < ExtendedPayload extends SdJwtPayload > {
56
37
//header type
57
38
protected type ?: string ;
Original file line number Diff line number Diff line change @@ -10,24 +10,28 @@ 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 ] ;
34
+
31
35
32
36
export type SDJWTConfig = {
33
37
omitTyp ?: boolean ;
You can’t perform that action at this time.
0 commit comments