Skip to content

Commit

Permalink
Merge pull request #1114 from uport-project/next
Browse files Browse the repository at this point in the history
chore: new major release
  • Loading branch information
mirceanis authored Feb 9, 2023
2 parents 846c226 + 2db3149 commit 74ab19e
Show file tree
Hide file tree
Showing 316 changed files with 4,298 additions and 2,875 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Test PR
on: [pull_request, workflow_dispatch]
jobs:
build-test:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15.1
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 18
cache: 'pnpm'

- run: pnpm install
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/build-test-publish-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
GH_TOKEN: ${{secrets.GH_TOKEN}}
GH_USER: ${{secrets.GH_USER}}
GH_EMAIL: ${{secrets.GH_EMAIL}}
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15.1
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 18
cache: 'pnpm'

- run: pnpm install
Expand All @@ -54,6 +54,8 @@ jobs:
- name: run browser tests
run: pnpm test:browser

- run: pnpm run docs

- name: setup git coordinates
run: |
git remote set-url origin https://uport-project:[email protected]/uport-project/veramo.git
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-next-with-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'main'
jobs:
merge-branch:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: everlytic/[email protected]
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ key-store.json

.vscode/
node_modules
temp
temp/
tmp/

agent.yml
data
.vscode-upload.json

local-database*.json
local-database*.json
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ This monorepo uses [pnpm](https://pnpm.io/) and [lerna](https://lerna.js.org/)
Install dependencies

```bash
npm -g i pnpm
pnpm install
```

Expand Down
11 changes: 9 additions & 2 deletions __tests__/initial.migration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
*/

import {
createAgent,
IDataStore,
IDataStoreORM,
IDIDManager,
IKeyManager,
IResolver,
TAgent,
VerifiableCredential,
} from '../packages/core/src'
} from '../packages/core-types/src'
import { createAgent } from '../packages/core/src'
import { DIDResolverPlugin } from '../packages/did-resolver/src'
import { EthrDIDProvider } from '../packages/did-provider-ethr/src'
import { WebDIDProvider } from '../packages/did-provider-web/src'
Expand All @@ -40,6 +40,13 @@ import { getResolver as ethrDidResolver } from 'ethr-did-resolver'
import { getResolver as webDidResolver } from 'web-did-resolver'
import * as fs from 'fs'

import { jest } from '@jest/globals'
import { fileURLToPath } from 'url';
import { dirname } from 'path';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

jest.setTimeout(60000)

const infuraProjectId = '3586660d179141e3801c3895de1c2eba'
Expand Down
6 changes: 5 additions & 1 deletion __tests__/localAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import {
createAgent,
} from '../packages/core/src'
import {
IAgentOptions,
ICredentialPlugin,
IDataStore,
Expand All @@ -18,7 +20,7 @@ import {
IMessageHandler,
IResolver,
TAgent,
} from '../packages/core/src'
} from '../packages/core-types/src'
import { MessageHandler } from '../packages/message-handler/src'
import { KeyManager } from '../packages/key-manager/src'
import { AliasDiscoveryProvider, DIDManager } from '../packages/did-manager/src'
Expand Down Expand Up @@ -66,6 +68,8 @@ import { getResolver as ethrDidResolver } from 'ethr-did-resolver'
import { getResolver as webDidResolver } from 'web-did-resolver'
import { contexts as credential_contexts } from '@transmute/credentials-context'
import * as fs from 'fs'
import { jest } from '@jest/globals'

// Shared tests
import verifiableDataJWT from './shared/verifiableDataJWT'
import verifiableDataLD from './shared/verifiableDataLD'
Expand Down
5 changes: 4 additions & 1 deletion __tests__/localJsonStoreAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*
*/
import {
createAgent,
IAgentOptions,
ICredentialPlugin,
IDataStore,
Expand All @@ -16,6 +15,9 @@ import {
IMessageHandler,
IResolver,
TAgent,
} from '../packages/core-types/src'
import {
createAgent
} from '../packages/core/src'
import { MessageHandler } from '../packages/message-handler/src'
import { KeyManager } from '../packages/key-manager/src'
Expand Down Expand Up @@ -56,6 +58,7 @@ import { getResolver as ethrDidResolver } from 'ethr-did-resolver'
import { getResolver as webDidResolver } from 'web-did-resolver'
import { contexts as credential_contexts } from '@transmute/credentials-context'
import * as fs from 'fs'
import { jest } from '@jest/globals'

// Shared tests
import verifiableDataJWT from './shared/verifiableDataJWT'
Expand Down
6 changes: 5 additions & 1 deletion __tests__/localMemoryStoreAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*
*/
import {
createAgent,
IAgentOptions,
ICredentialPlugin,
IDataStore,
Expand All @@ -16,6 +15,9 @@ import {
IMessageHandler,
IResolver,
TAgent,
} from '../packages/core-types/src'
import {
createAgent
} from '../packages/core/src'
import { MessageHandler } from '../packages/message-handler/src'
import { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../packages/key-manager/src'
Expand Down Expand Up @@ -52,6 +54,8 @@ import { getResolver as ethrDidResolver } from 'ethr-did-resolver'
import { getResolver as webDidResolver } from 'web-did-resolver'
import { contexts as credential_contexts } from '@transmute/credentials-context'
import * as fs from 'fs'
import { jest } from '@jest/globals'

// Shared tests
import verifiableDataJWT from './shared/verifiableDataJWT'
import verifiableDataLD from './shared/verifiableDataLD'
Expand Down
9 changes: 6 additions & 3 deletions __tests__/restAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
* This suite also runs a messaging server to run through some examples of DIDComm using did:fake identifiers.
* See didWithFakeDidFlow() for more details.
*/
import 'cross-fetch/polyfill'
import {
Agent,
createAgent,
IAgent,
IAgentOptions,
IDataStore,
Expand All @@ -21,6 +18,10 @@ import {
IMessageHandler,
IResolver,
TAgent,
} from '../packages/core-types/src'
import {
Agent,
createAgent
} from '../packages/core/src'
import { MessageHandler } from '../packages/message-handler/src'
import { KeyManager } from '../packages/key-manager/src'
Expand Down Expand Up @@ -77,6 +78,8 @@ import express from 'express'
import { Server } from 'http'
import { contexts as credential_contexts } from '@transmute/credentials-context'
import * as fs from 'fs'
import { jest } from '@jest/globals'

// Shared tests
import verifiableDataJWT from './shared/verifiableDataJWT'
import verifiableDataLD from './shared/verifiableDataLD'
Expand Down
3 changes: 2 additions & 1 deletion __tests__/shared/credentialStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import {
IDIDManager,
IIdentifier,
TAgent,
} from '../../packages/core/src'
} from '../../packages/core-types/src'
import { CredentialStatusPlugin } from '../../packages/credential-status/src'
import { jest } from '@jest/globals'

type ConfiguredAgent = TAgent<IDIDManager & ICredentialPlugin & IDataStore & IDataStoreORM>

Expand Down
2 changes: 1 addition & 1 deletion __tests__/shared/dbInitOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
IMessageHandler,
IResolver,
TAgent,
} from '../../packages/core/src'
} from '../../packages/core-types/src'
import { IDIDComm, IPackedDIDCommMessage } from '../../packages/did-comm/src'
import { extractIssuer } from '../../packages/utils/src'

Expand Down
35 changes: 18 additions & 17 deletions __tests__/shared/didCommAndDataStoreWithCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ import {
IKeyManager,
IResolver,
TAgent,
} from '../../packages/core/src'
} from '../../packages/core-types/src'
import { IDIDComm, IPackedDIDCommMessage } from '../../packages/did-comm/src'
import { v4 } from "uuid"
import { VerifiableCredential } from '../../packages/core/src'
import { v4 } from 'uuid'
import { VerifiableCredential } from '../../packages/core-types/src'
import { jest } from '@jest/globals'

type ConfiguredAgent = TAgent<IDIDManager & IKeyManager & IResolver & IDIDComm>

const DIDCommEventSniffer: IEventListener = {
eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received'],
onEvent: jest.fn(),
onEvent: jest.fn(() => Promise.resolve()),
}

export default (testContext: {
Expand Down Expand Up @@ -129,18 +130,21 @@ export default (testContext: {
}

const packed = (vc: VerifiableCredential): Promise<IPackedDIDCommMessage> => {
return agent.packDIDCommMessage({ packing: 'none', message: {
id: v4(),
type: 'w3c.vc',
from: sender.did,
to: receiver.did,
body: vc
}})
return agent.packDIDCommMessage({
packing: 'none',
message: {
id: v4(),
type: 'w3c.vc',
from: sender.did,
to: receiver.did,
body: vc,
},
})
}

it('should save LDS credential found inside DIDCommMessage', async () => {
expect.assertions(2)
const creator = await agent.didManagerGetOrCreate({ alias: 'messageCreator1', provider: 'did:ethr'})
const creator = await agent.didManagerGetOrCreate({ alias: 'messageCreator1', provider: 'did:ethr' })

const numMessagesBefore = await agent.dataStoreORMGetMessagesCount({})
const numVCsBefore = await agent.dataStoreORMGetVerifiableCredentialsCount({})
Expand All @@ -161,8 +165,7 @@ export default (testContext: {

it('should save JWT credential found inside DIDCommMessage', async () => {
expect.assertions(2)
const creator = await agent.didManagerGetOrCreate({ alias: 'messageCreator1', provider: 'did:ethr'})

const creator = await agent.didManagerGetOrCreate({ alias: 'messageCreator1', provider: 'did:ethr' })
const numMessagesBefore = await agent.dataStoreORMGetMessagesCount({})
const numVCsBefore = await agent.dataStoreORMGetVerifiableCredentialsCount({})

Expand All @@ -180,11 +183,9 @@ export default (testContext: {
expect(vcs).toEqual(numVCsBefore + 1)
})


it('should save JWT credential found inside DIDCommMessage', async () => {
expect.assertions(2)
const creator = await agent.didManagerGetOrCreate({ alias: 'messageCreator1', provider: 'did:ethr'})

const creator = await agent.didManagerGetOrCreate({ alias: 'messageCreator1', provider: 'did:ethr' })
const numMessagesBefore = await agent.dataStoreORMGetMessagesCount({})
const numVCsBefore = await agent.dataStoreORMGetVerifiableCredentialsCount({})

Expand Down
2 changes: 1 addition & 1 deletion __tests__/shared/didCommPacking.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// noinspection ES6PreferShortImport

import { IDIDManager, IIdentifier, IKeyManager, IResolver, TAgent } from '../../packages/core/src'
import { IDIDManager, IIdentifier, IKeyManager, IResolver, TAgent } from '../../packages/core-types/src'
import { IDIDComm } from '../../packages/did-comm/src'

type ConfiguredAgent = TAgent<IDIDManager & IKeyManager & IResolver & IDIDComm>
Expand Down
13 changes: 7 additions & 6 deletions __tests__/shared/didCommWithEthrDidFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ import {
IMessageHandler,
IResolver,
TAgent,
} from '../../packages/core/src'
} from '../../packages/core-types/src'
import { IDIDComm } from '../../packages/did-comm/src'
import { MessagingRouter, RequestWithAgentRouter } from '../../packages/remote-server/src'
import * as u8a from 'uint8arrays'
// @ts-ignore
import express from 'express'
import { Server } from 'http'
import { jest } from '@jest/globals'
import { bytesToBase58, hexToBytes } from '../../packages/utils/src'

type ConfiguredAgent = TAgent<IDIDManager & IKeyManager & IResolver & IDIDComm & IMessageHandler>

const DIDCommEventSniffer: IEventListener = {
eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received'],
onEvent: jest.fn(),
onEvent: jest.fn(() => Promise.resolve()),
}

export default (testContext: {
Expand Down Expand Up @@ -585,9 +586,9 @@ export default (testContext: {
key: newKey,
})

expect(result.substr(0, 2)).toEqual('0x')
expect(result.substring(0, 2)).toEqual('0x')
const resolution = await agent.resolveDid({ didUrl: alice.did })
const expectedBase58Key = u8a.toString(u8a.fromString(newKey.publicKeyHex, 'base16'), 'base58btc')
const expectedBase58Key = bytesToBase58(hexToBytes(newKey.publicKeyHex))
expect(resolution?.didDocument?.verificationMethod?.[2].publicKeyBase58).toEqual(expectedBase58Key)
expect(resolution?.didDocument?.keyAgreement?.[0]).toEqual(
resolution?.didDocument?.verificationMethod?.[2].id,
Expand Down Expand Up @@ -692,7 +693,7 @@ export default (testContext: {

expect(result.substr(0, 2)).toEqual('0x')
const resolution = await agent.resolveDid({ didUrl: bob.did })
const expectedBase58Key = u8a.toString(u8a.fromString(newKey.publicKeyHex, 'base16'), 'base58btc')
const expectedBase58Key = bytesToBase58(hexToBytes(newKey.publicKeyHex))
expect(resolution?.didDocument?.verificationMethod?.[2].publicKeyBase58).toEqual(expectedBase58Key)
expect(resolution?.didDocument?.keyAgreement?.[0]).toEqual(
resolution?.didDocument?.verificationMethod?.[2].id,
Expand Down
5 changes: 3 additions & 2 deletions __tests__/shared/didCommWithFakeDidFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import {
IKeyManager,
IResolver,
TAgent,
} from '../../packages/core/src'
} from '../../packages/core-types/src'
import { IDIDComm } from '../../packages/did-comm/src'
import { jest } from '@jest/globals'

type ConfiguredAgent = TAgent<IDIDManager & IKeyManager & IResolver & IDIDComm>

const DIDCommEventSniffer: IEventListener = {
eventTypes: ['DIDCommV2Message-sent', 'DIDCommV2Message-received'],
onEvent: jest.fn(),
onEvent: jest.fn(() => Promise.resolve()),
}

export default (testContext: {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/shared/didDiscovery.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// noinspection ES6PreferShortImport

import { IDIDDiscovery } from '../../packages/did-discovery/src'
import { IAgentOptions, ICredentialIssuer, IDataStoreORM, IDIDManager, TAgent } from '../../packages/core/src'
import { IAgentOptions, ICredentialIssuer, IDataStoreORM, IDIDManager, TAgent } from '../../packages/core-types/src'

type ConfiguredAgent = TAgent<IDIDManager & IDIDDiscovery & IDataStoreORM & ICredentialIssuer>

Expand Down
Loading

0 comments on commit 74ab19e

Please sign in to comment.