Skip to content

Commit

Permalink
feat: Adapted the plugin to accept https urls, added tests and docume…
Browse files Browse the repository at this point in the history
…ntation about the changes
  • Loading branch information
zoemaas committed May 8, 2024
1 parent b3cc812 commit 73ab5ae
Show file tree
Hide file tree
Showing 10 changed files with 1,518 additions and 30 deletions.
48 changes: 47 additions & 1 deletion packages/oid4vci-holder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,53 @@

---

TODO
## Usage

### OPENID_INITIATE_ISSUANCE SCHEMA

pre-authorized_code

```typescript
agent.oid4vciHolderGetInitiationData({
requestData: {
uri: 'openid-initiate-issuance://?issuer=https%3A%2F%2Fissuer.research.identiproof.io&credential_type=OpenBadgeCredentialUrl&pre-authorized_code=4jLs9xZHEfqcoow0kHE7d1a8hUk6Sy-5bVSV2MqBUGUgiFFQi-ImL62T-FmLIo8hKA1UdMPH0lM1xAgcFkJfxIw9L-lI3mVs0hRT8YVwsEM1ma6N3wzuCdwtMU4bcwKp&user_pin_required=true'
}
})
```

### OPENID_CREDENTIAL_OFFER SCHEMA

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
6 changes: 3 additions & 3 deletions packages/oid4vci-holder/__tests__/localAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { createObjects, getConfig } from '../../agent-config/dist'

jest.setTimeout(60000)

import eventLoggerAgentLogic from './shared/eventLoggerAgentLogic'
import eventLoggerAgentLogic from './shared/oid4vciHolderLogicAgentLogic'

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, db } = await createObjects(config, { localAgent: '/agent' })
agent = localAgent
dbConnection = db

Expand Down
4 changes: 2 additions & 2 deletions packages/oid4vci-holder/__tests__/restAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IAgent, createAgent, 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 eventLoggerAgentLogic from './shared/oid4vciHolderLogicAgentLogic'
import { IOID4VCIHolder } from '../src'

jest.setTimeout(60000)
Expand All @@ -32,7 +32,7 @@ const getAgent = (options?: IAgentOptions) =>
})

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

0 comments on commit 73ab5ae

Please sign in to comment.