From 5034468ab464f39e0c82cf09af8605d23d1f81f6 Mon Sep 17 00:00:00 2001 From: Martin Auer Date: Thu, 25 Jul 2024 15:14:50 +0200 Subject: [PATCH] fix: some imports --- .../__tests__/AuthenticationRequest.request.spec.ts | 2 +- .../__tests__/AuthenticationRequest.verify.spec.ts | 2 +- .../__tests__/AuthenticationResponse.response.spec.ts | 2 +- packages/siop-oid4vp/lib/__tests__/DidJwtTestUtils.ts | 7 +++---- packages/siop-oid4vp/lib/__tests__/IT.spec.ts | 2 +- packages/siop-oid4vp/lib/__tests__/OP.request.spec.ts | 2 +- .../lib/__tests__/PresentationExchange.spec.ts | 2 +- packages/siop-oid4vp/lib/__tests__/RP.request.spec.ts | 2 +- packages/siop-oid4vp/lib/__tests__/SdJwt.spec.ts | 2 +- packages/siop-oid4vp/lib/__tests__/TestUtils.ts | 5 +---- packages/siop-oid4vp/lib/__tests__/e2e/EBSI.spec.ts | 4 ++-- .../lib/__tests__/e2e/mattr.launchpad.spec.ts | 11 ++--------- .../lib/__tests__/functions/DidSiopMetadata.spec.ts | 3 ++- .../__tests__/regressions/ClientIdIsObject.spec.ts | 5 +++-- .../spec-compliance/jwtVCPresentationProfile.spec.ts | 2 +- 15 files changed, 22 insertions(+), 31 deletions(-) diff --git a/packages/siop-oid4vp/lib/__tests__/AuthenticationRequest.request.spec.ts b/packages/siop-oid4vp/lib/__tests__/AuthenticationRequest.request.spec.ts index 47fbce65..59cd56a9 100644 --- a/packages/siop-oid4vp/lib/__tests__/AuthenticationRequest.request.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/AuthenticationRequest.request.spec.ts @@ -1,5 +1,6 @@ import { parse } from 'querystring' +import { SigningAlgo } from '@sphereon/oid4vci-common' import { IPresentationDefinition } from '@sphereon/pex' import { IProofType } from '@sphereon/ssi-types' @@ -9,7 +10,6 @@ import { RequestObject, ResponseType, Scope, - SigningAlgo, SubjectIdentifierType, SubjectType, SupportedVersion, diff --git a/packages/siop-oid4vp/lib/__tests__/AuthenticationRequest.verify.spec.ts b/packages/siop-oid4vp/lib/__tests__/AuthenticationRequest.verify.spec.ts index 56f07fa2..e70c3122 100644 --- a/packages/siop-oid4vp/lib/__tests__/AuthenticationRequest.verify.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/AuthenticationRequest.verify.spec.ts @@ -1,3 +1,4 @@ +import { SigningAlgo } from '@sphereon/oid4vci-common' import { IProofType } from '@sphereon/ssi-types' import Ajv from 'ajv' import * as dotenv from 'dotenv' @@ -9,7 +10,6 @@ import { RequestObject, ResponseType, Scope, - SigningAlgo, SubjectType, SupportedVersion, VerifyAuthorizationRequestOpts, diff --git a/packages/siop-oid4vp/lib/__tests__/AuthenticationResponse.response.spec.ts b/packages/siop-oid4vp/lib/__tests__/AuthenticationResponse.response.spec.ts index f178b0b2..4437b1d6 100644 --- a/packages/siop-oid4vp/lib/__tests__/AuthenticationResponse.response.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/AuthenticationResponse.response.spec.ts @@ -1,3 +1,4 @@ +import { SigningAlgo } from '@sphereon/oid4vci-common' import { IPresentationDefinition } from '@sphereon/pex' import { ICredential, @@ -20,7 +21,6 @@ import { ResponseMode, ResponseType, Scope, - SigningAlgo, SubjectIdentifierType, SubjectType, SupportedVersion, diff --git a/packages/siop-oid4vp/lib/__tests__/DidJwtTestUtils.ts b/packages/siop-oid4vp/lib/__tests__/DidJwtTestUtils.ts index 4d40dc26..8c9cf221 100644 --- a/packages/siop-oid4vp/lib/__tests__/DidJwtTestUtils.ts +++ b/packages/siop-oid4vp/lib/__tests__/DidJwtTestUtils.ts @@ -1,10 +1,9 @@ +import { JwtPayload, parseJWT, SigningAlgo } from '@sphereon/oid4vci-common' import { VerifyCallback } from '@sphereon/wellknown-dids-client' import { createJWT, EdDSASigner, ES256KSigner, ES256Signer, hexToBytes, JWTOptions, JWTVerifyOptions, Signer, verifyJWT } from 'did-jwt' import { Resolvable } from 'did-resolver' -import { parseJWT } from '../helpers/jwtUtils' -import { DEFAULT_EXPIRATION_TIME, JwtPayload, ResponseIss, SigningAlgo, SIOPErrors, VerifiedJWT, VerifyJwtCallback } from '../types' -import { CreateJwtCallback } from '../types/JwtIssuer' +import { DEFAULT_EXPIRATION_TIME, ResponseIss, SIOPErrors, VerifiedJWT, VerifyJwtCallback } from '../types' import { getResolver } from './ResolverTestUtils' @@ -68,7 +67,7 @@ export const internalSignature = (hexPrivateKey: string, did: string, didUrl: st }) } -export function getCreateJwtCallback(signature: InternalSignature): CreateJwtCallback { +export function getCreateJwtCallback(signature: InternalSignature) { return (jwtIssuer, jwt) => { if (jwtIssuer.method === 'did') { const issuer = jwtIssuer.didUrl.split('#')[0] diff --git a/packages/siop-oid4vp/lib/__tests__/IT.spec.ts b/packages/siop-oid4vp/lib/__tests__/IT.spec.ts index 3c28184d..e8b76dce 100644 --- a/packages/siop-oid4vp/lib/__tests__/IT.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/IT.spec.ts @@ -1,5 +1,6 @@ import { EventEmitter } from 'events' +import { SigningAlgo } from '@sphereon/oid4vci-common' import { IPresentationDefinition } from '@sphereon/pex' import { CredentialMapper, IPresentation, IProofType, IVerifiableCredential, W3CVerifiablePresentation } from '@sphereon/ssi-types' import nock from 'nock' @@ -19,7 +20,6 @@ import { RevocationVerification, RP, Scope, - SigningAlgo, SubjectType, SupportedVersion, verifyRevocation, diff --git a/packages/siop-oid4vp/lib/__tests__/OP.request.spec.ts b/packages/siop-oid4vp/lib/__tests__/OP.request.spec.ts index ff6d5c48..e18f99b7 100644 --- a/packages/siop-oid4vp/lib/__tests__/OP.request.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/OP.request.spec.ts @@ -1,3 +1,4 @@ +import { SigningAlgo } from '@sphereon/oid4vci-common' import { IProofType } from '@sphereon/ssi-types' import nock from 'nock' @@ -11,7 +12,6 @@ import { ResponseType, RP, Scope, - SigningAlgo, SubjectIdentifierType, SubjectType, SupportedVersion, diff --git a/packages/siop-oid4vp/lib/__tests__/PresentationExchange.spec.ts b/packages/siop-oid4vp/lib/__tests__/PresentationExchange.spec.ts index af90caa9..c4bd2f4a 100644 --- a/packages/siop-oid4vp/lib/__tests__/PresentationExchange.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/PresentationExchange.spec.ts @@ -1,3 +1,4 @@ +import { SigningAlgo } from '@sphereon/oid4vci-common' import { PresentationDefinitionV1 } from '@sphereon/pex-models' import { CredentialMapper, IPresentation, IProofType, IVerifiableCredential } from '@sphereon/ssi-types' import { W3CVerifiablePresentation } from '@sphereon/ssi-types/src/types/w3c-vc' @@ -14,7 +15,6 @@ import { PresentationSignCallback, ResponseType, Scope, - SigningAlgo, SubjectIdentifierType, SubjectType, } from '..' diff --git a/packages/siop-oid4vp/lib/__tests__/RP.request.spec.ts b/packages/siop-oid4vp/lib/__tests__/RP.request.spec.ts index aae56def..3384a157 100644 --- a/packages/siop-oid4vp/lib/__tests__/RP.request.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/RP.request.spec.ts @@ -1,3 +1,4 @@ +import { SigningAlgo } from '@sphereon/oid4vci-common' import { IProofType } from '@sphereon/ssi-types' import { @@ -8,7 +9,6 @@ import { ResponseType, RP, Scope, - SigningAlgo, SubjectIdentifierType, SubjectType, SupportedVersion, diff --git a/packages/siop-oid4vp/lib/__tests__/SdJwt.spec.ts b/packages/siop-oid4vp/lib/__tests__/SdJwt.spec.ts index e9e882f1..81ce741b 100644 --- a/packages/siop-oid4vp/lib/__tests__/SdJwt.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/SdJwt.spec.ts @@ -1,5 +1,6 @@ import { createHash } from 'node:crypto' +import { SigningAlgo } from '@sphereon/oid4vci-common' import { IPresentationDefinition, SdJwtDecodedVerifiableCredentialWithKbJwtInput } from '@sphereon/pex' import { OriginalVerifiableCredential } from '@sphereon/ssi-types' @@ -16,7 +17,6 @@ import { RevocationVerification, RP, Scope, - SigningAlgo, SubjectType, SupportedVersion, VPTokenLocation, diff --git a/packages/siop-oid4vp/lib/__tests__/TestUtils.ts b/packages/siop-oid4vp/lib/__tests__/TestUtils.ts index e0949cc0..811c1f23 100644 --- a/packages/siop-oid4vp/lib/__tests__/TestUtils.ts +++ b/packages/siop-oid4vp/lib/__tests__/TestUtils.ts @@ -1,6 +1,6 @@ import crypto from 'crypto' -import { uuidv4 } from '@sphereon/oid4vci-common' +import { JwtPayload, parseJWT, SigningAlgo, uuidv4 } from '@sphereon/oid4vci-common' import { IProofType } from '@sphereon/ssi-types' import base58 from 'bs58' import { ethers } from 'ethers' @@ -11,18 +11,15 @@ import { assertValidMetadata, base64ToHexString, DiscoveryMetadataPayload, - JwtPayload, KeyCurve, KeyType, ResponseIss, ResponseType, RPRegistrationMetadataPayload, Scope, - SigningAlgo, SubjectSyntaxTypesSupportedValues, SubjectType, } from '../' -import { parseJWT } from '../helpers/jwtUtils' import SIOPErrors from '../types/Errors' import { DIDDocument } from './ResolverTestUtils' diff --git a/packages/siop-oid4vp/lib/__tests__/e2e/EBSI.spec.ts b/packages/siop-oid4vp/lib/__tests__/e2e/EBSI.spec.ts index 700ced99..4842f478 100644 --- a/packages/siop-oid4vp/lib/__tests__/e2e/EBSI.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/e2e/EBSI.spec.ts @@ -1,13 +1,13 @@ import { getResolver as getKeyResolver } from '@cef-ebsi/key-did-resolver' // import { EbsiWallet } from '@cef-ebsi/wallet-lib'; import EbsiWallet from '@cef-ebsi/wallet-lib' -import { uuidv4 } from '@sphereon/oid4vci-common' +import { SigningAlgo, uuidv4 } from '@sphereon/oid4vci-common' import { PresentationSignCallBackParams } from '@sphereon/pex' import { parseDid, W3CVerifiablePresentation } from '@sphereon/ssi-types' import { Resolver } from 'did-resolver' import { importJWK, JWK, SignJWT } from 'jose' -import { OP, SigningAlgo } from '../../' +import { OP } from '../../' import { getCreateJwtCallback, getVerifyJwtCallback } from '../DidJwtTestUtils' const ID_TOKEN_REQUEST_URL = 'https://api-conformance.ebsi.eu/conformance/v3/auth-mock/id_token_request' diff --git a/packages/siop-oid4vp/lib/__tests__/e2e/mattr.launchpad.spec.ts b/packages/siop-oid4vp/lib/__tests__/e2e/mattr.launchpad.spec.ts index 08bb969a..116b01b9 100644 --- a/packages/siop-oid4vp/lib/__tests__/e2e/mattr.launchpad.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/e2e/mattr.launchpad.spec.ts @@ -1,3 +1,4 @@ +import { SigningAlgo } from '@sphereon/oid4vci-common' import { PresentationSignCallBackParams, PresentationSubmissionLocation } from '@sphereon/pex' import { W3CVerifiablePresentation } from '@sphereon/ssi-types' import * as ed25519 from '@transmute/did-key-ed25519' @@ -6,15 +7,7 @@ import { DIDDocument, DIDResolutionResult } from 'did-resolver' import { importJWK, JWK, SignJWT } from 'jose' import * as u8a from 'uint8arrays' -import { - AuthorizationRequest, - AuthorizationResponse, - OP, - PresentationDefinitionWithLocation, - PresentationExchange, - SigningAlgo, - SupportedVersion, -} from '../..' +import { AuthorizationRequest, AuthorizationResponse, OP, PresentationDefinitionWithLocation, PresentationExchange, SupportedVersion } from '../..' import { getCreateJwtCallback, getVerifyJwtCallback } from '../DidJwtTestUtils' export interface InitiateOfferRequest { diff --git a/packages/siop-oid4vp/lib/__tests__/functions/DidSiopMetadata.spec.ts b/packages/siop-oid4vp/lib/__tests__/functions/DidSiopMetadata.spec.ts index a6f8d6aa..9c857102 100644 --- a/packages/siop-oid4vp/lib/__tests__/functions/DidSiopMetadata.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/functions/DidSiopMetadata.spec.ts @@ -1,7 +1,8 @@ +import { SigningAlgo } from '@sphereon/oid4vci-common' import { Format } from '@sphereon/pex-models' import { IProofType } from '@sphereon/ssi-types' -import { SigningAlgo, SIOPErrors, supportedCredentialsFormats } from '../..' +import { SIOPErrors, supportedCredentialsFormats } from '../..' describe('DidSiopMetadata should ', () => { it('find supportedCredentialsFormats correctly', async function () { diff --git a/packages/siop-oid4vp/lib/__tests__/regressions/ClientIdIsObject.spec.ts b/packages/siop-oid4vp/lib/__tests__/regressions/ClientIdIsObject.spec.ts index ab842788..49f9b1f7 100644 --- a/packages/siop-oid4vp/lib/__tests__/regressions/ClientIdIsObject.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/regressions/ClientIdIsObject.spec.ts @@ -1,5 +1,6 @@ -import { PassBy, ResponseType, RevocationVerification, RP, Scope, SigningAlgo, SubjectType, SupportedVersion } from '../..' -import { parseJWT } from '../../helpers/jwtUtils' +import { parseJWT, SigningAlgo } from '@sphereon/oid4vci-common' + +import { PassBy, ResponseType, RevocationVerification, RP, Scope, SubjectType, SupportedVersion } from '../..' import { internalSignature } from '../DidJwtTestUtils' const EXAMPLE_REDIRECT_URL = 'https://acme.com/hello' diff --git a/packages/siop-oid4vp/lib/__tests__/spec-compliance/jwtVCPresentationProfile.spec.ts b/packages/siop-oid4vp/lib/__tests__/spec-compliance/jwtVCPresentationProfile.spec.ts index 1f75d92c..718a0b35 100644 --- a/packages/siop-oid4vp/lib/__tests__/spec-compliance/jwtVCPresentationProfile.spec.ts +++ b/packages/siop-oid4vp/lib/__tests__/spec-compliance/jwtVCPresentationProfile.spec.ts @@ -1,3 +1,4 @@ +import { SigningAlgo } from '@sphereon/oid4vci-common' import { PresentationSignCallBackParams } from '@sphereon/pex' import { IProofType } from '@sphereon/ssi-types' import * as jose from 'jose' @@ -20,7 +21,6 @@ import { ResponseType, RevocationVerification, RP, - SigningAlgo, SupportedVersion, VPTokenLocation, } from '../..'