Skip to content

Commit

Permalink
feat(remote-client): allow dynamic headers param for AgentRestClient …
Browse files Browse the repository at this point in the history
…constructor (#1314)

fixes #1313
  • Loading branch information
cre8 committed Jan 16, 2024
1 parent 35d9920 commit 1b8a0a2
Show file tree
Hide file tree
Showing 135 changed files with 8,735 additions and 2,709 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-and-test-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
version: 8
- run: pnpm add -g pnpm
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
restore-keys: ${{ runner.os }}-build-${{ github.sha }}
fail-on-cache-miss: true
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
restore-keys: ${{ runner.os }}-build-${{ github.sha }}
fail-on-cache-miss: true
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
Expand All @@ -130,7 +130,7 @@ jobs:
restore-keys: ${{ runner.os }}-build-${{ github.sha }}
fail-on-cache-miss: true
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build-test-publish-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
version: 8
- run: pnpm add -g pnpm
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
restore-keys: ${{ runner.os }}-build-${{ github.sha }}
fail-on-cache-miss: true
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
restore-keys: ${{ runner.os }}-build-${{ github.sha }}
fail-on-cache-miss: true
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
Expand All @@ -139,7 +139,7 @@ jobs:
restore-keys: ${{ runner.os }}-build-${{ github.sha }}
fail-on-cache-miss: true
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
version: 8
- run: pnpm add -g pnpm
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
Expand Down
7 changes: 5 additions & 2 deletions AWESOME.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ Please help us improve the contents or format of this list by creating a pull re
## Projects

* [Sphereon SSI SDK](https://github.com/Sphereon-Opensource/ssi-sdk)
* [VC Manager plugin](https://github.com/blockchain-lab-um/veramo-vc-manager)
* [SSI using Metamask snap](https://blockchain-lab-um.github.io/ssi-snap-docs/)
* [Data Manager plugin](https://github.com/blockchain-lab-um/masca/tree/develop/packages/datamanager)
* [SSI using Metamask snap (Masca)](https://masca.io/)
* [SSI using Metamask snap (Identify)](https://github.com/tuum-tech/identify/tree/main/packages/snap)
* [OID4VC issuer and verifier](https://github.com/blockchain-lab-um/oid4vc-monorepo)
* [Plugin for did:cheqd](https://github.com/cheqd/did-provider-cheqd)
* [Spherity VC revocation plugin based on ethereum](https://github.com/spherity/ethr-revocation-registry-veramo-plugin)
* [BBS+ issuer](https://github.com/pcibraro/veramo-bls-issuer/tree/main)
* [RN app with credential signing](https://github.com/symfoni/identity-wallet)
* [ID Pocket digital identity wallet](https://rktechworks.com/idpocket)
* add your own project here!
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/cred3.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"name": "Verifiable Event Attendance",
"chainId": 1,
"version": "1",
"verifyingContract": "0x00000000000000000000000000000000000000000000"
"verifyingContract": "0x0000000000000000000000000000000000000000"
},
"primaryType": "VerifiableCredential"
},
Expand Down
22 changes: 13 additions & 9 deletions __tests__/localAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
* This suite also runs a ganache local blockchain to run through some examples of DIDComm using did:ethr identifiers.
*/

import {
createAgent,
} from '../packages/core/src'
import { createAgent } from '../packages/core/src'
import {
IAgentOptions,
ICredentialPlugin,
Expand Down Expand Up @@ -91,8 +89,9 @@ import didCommWithEthrDidFlow from './shared/didCommWithEthrDidFlow'
import utils from './shared/utils'
import web3 from './shared/web3'
import credentialStatus from './shared/credentialStatus'
import ethrDidFlowSigned from "./shared/ethrDidFlowSigned";
import ethrDidFlowSigned from './shared/ethrDidFlowSigned'
import didCommWithPeerDidFlow from './shared/didCommWithPeerDidFlow.js'
import credentialPluginTests from './shared/credentialPluginTests.js'

jest.setTimeout(120000)

Expand All @@ -117,8 +116,7 @@ let dbConnection: Promise<DataSource>
let databaseFile: string

const setup = async (options?: IAgentOptions): Promise<boolean> => {
databaseFile =
options?.context?.databaseFile || ':memory:'
databaseFile = options?.context?.databaseFile || ':memory:'
dbConnection = new DataSource({
name: options?.context?.['dbName'] || 'test',
type: 'sqlite',
Expand Down Expand Up @@ -181,6 +179,11 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
chainId: 5,
rpcUrl: 'https://goerli.infura.io/v3/' + infuraProjectId,
},
{
name: 'sepolia',
chainId: 11155111,
rpcUrl: 'https://sepolia.infura.io/v3/' + infuraProjectId,
},
{
chainId: 421613,
name: 'arbitrum:goerli',
Expand All @@ -202,7 +205,7 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
defaultKms: 'local',
}),
'did:peer': new PeerDIDProvider({
defaultKms: 'local'
defaultKms: 'local',
}),
'did:pkh': new PkhDIDProvider({
defaultKms: 'local',
Expand All @@ -220,7 +223,7 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
{
name: 'ganache',
chainId: 1337,
provider,
provider: provider as any,
registry,
},
],
Expand All @@ -242,7 +245,7 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
new SdrMessageHandler(),
],
}),
new DIDComm([new DIDCommHttpTransport()]),
new DIDComm({ transports: [new DIDCommHttpTransport()]}),
new CredentialPlugin(),
new CredentialIssuerEIP712(),
new CredentialIssuerLD({
Expand Down Expand Up @@ -303,4 +306,5 @@ describe('Local integration tests', () => {
didCommWithPeerDidFlow(testContext)
credentialStatus(testContext)
ethrDidFlowSigned(testContext)
credentialPluginTests(testContext)
})
16 changes: 13 additions & 3 deletions __tests__/localJsonStoreAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import {
IResolver,
TAgent,
} from '../packages/core-types/src'
import {
createAgent
} from '../packages/core/src'
import { createAgent } from '../packages/core/src'
import { MessageHandler } from '../packages/message-handler/src'
import { KeyManager } from '../packages/key-manager/src'
import { DIDManager } from '../packages/did-manager/src'
Expand Down Expand Up @@ -53,6 +51,7 @@ import {
PrivateKeyStoreJson,
} from '../packages/data-store-json/src'
import { FakeDidProvider, FakeDidResolver } from '../packages/test-utils/src'
import { PeerDIDProvider, getResolver as getDidPeerResolver } from '../packages/did-provider-peer/src'

import { Resolver } from 'did-resolver'
import { getResolver as ethrDidResolver } from 'ethr-did-resolver'
Expand All @@ -77,6 +76,7 @@ import messageHandler from './shared/messageHandler'
import utils from './shared/utils'
import { JsonFileStore } from './utils/json-file-store'
import credentialStatus from './shared/credentialStatus'
import credentialPluginTests from './shared/credentialPluginTests'
import dbInitOptions from "./shared/dbInitOptions";

jest.setTimeout(120000)
Expand Down Expand Up @@ -149,6 +149,11 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
name: 'goerli',
rpcUrl: 'https://goerli.infura.io/v3/' + infuraProjectId,
},
{
name: 'sepolia',
chainId: 11155111,
rpcUrl: 'https://sepolia.infura.io/v3/' + infuraProjectId,
},
{
chainId: 421613,
name: 'arbitrum:goerli',
Expand All @@ -163,6 +168,9 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
'did:key': new KeyDIDProvider({
defaultKms: 'local',
}),
'did:peer': new PeerDIDProvider({
defaultKms: 'local',
}),
'did:pkh': new PkhDIDProvider({
defaultKms: 'local',
}),
Expand All @@ -177,6 +185,7 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
...ethrDidResolver({ infuraProjectId }),
...webDidResolver(),
...getDidKeyResolver(),
...getDidPeerResolver(),
...getDidPkhResolver(),
...getDidJwkResolver(),
...new FakeDidResolver(() => agent).getDidFakeResolver(),
Expand Down Expand Up @@ -239,5 +248,6 @@ describe('Local json-data-store integration tests', () => {
didCommPacking(testContext)
utils(testContext)
credentialStatus(testContext)
credentialPluginTests(testContext)
dbInitOptions(testContext)
})
12 changes: 12 additions & 0 deletions __tests__/localMemoryStoreAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import { KeyManagementSystem } from '../packages/kms-local/src'
import { Web3KeyManagementSystem } from '../packages/kms-web3/src'
import { DataStore, DataStoreORM, Entities, migrations } from '../packages/data-store/src'
import { FakeDidProvider, FakeDidResolver } from '../packages/test-utils/src'
import { PeerDIDProvider, getResolver as getDidPeerResolver } from "../packages/did-provider-peer/src";

import { getResolver as ethrDidResolver } from 'ethr-did-resolver'
import { getResolver as webDidResolver } from 'web-did-resolver'
Expand All @@ -71,6 +72,7 @@ import messageHandler from './shared/messageHandler.js'
import utils from './shared/utils.js'
import credentialStatus from './shared/credentialStatus.js'
import credentialInterop from './shared/credentialInterop.js'
import credentialPluginTests from "./shared/credentialPluginTests.js";

jest.setTimeout(120000)

Expand Down Expand Up @@ -145,6 +147,11 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
name: 'goerli',
rpcUrl: 'https://goerli.infura.io/v3/' + infuraProjectId,
},
{
name: 'sepolia',
chainId: 11155111,
rpcUrl: 'https://sepolia.infura.io/v3/' + infuraProjectId,
},
{
chainId: 421613,
name: 'arbitrum:goerli',
Expand All @@ -159,6 +166,9 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
'did:key': new KeyDIDProvider({
defaultKms: 'local',
}),
'did:peer': new PeerDIDProvider({
defaultKms: 'local'
}),
'did:pkh': new PkhDIDProvider({
defaultKms: 'local',
}),
Expand All @@ -172,6 +182,7 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
...ethrDidResolver({ infuraProjectId }),
...webDidResolver(),
...getDidKeyResolver(),
...getDidPeerResolver(),
...getDidPkhResolver(),
...getDidJwkResolver(),
...new FakeDidResolver(() => agent).getDidFakeResolver(),
Expand Down Expand Up @@ -234,4 +245,5 @@ describe('Local in-memory integration tests', () => {
utils(testContext)
credentialStatus(testContext)
credentialInterop(testContext)
credentialPluginTests(testContext)
})
14 changes: 13 additions & 1 deletion __tests__/restAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { WebDIDProvider } from '../packages/did-provider-web/src'
import { getDidKeyResolver, KeyDIDProvider } from '../packages/did-provider-key/src'
import { getDidPkhResolver, PkhDIDProvider } from '../packages/did-provider-pkh/src'
import { getDidJwkResolver, JwkDIDProvider } from '../packages/did-provider-jwk/src'
import { getResolver as getDidPeerResolver, PeerDIDProvider } from "../packages/did-provider-peer/src";
import { DIDComm, DIDCommHttpTransport, DIDCommMessageHandler, IDIDComm } from '../packages/did-comm/src'
import {
ISelectiveDisclosure,
Expand Down Expand Up @@ -98,6 +99,7 @@ import messageHandler from './shared/messageHandler'
import didDiscovery from './shared/didDiscovery'
import utils from './shared/utils'
import credentialStatus from './shared/credentialStatus'
import credentialPluginTests from "./shared/credentialPluginTests";

jest.setTimeout(120000)

Expand Down Expand Up @@ -175,6 +177,11 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
name: 'goerli',
rpcUrl: 'https://goerli.infura.io/v3/' + infuraProjectId,
},
{
name: 'sepolia',
chainId: 11155111,
rpcUrl: 'https://sepolia.infura.io/v3/' + infuraProjectId,
},
{
chainId: 421613,
name: 'arbitrum:goerli',
Expand All @@ -189,6 +196,9 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
'did:key': new KeyDIDProvider({
defaultKms: 'local',
}),
'did:peer': new PeerDIDProvider({
defaultKms: 'local'
}),
'did:pkh': new PkhDIDProvider({
defaultKms: 'local',
}),
Expand All @@ -204,6 +214,7 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
...webDidResolver(),
// key: getUniversalResolver(), // resolve using remote resolver... when uniresolver becomes more stable,
...getDidKeyResolver(),
...getDidPeerResolver(),
...getDidPkhResolver(),
...getDidJwkResolver(),
...new FakeDidResolver(() => serverAgent as TAgent<IDIDManager>).getDidFakeResolver(),
Expand All @@ -219,7 +230,7 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
new SdrMessageHandler(),
],
}),
new DIDComm([new DIDCommHttpTransport()]),
new DIDComm({ transports: [new DIDCommHttpTransport()]}),
// intentionally use the deprecated name to test compatibility
new CredentialIssuer(),
new CredentialIssuerEIP712(),
Expand Down Expand Up @@ -298,4 +309,5 @@ describe('REST integration tests', () => {
didDiscovery(testContext)
utils(testContext)
credentialStatus(testContext)
credentialPluginTests(testContext)
})
Loading

0 comments on commit 1b8a0a2

Please sign in to comment.