Skip to content

Commit

Permalink
Merge pull request #215 from Sphereon-Opensource/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
nklomp authored Jun 19, 2024
2 parents 99bf4e6 + 9edb8e2 commit 242a719
Show file tree
Hide file tree
Showing 52 changed files with 6,317 additions and 5,438 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sphereon/sphereon-sdk.workspace",
"private": true,
"version": "0.20.0",
"version": "0.24.0",
"description": "Sphereon SSI SDK (Workspace)",
"repository": "[email protected]:Sphereon-Opensource/SSI-SDK.git",
"author": "Sphereon <[email protected]>",
Expand Down Expand Up @@ -111,9 +111,9 @@
"@veramo/url-handler": "4.2.0",
"@sphereon/ssi-types": "workspace:*",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/oid4vci-common": "0.10.4-next.25",
"@sphereon/oid4vci-client": "0.10.4-next.25",
"@sphereon/oid4vci-issuer": "0.10.4-next.25",
"@sphereon/oid4vci-common": "0.12.0",
"@sphereon/oid4vci-client": "0.12.0",
"@sphereon/oid4vci-issuer": "0.12.0",
"@noble/hashes": "1.2.0",
"did-jwt": "6.11.6",
"did-jwt-vc": "3.1.3",
Expand Down
1 change: 1 addition & 0 deletions packages/agent-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@types/url-parse": "^1.4.8",
"typescript": "5.4.2"
},
"peerDependencies": {},
"files": [
"dist/**/*",
"src/**/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/agent-config/src/objectCreator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { set, get } from 'jsonpointer'
import parse from 'url-parse'
import { resolve } from 'path'

/**
* Creates objects from a configuration object and a set of pointers.
Expand Down Expand Up @@ -94,6 +93,7 @@ export async function createObjects(config: object, pointers: Record<string, str
// console.log({module, member, type, query: parsed.query})

if (module.slice(0, 2) === './' || module.slice(0, 3) === '../') {
const { resolve } = await import('path')
module = resolve(module)
}

Expand Down
6 changes: 3 additions & 3 deletions packages/contact-manager-rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
},
"dependencies": {
"@sphereon/ssi-express-support": "workspace:*",
"@sphereon/ssi-sdk-ext.key-manager": "0.20.0",
"@sphereon/ssi-sdk-ext.key-utils": "0.20.0",
"@sphereon/ssi-sdk.agent-config": "workspace:*",
"@sphereon/ssi-sdk-ext.key-manager": "0.21.0",
"@sphereon/ssi-sdk-ext.key-utils": "0.21.0",
"@sphereon/ssi-sdk.contact-manager": "workspace:*",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-sdk.data-store": "workspace:*",
Expand All @@ -34,6 +33,7 @@
},
"devDependencies": {
"@decentralized-identity/ion-sdk": "^0.6.0",
"@sphereon/ssi-sdk.agent-config": "workspace:*",
"@types/body-parser": "^1.19.2",
"@types/cookie-parser": "^1.4.3",
"@types/cors": "^2.8.13",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class CreateContacts1690925872592 implements MigrationInterface {
)
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`)
await queryRunner.query(
`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('3875c12e-fdaa-4ef6-a340-c936e054b627', 'organization', 'INTERNAL' 'Sphereon_default_organization_type', 'sphereon_default_organization', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', now(), now())`,
`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('3875c12e-fdaa-4ef6-a340-c936e054b627', 'organization', 'INTERNAL', 'Sphereon_default_organization_type', 'sphereon_default_organization', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', now(), now())`,
)
await queryRunner.query(
`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('7d248798-41ca-4fc1-a130-9934b43d532e', 'naturalPerson', 'INTERNAL', 'Sphereon_default_natural_person_type', 'sphereon_default_natural_person', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', now(), now())`,
Expand Down
2 changes: 1 addition & 1 deletion packages/event-logger/__tests__/restAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IEventLogger } from '../src'

jest.setTimeout(60000)

const port = 3002
const port = 3006
const basePath = '/agent'

let serverAgent: IAgent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { TAgent } from '@veramo/core'
import { AuditLoggingEvent, PartyCorrelationType } from '@sphereon/ssi-sdk.core'
import { GetAuditEventsArgs, IEventLogger, NonPersistedAuditLoggingEvent } from '../../src'

jest.setTimeout(120000)
type ConfiguredAgent = TAgent<IEventLogger>

export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Promise<boolean>; tearDown: () => Promise<boolean> }): void => {
Expand Down
46 changes: 45 additions & 1 deletion packages/oid4vci-holder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,51 @@

---

TODO
## Usage

### OPENID_CREDENTIAL_OFFER SCHEMA

authorization_code

```typescript
agent.oid4vciHolderGetInitiationData({
requestData: {
uri: 'openid-credential-offer%3A%2F%2F%3Fcredential_offer%3D%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22authorization_code%22%3A%7B%22issuer_state%22%3A%22eyJhbGciOiJSU0Et...FYUaBy%22%7D%7D%7D',
},
})
```

pre-authorized_code

```typescript
agent.oid4vciHolderGetInitiationData({
requestData: {
uri: 'openid-credential-offer://?credential_offer%3D%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Apre-authorized_code%22%3A%7B%22pre-authorized_code%22%3A%22adhjhdjajkdkhjhdj%22%2C%22user_pin_required%22%3Atrue%7D%7D%7D',
},
})
```

### HTTPS SCHEMA

authorization_code:

```typescript
agent.oid4vciHolderGetInitiationData({
requestData: {
uri: 'https://issuer.research.identiproof.io?credential_offer%3D%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22authorization_code%22%3A%7B%22issuer_state%22%3A%22eyJhbGciOiJSU0Et...FYUaBy%22%7D%7D%7D',
},
})
```

pre-authorized_code:

```typescript
agent.oid4vciHolderGetInitiationData({
requestData: {
uri: 'https://issuer.research.identiproof.io?credential_offer%3D%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Apre-authorized_code%22%3A%7B%22pre-authorized_code%22%3A%22adhjhdjajkdkhjhdj%22%2C%22user_pin_required%22%3Atrue%7D%7D%7D',
},
})
```

## Installation

Expand Down
13 changes: 4 additions & 9 deletions packages/oid4vci-holder/__tests__/localAgent.test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import { DataSource } from 'typeorm'
import { createObjects, getConfig } from '../../agent-config/dist'
import oid4vciHolderAgentLogic from './shared/oid4vciHolderLogicAgentLogic'

jest.setTimeout(60000)

import eventLoggerAgentLogic from './shared/eventLoggerAgentLogic'

let dbConnection: Promise<DataSource>
let agent: any

const setup = async (): Promise<boolean> => {
const config = await getConfig('packages/event-logger/agent.yml')
const { localAgent, db } = await createObjects(config, { localAgent: '/agent', db: '/dbConnection' })
const config = await getConfig('packages/oid4vci-holder/agent.yml')
const { localAgent } = await createObjects(config, { localAgent: '/agent' })
agent = localAgent
dbConnection = db

return true
}

const tearDown = async (): Promise<boolean> => {
await (await dbConnection).close()
return true
}

Expand All @@ -30,5 +25,5 @@ const testContext = {
}

describe('Local integration tests', (): void => {
eventLoggerAgentLogic(testContext)
oid4vciHolderAgentLogic(testContext)
})
17 changes: 7 additions & 10 deletions packages/oid4vci-holder/__tests__/restAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import 'cross-fetch/polyfill'
// @ts-ignore
import express, { Router } from 'express'
import { Server } from 'http'
import { DataSource } from 'typeorm'
import { IAgent, createAgent, IAgentOptions } from '@veramo/core'
import { createAgent, IAgent, IAgentOptions } from '@veramo/core'
import { AgentRestClient } from '@veramo/remote-client'
import { AgentRouter, RequestWithAgentRouter } from '@veramo/remote-server'
import { createObjects, getConfig } from '../../agent-config/dist'
import eventLoggerAgentLogic from './shared/eventLoggerAgentLogic'
import oid4vciHolderAgentLogic from './shared/oid4vciHolderLogicAgentLogic'
import { IOID4VCIHolder } from '../src'
import { IMachineStatePersistence } from '@sphereon/ssi-sdk.xstate-machine-persistence'

jest.setTimeout(60000)

Expand All @@ -17,10 +17,9 @@ const basePath = '/agent'

let serverAgent: IAgent
let restServer: Server
let dbConnection: Promise<DataSource>

const getAgent = (options?: IAgentOptions) =>
createAgent<IOID4VCIHolder>({
createAgent<IOID4VCIHolder & IMachineStatePersistence>({
...options,
plugins: [
new AgentRestClient({
Expand All @@ -32,10 +31,9 @@ const getAgent = (options?: IAgentOptions) =>
})

const setup = async (): Promise<boolean> => {
const config = await getConfig('packages/event-logger/agent.yml')
const { agent, db } = await createObjects(config, { agent: '/agent', db: '/dbConnection' })
const config = await getConfig('packages/oid4vci-holder/agent.yml')
const { agent } = await createObjects(config, { agent: '/agent' })
serverAgent = agent
dbConnection = db

const agentRouter: Router = AgentRouter({
exposedMethods: serverAgent.availableMethods(),
Expand All @@ -56,7 +54,6 @@ const setup = async (): Promise<boolean> => {

const tearDown = async (): Promise<boolean> => {
restServer.close()
await (await dbConnection).close()
return true
}

Expand All @@ -67,5 +64,5 @@ const testContext = {
}

describe('REST integration tests', (): void => {
eventLoggerAgentLogic(testContext)
oid4vciHolderAgentLogic(testContext)
})
Loading

0 comments on commit 242a719

Please sign in to comment.