Skip to content

Commit

Permalink
Merge pull request #223 from Sphereon-Opensource/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
nklomp authored Jul 7, 2024
2 parents d9b111c + 18515e1 commit 67a5055
Show file tree
Hide file tree
Showing 129 changed files with 13,909 additions and 4,524 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ test/*.js
**/.env.local
/packages/web3-provider-headless/__tests__/config.json
/packages/event-logger/plugin.schema.json
/packages/public-key-hosting/__tests__/database/test.sqlite
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
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.12.0",
"@sphereon/oid4vci-client": "0.12.0",
"@sphereon/oid4vci-issuer": "0.12.0",
"@sphereon/oid4vci-common": "0.14.0",
"@sphereon/oid4vci-client": "0.14.0",
"@sphereon/oid4vci-issuer": "0.14.0",
"@noble/hashes": "1.2.0",
"did-jwt": "6.11.6",
"did-jwt-vc": "3.1.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/agent-config/src/agentCreator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TAgent, IPluginMethodMap, IAgentOptions } from '@veramo/core'
import { createObjects } from './objectCreator.js'
import { createObjects } from './objectCreator'
import yaml from 'yaml'

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/contact-manager-rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"dependencies": {
"@sphereon/ssi-express-support": "workspace:*",
"@sphereon/ssi-sdk-ext.key-manager": "0.21.0",
"@sphereon/ssi-sdk-ext.key-utils": "0.21.0",
"@sphereon/ssi-sdk-ext.key-manager": "0.22.0",
"@sphereon/ssi-sdk-ext.key-utils": "0.22.0",
"@sphereon/ssi-sdk.contact-manager": "workspace:*",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-sdk.data-store": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/contact-manager/__tests__/restAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import contactManagerAgentLogic from './shared/contactManagerAgentLogic'

jest.setTimeout(60000)

const port = 4002
const port = 4202
const basePath = '/agent'

let serverAgent: IAgent
Expand Down
1 change: 1 addition & 0 deletions packages/data-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@sphereon/pex": "^3.3.3",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-types": "workspace:*",
"@sphereon/ssi-sdk-ext.did-utils": "0.22.0",
"@veramo/core": "4.2.0",
"@veramo/utils": "4.2.0",
"blakejs": "^1.1.1",
Expand Down
67 changes: 39 additions & 28 deletions packages/data-store/src/__tests__/contact.entities.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getDID } from '@sphereon/ssi-sdk-ext.did-utils'
import { DataSource, FindOptionsWhere } from 'typeorm'
import {
contactMetadataItemEntityFrom,
Expand Down Expand Up @@ -621,11 +622,13 @@ describe('Database entities tests', (): void => {
connection: {
type: ConnectionType.SIOPv2,
config: {
identifier: {
did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01',
provider: 'test_provider',
keys: [],
services: [],
idOpts: {
identifier: {
did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01',
provider: 'test_provider',
keys: [],
services: [],
},
},
redirectUrl: 'https://example.com',
stateId: 'e91f3510-5ce9-42ee-83b7-fa68ff323d27',
Expand Down Expand Up @@ -654,7 +657,7 @@ describe('Database entities tests', (): void => {
expect(fromDb?.connection?.type).toEqual(identity.connection?.type)
expect(fromDb?.connection?.config).toBeDefined()
expect((<DidAuthConfigEntity>fromDb?.connection?.config).identifier).toEqual(
(<NonPersistedDidAuthConfig>identity.connection?.config).identifier.did,
getDID((<NonPersistedDidAuthConfig>identity.connection?.config).idOpts),
)
})

Expand Down Expand Up @@ -696,11 +699,13 @@ describe('Database entities tests', (): void => {
const connection: NonPersistedConnection = {
type: ConnectionType.SIOPv2,
config: {
identifier: {
did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01',
provider: 'test_provider',
keys: [],
services: [],
idOpts: {
identifier: {
did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01',
provider: 'test_provider',
keys: [],
services: [],
},
},
redirectUrl: 'https://example.com',
stateId: 'e91f3510-5ce9-42ee-83b7-fa68ff323d27',
Expand All @@ -725,7 +730,7 @@ describe('Database entities tests', (): void => {
expect(fromDbConfig).toBeDefined()
expect(fromDb?.type).toEqual(connection.type)
expect(fromDb?.config).toBeDefined()
expect((<DidAuthConfigEntity>fromDb?.config).identifier).toEqual((<NonPersistedDidAuthConfig>connection.config).identifier.did)
expect((<DidAuthConfigEntity>fromDb?.config).identifier).toEqual(getDID((<NonPersistedDidAuthConfig>connection?.config).idOpts))
})

it('Should save openid config to database', async (): Promise<void> => {
Expand Down Expand Up @@ -756,11 +761,13 @@ describe('Database entities tests', (): void => {
it('Should save didauth config to database', async (): Promise<void> => {
const sessionId = 'https://example.com/did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01'
const config: NonPersistedDidAuthConfig = {
identifier: {
did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01',
provider: 'test_provider',
keys: [],
services: [],
idOpts: {
identifier: {
did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01',
provider: 'test_provider',
keys: [],
services: [],
},
},
redirectUrl: 'https://example.com',
stateId: 'e91f3510-5ce9-42ee-83b7-fa68ff323d27',
Expand All @@ -777,7 +784,7 @@ describe('Database entities tests', (): void => {
})

expect(fromDb).toBeDefined()
expect((<DidAuthConfigEntity>fromDb).identifier).toEqual(config.identifier.did)
expect((<DidAuthConfigEntity>fromDb).identifier).toEqual(getDID((<NonPersistedDidAuthConfig>config).idOpts))
})

it('Should delete party and all child relations', async (): Promise<void> => {
Expand Down Expand Up @@ -996,11 +1003,13 @@ describe('Database entities tests', (): void => {
connection: {
type: ConnectionType.SIOPv2,
config: {
identifier: {
did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01',
provider: 'test_provider',
keys: [],
services: [],
idOpts: {
identifier: {
did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01',
provider: 'test_provider',
keys: [],
services: [],
},
},
redirectUrl: 'https://example.com',
stateId: 'e91f3510-5ce9-42ee-83b7-fa68ff323d27',
Expand Down Expand Up @@ -1098,11 +1107,13 @@ describe('Database entities tests', (): void => {
connection: {
type: ConnectionType.SIOPv2,
config: {
identifier: {
did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01',
provider: 'test_provider',
keys: [],
services: [],
idOpts: {
identifier: {
did: 'did:test:138d7bf8-c930-4c6e-b928-97d3a4928b01',
provider: 'test_provider',
keys: [],
services: [],
},
},
redirectUrl: 'https://example.com',
stateId: 'e91f3510-5ce9-42ee-83b7-fa68ff323d27',
Expand Down
15 changes: 14 additions & 1 deletion packages/data-store/src/types/contact/contact.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { IIdentifierOpts } from '@sphereon/ssi-sdk-ext.did-utils'
import { IIdentifier } from '@veramo/core'
import { ILocaleBranding } from '../issuanceBranding/issuanceBranding'

export type MetadataTypes = string | number | Date | boolean | undefined

Expand All @@ -13,6 +15,17 @@ export type Party = {
physicalAddresses: Array<PhysicalAddress>
contact: Contact
partyType: PartyType
/**
* TODO: Integrate branding logic here in the future.
*
* Currently, we are only defining the branding type within the SDK without implementing the associated logic. This is because:
* 1. We are combining two types from the SSI-SDK to create a new type that will be used across multiple places in the wallets (web & mobile).
* 2. While it makes sense to have this combined type in the SDK, the logic to support database connections for these types is complex. The types belong to different modules, and we don't use them together currently.
* 3. Implementing the full logic now would require significant changes and cross-module interactions, which we don't have the time to address at present.
*
* For now, we are defining the type here and will use it in the mobile wallet has the logic for it. This is a temporary solution until we have the resources to integrate the branding logic fully.
*/
branding?: ILocaleBranding
relationships: Array<PartyRelationship>
createdAt: Date
lastUpdatedAt: Date
Expand Down Expand Up @@ -126,7 +139,7 @@ export type PartialOpenIdConfig = Partial<OpenIdConfig>

export type DidAuthConfig = {
id: string
identifier: IIdentifier
idOpts: IIdentifierOpts
stateId: string
ownerId?: string
tenantId?: string
Expand Down
6 changes: 3 additions & 3 deletions packages/data-store/src/utils/contact/MappingUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export const correlationIdentifierFrom = (identifier: CorrelationIdentifierEntit

export const didAuthConfigEntityFrom = (config: NonPersistedDidAuthConfig): DidAuthConfigEntity => {
const didAuthConfig: DidAuthConfigEntity = new DidAuthConfigEntity()
didAuthConfig.identifier = config.identifier.did
didAuthConfig.identifier = typeof config.idOpts.identifier === 'string' ? config.idOpts.identifier : config.idOpts.identifier.did
didAuthConfig.redirectUrl = config.redirectUrl
didAuthConfig.sessionId = config.sessionId
didAuthConfig.ownerId = config.ownerId
Expand Down Expand Up @@ -479,7 +479,7 @@ export const openIdConfigFrom = (config: OpenIdConfigEntity): OpenIdConfig => {
export const didAuthConfigFrom = (config: DidAuthConfigEntity): DidAuthConfig => {
return {
id: config.id,
identifier: { did: config.identifier, provider: '', keys: [], services: [] },
idOpts: { identifier: config.identifier },
stateId: '', // FIXME
redirectUrl: config.redirectUrl,
sessionId: config.sessionId,
Expand All @@ -492,4 +492,4 @@ export const isOpenIdConfig = (config: NonPersistedConnectionConfig | BaseConfig
'clientSecret' in config && 'issuer' in config && 'redirectUrl' in config

export const isDidAuthConfig = (config: NonPersistedConnectionConfig | BaseConfigEntity): config is DidAuthConfig | DidAuthConfigEntity =>
'identifier' in config && 'redirectUrl' in config && 'sessionId' in config
('identifier' in config || ('idOpts' in config && 'identifier' in config.idOpts)) && 'redirectUrl' in config && 'sessionId' in config
Loading

0 comments on commit 67a5055

Please sign in to comment.