Skip to content

Commit

Permalink
fix: clientId fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Jun 2, 2024
1 parent 9f08d82 commit cad41fc
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export class CreateContacts1690925872592 implements MigrationInterface {
`CREATE TABLE "ElectronicAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "electronic_address" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "partyId" uuid, CONSTRAINT "PK_ElectronicAddress_id" PRIMARY KEY ("id"))`,
)
await queryRunner.query(
`CREATE TABLE "PhysicalAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "street_name" character varying(255) NOT NULL, "street_number" character varying(255) NOT NULL, "postal_code" character varying(255) NOT NULL, "city_name" character varying(255) NOT NULL, "province_name" character varying(255) NOT NULL, "country_code" character varying(2) NOT NULL, "building_name" character varying(255), "partyId" uuid, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_PhysicalAddress_id" PRIMARY KEY ("id"))`
);
`CREATE TABLE "PhysicalAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "street_name" character varying(255) NOT NULL, "street_number" character varying(255) NOT NULL, "postal_code" character varying(255) NOT NULL, "city_name" character varying(255) NOT NULL, "province_name" character varying(255) NOT NULL, "country_code" character varying(2) NOT NULL, "building_name" character varying(255), "partyId" uuid, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_PhysicalAddress_id" PRIMARY KEY ("id"))`,
)
await queryRunner.query(
`CREATE TABLE "Party" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying(255), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "party_type_id" uuid NOT NULL, CONSTRAINT "PK_Party_id" PRIMARY KEY ("id"))`,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ export class CreateAuditEvents1701634812183 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TYPE "public"."Level_enum" AS ENUM('0', '1', '2', '3')`)
await queryRunner.query(
`CREATE TYPE "public"."System_enum" AS ENUM('general', 'kms', 'identity', 'oid4vci', 'credentials', 'web3', 'profile', 'contact')`
`CREATE TYPE "public"."System_enum" AS ENUM('general', 'kms', 'identity', 'oid4vci', 'credentials', 'web3', 'profile', 'contact')`,
)
await queryRunner.query(
`CREATE TYPE "public"."Subsystem_type_enum" AS ENUM('key', 'did_provider', 'did_resolver', 'oid4vp_op', 'oid4vci_client', 'siopv2_op', 'contact_manager', 'vc_issuer', 'vc_verifier', 'vc_persistence', 'transport', 'profile')`
`CREATE TYPE "public"."Subsystem_type_enum" AS ENUM('key', 'did_provider', 'did_resolver', 'oid4vp_op', 'oid4vci_client', 'siopv2_op', 'contact_manager', 'vc_issuer', 'vc_verifier', 'vc_persistence', 'transport', 'profile')`,
)
await queryRunner.query(`CREATE TYPE "public"."Action_type_enum" AS ENUM('create', 'read', 'update', 'delete', 'execute')`)
await queryRunner.query(`CREATE TYPE "public"."Initiator_type_enum" AS ENUM('user', 'system', 'external')`)
await queryRunner.query(`CREATE TYPE "public"."System_correlation_id_type_enum" AS ENUM('did', 'email', 'hostname', 'phone', 'user')`)
await queryRunner.query(`CREATE TYPE "public"."Party_correlation_type_enum" AS ENUM('did', 'email', 'hostname', 'phone')`)
await queryRunner.query(
`CREATE TABLE "AuditEvents" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "timestamp" TIMESTAMP NOT NULL, "level" "public"."Level_enum" NOT NULL, "correlationId" TEXT NOT NULL, "system" "public"."System_enum" NOT NULL, "subSystemType" "public"."Subsystem_type_enum" NOT NULL, "actionType" "public"."Action_type_enum" NOT NULL, "actionSubType" TEXT NOT NULL, "initiatorType" "public"."Initiator_type_enum" NOT NULL, "systemCorrelationIdType" "public"."System_correlation_id_type_enum", "systemCorrelationId" TEXT, "systemAlias" TEXT, "partyCorrelationType" "public"."Party_correlation_type_enum", "partyCorrelationId" TEXT, "partyAlias" TEXT, "description" TEXT NOT NULL, "data" TEXT, "diagnosticData" TEXT, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_AuditEvents_id" PRIMARY KEY ("id"))`
`CREATE TABLE "AuditEvents" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "timestamp" TIMESTAMP NOT NULL, "level" "public"."Level_enum" NOT NULL, "correlationId" TEXT NOT NULL, "system" "public"."System_enum" NOT NULL, "subSystemType" "public"."Subsystem_type_enum" NOT NULL, "actionType" "public"."Action_type_enum" NOT NULL, "actionSubType" TEXT NOT NULL, "initiatorType" "public"."Initiator_type_enum" NOT NULL, "systemCorrelationIdType" "public"."System_correlation_id_type_enum", "systemCorrelationId" TEXT, "systemAlias" TEXT, "partyCorrelationType" "public"."Party_correlation_type_enum", "partyCorrelationId" TEXT, "partyAlias" TEXT, "description" TEXT NOT NULL, "data" TEXT, "diagnosticData" TEXT, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_AuditEvents_id" PRIMARY KEY ("id"))`,
)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/data-store/src/utils/contact/MappingUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
Party,
PartyRelationship,
PartyType,
PhysicalAddress
PhysicalAddress,
} from '../../types'
import { PartyEntity } from '../../entities/contact/PartyEntity'
import { IdentityEntity } from '../../entities/contact/IdentityEntity'
Expand Down
4 changes: 2 additions & 2 deletions packages/oid4vci-holder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"build:clean": "tsc --build --clean && tsc --build"
},
"dependencies": {
"@sphereon/oid4vci-client": "0.10.4-unstable.70",
"@sphereon/oid4vci-common": "0.10.4-unstable.70",
"@sphereon/oid4vci-client": "0.10.4-unstable.71",
"@sphereon/oid4vci-common": "0.10.4-unstable.71",
"@sphereon/ssi-sdk-ext.did-utils": "0.18.0",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.18.0",
"@sphereon/ssi-sdk.contact-manager": "workspace:*",
Expand Down
22 changes: 11 additions & 11 deletions packages/oid4vci-holder/src/agent/OID4VCIHolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ export class OID4VCIHolder implements IAgentPlugin {
* FIXME: This method can only be used locally. Creating the interpreter should be local to where the agent is running
*/
private async oid4vciHolderGetMachineInterpreter(args: OID4VCIMachineInstanceOpts, context: RequiredContext): Promise<OID4VCIMachineId> {
const authorizationRequestOpts = { ...this.defaultAuthorizationRequestOpts, ...args.authorizationRequestOpts }
const services = {
initiateOID4VCI: (args: InitiateOID4VCIArgs) => this.oid4vciHolderGetCredentialOfferData(args, context),
initiateOID4VCI: (args: InitiateOID4VCIArgs) => this.oid4vciHolderGetCredentialOfferData({ ...args, ...authorizationRequestOpts }, context),
createCredentialSelection: (args: CreateCredentialSelectionArgs) => this.oid4vciHolderCreateCredentialSelection(args, context),
getContact: (args: GetContactArgs) => this.oid4vciHolderGetContact(args, context),
getCredentials: (args: GetCredentialsArgs) => this.oid4vciHolderGetCredentials(args, context),
Expand All @@ -186,7 +187,7 @@ export class OID4VCIHolder implements IAgentPlugin {

const oid4vciMachineInstanceArgs: OID4VCIMachineInstanceOpts = {
...args,
authorizationRequestOpts: { ...this.defaultAuthorizationRequestOpts, ...args.authorizationRequestOpts },
authorizationRequestOpts,
services: {
...services,
...args.services,
Expand Down Expand Up @@ -218,20 +219,21 @@ export class OID4VCIHolder implements IAgentPlugin {
) {
return Promise.reject(Error(`Invalid OID4VCI credential offer URI: ${requestData?.uri}`))
}
const authorizationRequest = { ...this.defaultAuthorizationRequestOpts, ...args.authorizationRequestOpts } satisfies AuthorizationRequestOpts
const authorizationRequestOpts = { ...this.defaultAuthorizationRequestOpts, ...args.authorizationRequestOpts } satisfies AuthorizationRequestOpts

if (!authorizationRequest.redirectUri) {
authorizationRequest.redirectUri = OID4VCIHolder.DEFAULT_MOBILE_REDIRECT_URI
if (!authorizationRequestOpts.redirectUri) {
authorizationRequestOpts.redirectUri = OID4VCIHolder.DEFAULT_MOBILE_REDIRECT_URI
}
if (authorizationRequest.redirectUri.startsWith('http') && !authorizationRequest.clientId) {
if (authorizationRequestOpts.redirectUri.startsWith('http') && !authorizationRequestOpts.clientId) {
// At least set a default for a web based wallet.
// TODO: We really need (dynamic) client registration support
authorizationRequest.clientId = authorizationRequest.redirectUri
authorizationRequestOpts.clientId = authorizationRequestOpts.redirectUri
}

const openID4VCIClient = await OpenID4VCIClient.fromURI({
uri: requestData?.uri,
authorizationRequest,
authorizationRequest: authorizationRequestOpts,
clientId: authorizationRequestOpts.clientId,
})

const serverMetadata = await openID4VCIClient.retrieveServerMetadata()
Expand Down Expand Up @@ -377,9 +379,7 @@ export class OID4VCIHolder implements IAgentPlugin {

if (client.isEBSI()) {
iss = jwt.header.kid?.split('#')[0]
}

if (!iss) {
} else if (!iss) {
iss = jwt.header.kid?.split('#')[0]
}
if (!iss) {
Expand Down
4 changes: 2 additions & 2 deletions packages/oid4vci-holder/src/link-handler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
this.stateNavigationListener = args.stateNavigationListener
}

async handle(url: string | URL): Promise<void> {
async handle(url: string | URL, options?: OID4VCIHolderOptions): Promise<void> {
const uri = new URL(url).toString()
const offerData = convertURIToJsonObject(uri) as Record<string, unknown>
const hasCode = 'code' in offerData && !!offerData.code && !('issuer' in offerData)
Expand All @@ -48,7 +48,7 @@ export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
...(hasCode && { code: code }),
uri,
},
options: this.options,
options: { ...this.options, ...options },
stateNavigationListener: this.stateNavigationListener,
})

Expand Down
6 changes: 3 additions & 3 deletions packages/oid4vci-issuer-rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"start:dev": "ts-node __tests__/RestAPI.ts"
},
"dependencies": {
"@sphereon/oid4vci-common": "0.10.4-unstable.70",
"@sphereon/oid4vci-issuer": "0.10.4-unstable.70",
"@sphereon/oid4vci-issuer-server": "0.10.4-unstable.70",
"@sphereon/oid4vci-common": "0.10.4-unstable.71",
"@sphereon/oid4vci-issuer": "0.10.4-unstable.71",
"@sphereon/oid4vci-issuer-server": "0.10.4-unstable.71",
"@sphereon/ssi-express-support": "workspace:*",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@sphereon/ssi-sdk.oid4vci-issuer": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/oid4vci-issuer-rest-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"generate-plugin-schema": "ts-node ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
},
"dependencies": {
"@sphereon/oid4vci-common": "0.10.4-unstable.70",
"@sphereon/oid4vci-common": "0.10.4-unstable.71",
"@sphereon/ssi-types": "workspace:*",
"@veramo/core": "4.2.0",
"cross-fetch": "^3.1.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/oid4vci-issuer-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build:clean": "tsc --build --clean && tsc --build"
},
"dependencies": {
"@sphereon/oid4vci-common": "0.10.4-unstable.70",
"@sphereon/oid4vci-common": "0.10.4-unstable.71",
"@sphereon/ssi-sdk-ext.did-utils": "0.19.0",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@veramo/core": "4.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/oid4vci-issuer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"build:clean": "tsc --build --clean && tsc --build"
},
"dependencies": {
"@sphereon/oid4vci-common": "0.10.4-unstable.70",
"@sphereon/oid4vci-issuer": "0.10.4-unstable.70",
"@sphereon/oid4vci-common": "0.10.4-unstable.71",
"@sphereon/oid4vci-issuer": "0.10.4-unstable.71",
"@sphereon/ssi-sdk-ext.did-utils": "0.19.0",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion packages/siopv2-oid4vp-rp-rest-api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
},
{
"path": "../presentation-exchange"
},{
},
{
"path": "../pd-manager"
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/ssi-express-support/src/express-builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export class ExpressBuilder {
opts?.handlers && app.use(opts.handlers)
//fixme: this should come from the config
app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json({limit:'5mb'}))
app.use(bodyParser.json({ limit: '5mb' }))
return app
}
}
Expand Down
Loading

0 comments on commit cad41fc

Please sign in to comment.