@sd-jwt/sd-jwt-vc 0.6.2-next.17 → 0.6.2-next.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sd-jwt/sd-jwt-vc",
3
- "version": "0.6.2-next.17+03bd765",
3
+ "version": "0.6.2-next.18+00a1c52",
4
4
  "description": "sd-jwt draft 7 implementation in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -39,11 +39,11 @@
39
39
  },
40
40
  "license": "Apache-2.0",
41
41
  "dependencies": {
42
- "@sd-jwt/core": "0.6.2-next.17+03bd765"
42
+ "@sd-jwt/core": "0.6.2-next.18+00a1c52"
43
43
  },
44
44
  "devDependencies": {
45
- "@sd-jwt/crypto-nodejs": "0.6.2-next.17+03bd765",
46
- "@sd-jwt/types": "0.6.2-next.17+03bd765"
45
+ "@sd-jwt/crypto-nodejs": "0.6.2-next.18+00a1c52",
46
+ "@sd-jwt/types": "0.6.2-next.18+00a1c52"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
@@ -61,5 +61,5 @@
61
61
  "esm"
62
62
  ]
63
63
  },
64
- "gitHead": "03bd765018ccb169e7ccdbf514ff577bb0f65af0"
64
+ "gitHead": "00a1c524bfae4ece15788b06fa4939f910520aa2"
65
65
  }
@@ -1,14 +1,31 @@
1
1
  import { digest, generateSalt } from '@sd-jwt/crypto-nodejs';
2
- import type { DisclosureFrame } from '@sd-jwt/types';
2
+ import type { DisclosureFrame, Signer, Verifier } from '@sd-jwt/types';
3
3
  import { describe, test, expect } from 'vitest';
4
4
  import { SDJwtVcInstance } from '..';
5
- import { createSignerVerifier } from '../../test/app-e2e.spec';
6
5
  import type { SdJwtVcPayload } from '../sd-jwt-vc-payload';
6
+ import Crypto from 'node:crypto';
7
7
 
8
8
  const iss = 'ExampleIssuer';
9
9
  const vct = 'https://example.com/schema/1';
10
10
  const iat = new Date().getTime() / 1000;
11
11
 
12
+ const createSignerVerifier = () => {
13
+ const { privateKey, publicKey } = Crypto.generateKeyPairSync('ed25519');
14
+ const signer: Signer = async (data: string) => {
15
+ const sig = Crypto.sign(null, Buffer.from(data), privateKey);
16
+ return Buffer.from(sig).toString('base64url');
17
+ };
18
+ const verifier: Verifier = async (data: string, sig: string) => {
19
+ return Crypto.verify(
20
+ null,
21
+ Buffer.from(data),
22
+ publicKey,
23
+ Buffer.from(sig, 'base64url'),
24
+ );
25
+ };
26
+ return { signer, verifier };
27
+ };
28
+
12
29
  describe('App', () => {
13
30
  test('Example', async () => {
14
31
  const { signer, verifier } = createSignerVerifier();
@@ -11,7 +11,7 @@ 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
 
14
- export const createSignerVerifier = () => {
14
+ const createSignerVerifier = () => {
15
15
  const { privateKey, publicKey } = Crypto.generateKeyPairSync('ed25519');
16
16
  const signer: Signer = async (data: string) => {
17
17
  const sig = Crypto.sign(null, Buffer.from(data), privateKey);