@@ -34,14 +34,14 @@ import {
34
34
Resolver ,
35
35
type VerificationMethod ,
36
36
} from 'did-resolver' ;
37
- import { createConnection } from 'typeorm' ;
37
+ import { DataSource } from 'typeorm' ;
38
38
import { beforeAll , describe , expect , it } from 'vitest' ;
39
39
import type { SdJwtVcPayload } from '@sd-jwt/sd-jwt-vc' ;
40
40
import { decodeSdJwt } from '@sd-jwt/decode' ;
41
41
import type { KBJwt } from '@sd-jwt/core' ;
42
42
import { type ISDJwtPlugin , SDJwtPlugin } from '../index' ;
43
43
44
- async function verifySignature < T > (
44
+ async function verifySignature (
45
45
data : string ,
46
46
signature : string ,
47
47
key : JsonWebKey ,
@@ -76,7 +76,6 @@ describe('Agent plugin', () => {
76
76
77
77
// Issuer define the claims object with the user's information
78
78
const claims = {
79
- sub : '' ,
80
79
given_name : 'John' ,
81
80
family_name : 'Deo' ,
82
81
@@ -104,14 +103,14 @@ describe('Agent plugin', () => {
104
103
105
104
beforeAll ( async ( ) => {
106
105
const KMS_SECRET_KEY = '000102030405060708090a0b0c0d0e0f' ;
107
- const dbConnection = await createConnection ( {
106
+ const dbConnection = await new DataSource ( {
108
107
type : 'sqlite' ,
109
108
database : ':memory:' ,
110
109
entities : Entities ,
111
110
migrations,
112
111
synchronize : true ,
113
112
logging : false ,
114
- } ) ;
113
+ } ) . initialize ( ) ;
115
114
agent = createAgent < AgentType > ( {
116
115
plugins : [
117
116
new SDJwtPlugin ( {
@@ -164,7 +163,7 @@ describe('Agent plugin', () => {
164
163
options : { keyType : 'Secp256r1' } as JwkCreateIdentifierOptions ,
165
164
} )
166
165
. then ( ( did ) => `${ did . did } #0` ) ;
167
- claims . sub = holder ;
166
+ // claims.sub = holder;
168
167
} ) ;
169
168
170
169
it ( 'create a sd-jwt' , async ( ) => {
@@ -229,6 +228,7 @@ describe('Agent plugin', () => {
229
228
it ( 'create a presentation' , async ( ) => {
230
229
const credentialPayload : SdJwtVcPayload = {
231
230
...claims ,
231
+ sub : holder ,
232
232
iss : issuer ,
233
233
iat : new Date ( ) . getTime ( ) / 1000 ,
234
234
vct : '' ,
@@ -385,6 +385,7 @@ describe('Agent plugin', () => {
385
385
const credentialPayload : SdJwtVcPayload = {
386
386
...claims ,
387
387
iss : issuer ,
388
+ sub : holder ,
388
389
iat : new Date ( ) . getTime ( ) / 1000 ,
389
390
vct : '' ,
390
391
} ;
0 commit comments