Skip to content

Commit 30a5273

Browse files
fix constants import
1 parent 83a0e04 commit 30a5273

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

src/auth/auth.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ import { Options, DocumentLoader } from '@iden3/js-jsonld-merklization';
3333
import path from 'path';
3434
import { DID, getUnixTimestamp } from '@iden3/js-iden3-core';
3535
import { ZeroKnowledgeProofRequest } from '@0xpolygonid/js-sdk';
36-
import {
37-
MediaType,
38-
ProtocolVersion
39-
} from '@0xpolygonid/js-sdk/dist/types/iden3comm/constants';
4036

4137
/**
4238
* Options to pass to createAuthorizationRequest function
@@ -440,14 +436,14 @@ export class Verifier {
440436
if (!profile?.length) {
441437
return;
442438
}
443-
const supportedMediaTypes: MediaType[] = [];
439+
const supportedMediaTypes: PROTOCOL_CONSTANTS.MediaType[] = [];
444440
for (const acceptProfile of profile) {
445441
// 1. check protocol version
446442
const { protocolVersion, env } = parseAcceptProfile(acceptProfile);
447443
const messageTypeVersion = Number(messageType.split('/').at(-2));
448444
if (
449-
protocolVersion !== ProtocolVersion.V1 ||
450-
(protocolVersion === ProtocolVersion.V1 &&
445+
protocolVersion !== PROTOCOL_CONSTANTS.ProtocolVersion.V1 ||
446+
(protocolVersion === PROTOCOL_CONSTANTS.ProtocolVersion.V1 &&
451447
(messageTypeVersion < 1 || messageTypeVersion >= 2))
452448
) {
453449
continue;

test/auth.test.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,14 @@ import { Circuits } from '@lib/circuits/registry';
2222
import path from 'path';
2323
import { resolveDIDDocument, resolvers, schemaLoader, testOpts } from './mocks';
2424
import { getDateFromUnixTimestamp, getUnixTimestamp } from '@iden3/js-iden3-core';
25-
import {
26-
AcceptAuthCircuits,
27-
MediaType,
28-
ProtocolVersion
29-
} from '@0xpolygonid/js-sdk/dist/types/iden3comm/constants';
3025

3126
describe('auth tests', () => {
3227
const connectionString = process.env.IPFS_URL ?? 'https://ipfs.io';
3328
const acceptProfile = buildAccept([
3429
{
35-
protocolVersion: ProtocolVersion.V1,
36-
env: MediaType.ZKPMessage,
37-
circuits: [AcceptAuthCircuits.AuthV2]
30+
protocolVersion: PROTOCOL_CONSTANTS.ProtocolVersion.V1,
31+
env: PROTOCOL_CONSTANTS.MediaType.ZKPMessage,
32+
circuits: [PROTOCOL_CONSTANTS.AcceptAuthCircuits.AuthV2]
3833
}
3934
]);
4035
const expiresTime = getDateFromUnixTimestamp(getUnixTimestamp(new Date()) + 5 * 60);

0 commit comments

Comments
 (0)