@sd-jwt/core 0.4.0 → 0.4.1-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.js CHANGED
@@ -341,7 +341,7 @@ var pack = (claims, disclosureFrame, hash, saltGenerator) => __async(void 0, nul
341
341
  const recursivePackedClaims2 = {};
342
342
  for (const key in disclosureFrame) {
343
343
  if (key !== import_types2.SD_DIGEST) {
344
- const idx = parseInt(key);
344
+ const idx = Number.parseInt(key);
345
345
  const packed = yield pack(
346
346
  claims[idx],
347
347
  disclosureFrame[idx],
package/dist/index.mjs CHANGED
@@ -321,7 +321,7 @@ var pack = (claims, disclosureFrame, hash, saltGenerator) => __async(void 0, nul
321
321
  const recursivePackedClaims2 = {};
322
322
  for (const key in disclosureFrame) {
323
323
  if (key !== SD_DIGEST) {
324
- const idx = parseInt(key);
324
+ const idx = Number.parseInt(key);
325
325
  const packed = yield pack(
326
326
  claims[idx],
327
327
  disclosureFrame[idx],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sd-jwt/core",
3
- "version": "0.4.0",
3
+ "version": "0.4.1-next.2+b11bedf",
4
4
  "description": "sd-jwt draft 7 implementation in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -38,13 +38,13 @@
38
38
  },
39
39
  "license": "Apache-2.0",
40
40
  "devDependencies": {
41
- "@sd-jwt/crypto-nodejs": "0.4.0"
41
+ "@sd-jwt/crypto-nodejs": "0.4.1-next.2+b11bedf"
42
42
  },
43
43
  "dependencies": {
44
- "@sd-jwt/decode": "0.4.0",
45
- "@sd-jwt/present": "0.4.0",
46
- "@sd-jwt/types": "0.4.0",
47
- "@sd-jwt/utils": "0.4.0"
44
+ "@sd-jwt/decode": "0.4.1-next.2+b11bedf",
45
+ "@sd-jwt/present": "0.4.1-next.2+b11bedf",
46
+ "@sd-jwt/types": "0.4.1-next.2+b11bedf",
47
+ "@sd-jwt/utils": "0.4.1-next.2+b11bedf"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"
@@ -62,5 +62,5 @@
62
62
  "esm"
63
63
  ]
64
64
  },
65
- "gitHead": "391a36550a66833b3d393ff0deb699b1b72cca59"
65
+ "gitHead": "b11bedfe62dd1827653a76226ebdca3e0da1bbe0"
66
66
  }
package/src/decoy.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HasherAndAlg, SaltGenerator } from '@sd-jwt/types';
1
+ import type { HasherAndAlg, SaltGenerator } from '@sd-jwt/types';
2
2
  import { Uint8ArrayToBase64Url } from '@sd-jwt/utils';
3
3
 
4
4
  // This function creates a decoy value that can be used to obscure SD JWT payload.
package/src/index.ts CHANGED
@@ -3,16 +3,16 @@ import { Jwt } from './jwt';
3
3
  import { KBJwt } from './kbjwt';
4
4
  import { SDJwt, pack } from './sdjwt';
5
5
  import {
6
- DisclosureFrame,
7
- Hasher,
8
- KBOptions,
6
+ type DisclosureFrame,
7
+ type Hasher,
8
+ type KBOptions,
9
9
  KB_JWT_TYP,
10
- PresentationFrame,
11
- SDJWTCompact,
12
- SDJWTConfig,
10
+ type PresentationFrame,
11
+ type SDJWTCompact,
12
+ type SDJWTConfig,
13
13
  } from '@sd-jwt/types';
14
14
  import { getSDAlgAndPayload } from '@sd-jwt/decode';
15
- import { JwtPayload } from '@sd-jwt/types';
15
+ import type { JwtPayload } from '@sd-jwt/types';
16
16
 
17
17
  export * from './sdjwt';
18
18
  export * from './kbjwt';
package/src/jwt.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Base64urlEncode, SDJWTException } from '@sd-jwt/utils';
2
- import { Base64urlString, Signer, Verifier } from '@sd-jwt/types';
2
+ import type { Base64urlString, Signer, Verifier } from '@sd-jwt/types';
3
3
  import { decodeJwt } from '@sd-jwt/decode';
4
4
 
5
5
  export type JwtData<
package/src/kbjwt.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { Base64urlEncode, SDJWTException } from '@sd-jwt/utils';
2
2
  import { Jwt } from './jwt';
3
3
  import {
4
- JwtPayload,
4
+ type JwtPayload,
5
5
  KB_JWT_TYP,
6
- kbHeader,
7
- kbPayload,
8
- KbVerifier,
6
+ type kbHeader,
7
+ type kbPayload,
8
+ type KbVerifier,
9
9
  } from '@sd-jwt/types';
10
10
 
11
11
  export class KBJwt<
package/src/sdjwt.ts CHANGED
@@ -3,18 +3,18 @@ import { SDJWTException, Disclosure } from '@sd-jwt/utils';
3
3
  import { Jwt } from './jwt';
4
4
  import { KBJwt } from './kbjwt';
5
5
  import {
6
- DisclosureFrame,
7
- Hasher,
8
- HasherAndAlg,
9
- PresentationFrame,
10
- SDJWTCompact,
6
+ type DisclosureFrame,
7
+ type Hasher,
8
+ type HasherAndAlg,
9
+ type PresentationFrame,
10
+ type SDJWTCompact,
11
11
  SD_DECOY,
12
12
  SD_DIGEST,
13
13
  SD_LIST_KEY,
14
14
  SD_SEPARATOR,
15
- SaltGenerator,
16
- kbHeader,
17
- kbPayload,
15
+ type SaltGenerator,
16
+ type kbHeader,
17
+ type kbPayload,
18
18
  } from '@sd-jwt/types';
19
19
  import { createHashMapping, getSDAlgAndPayload, unpack } from '@sd-jwt/decode';
20
20
  import { transformPresentationFrame } from '@sd-jwt/present';
@@ -236,7 +236,7 @@ export const pack = async <T extends Record<string, unknown>>(
236
236
 
237
237
  for (const key in disclosureFrame) {
238
238
  if (key !== SD_DIGEST) {
239
- const idx = parseInt(key);
239
+ const idx = Number.parseInt(key);
240
240
  const packed = await pack(
241
241
  claims[idx],
242
242
  disclosureFrame[idx],
@@ -1,9 +1,9 @@
1
- import { SDJwtInstance, SdJwtPayload } from '../index';
2
- import { Signer, Verifier, KbVerifier, JwtPayload } from '@sd-jwt/types';
3
- import Crypto, { KeyLike } from 'node:crypto';
1
+ import { SDJwtInstance, type SdJwtPayload } from '../index';
2
+ import type { Signer, Verifier, KbVerifier, JwtPayload } from '@sd-jwt/types';
3
+ import Crypto, { type KeyLike } from 'node:crypto';
4
4
  import { describe, expect, test } from 'vitest';
5
5
  import { digest, generateSalt } from '@sd-jwt/crypto-nodejs';
6
- import { importJWK, exportJWK, JWK } from 'jose';
6
+ import { importJWK, exportJWK, type JWK } from 'jose';
7
7
 
8
8
  export const createSignerVerifier = () => {
9
9
  const { privateKey, publicKey } = Crypto.generateKeyPairSync('ed25519');
@@ -1,7 +1,7 @@
1
1
  import { SDJWTException } from '@sd-jwt/utils';
2
2
  import { Jwt } from '../jwt';
3
3
  import Crypto from 'node:crypto';
4
- import { Signer, Verifier } from '@sd-jwt/types';
4
+ import type { Signer, Verifier } from '@sd-jwt/types';
5
5
  import { describe, expect, test } from 'vitest';
6
6
 
7
7
  describe('JWT', () => {
@@ -1,15 +1,15 @@
1
- import { SDJWTException } from '@sd-jwt/utils';
1
+ import type { SDJWTException } from '@sd-jwt/utils';
2
2
  import { KBJwt } from '../kbjwt';
3
3
  import {
4
- JwtPayload,
4
+ type JwtPayload,
5
5
  KB_JWT_TYP,
6
- KbVerifier,
7
- Signer,
6
+ type KbVerifier,
7
+ type Signer,
8
8
  Verifier,
9
9
  } from '@sd-jwt/types';
10
- import Crypto, { KeyLike } from 'node:crypto';
10
+ import Crypto, { type KeyLike } from 'node:crypto';
11
11
  import { describe, expect, test } from 'vitest';
12
- import { JWK, exportJWK, importJWK } from 'jose';
12
+ import { type JWK, exportJWK, importJWK } from 'jose';
13
13
 
14
14
  describe('KB JWT', () => {
15
15
  test('create', async () => {
@@ -3,7 +3,7 @@ import { Jwt } from '../jwt';
3
3
  import { SDJwt, listKeys, pack } from '../sdjwt';
4
4
  import Crypto from 'node:crypto';
5
5
  import { describe, test, expect } from 'vitest';
6
- import { DisclosureFrame, Signer } from '@sd-jwt/types';
6
+ import type { DisclosureFrame, Signer } from '@sd-jwt/types';
7
7
  import { generateSalt, digest as hasher } from '@sd-jwt/crypto-nodejs';
8
8
  import { unpack, createHashMapping } from '@sd-jwt/decode';
9
9
 
@@ -1,13 +1,13 @@
1
1
  import Crypto from 'node:crypto';
2
- import { SDJwtInstance, SdJwtPayload } from '../src';
3
- import {
2
+ import { SDJwtInstance, type SdJwtPayload } from '../src';
3
+ import type {
4
4
  DisclosureFrame,
5
5
  PresentationFrame,
6
6
  Signer,
7
7
  Verifier,
8
8
  } from '@sd-jwt/types';
9
- import fs from 'fs';
10
- import path from 'path';
9
+ import fs from 'node:fs';
10
+ import path from 'node:path';
11
11
  import { describe, expect, test } from 'vitest';
12
12
  import { digest, generateSalt } from '@sd-jwt/crypto-nodejs';
13
13