Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: new minor release #1227

Merged
merged 25 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3adbfa1
chore(ci): merge main into next
uport-automation-bot Aug 4, 2023
72e2ee3
chore(ci): merge main into next
uport-automation-bot Aug 4, 2023
d046e49
test: diversify default DID providers in tests to increase coverage (…
mirceanis Aug 4, 2023
ecdb2a2
test: remove some references to goerli network in tests to partially …
mirceanis Aug 4, 2023
75e66d9
fix(deps): Update dependency did-jwt-vc to v3.2.5
renovate[bot] Aug 5, 2023
c60252c
fix(deps): update dependency @metamask/eth-sig-util to v6
renovate[bot] Aug 7, 2023
1c14d34
fix(deps): update dependency cross-fetch to v4
renovate[bot] Aug 9, 2023
5765eb3
chore(deps): update devdeps
renovate[bot] Aug 9, 2023
423c0ae
fix(deps): Update dependency credential-status to v2.0.6
renovate[bot] Aug 11, 2023
7e070cc
fix(deps): update dependency swagger-ui-express to v5
renovate[bot] Aug 12, 2023
75048ce
chore(deps): update dependency puppeteer to v21
renovate[bot] Aug 12, 2023
ba8f6f5
fix(did-provider-key): use compressed keys for creating Secp256k1 did…
mirceanis Aug 15, 2023
3406a04
feat(selective-disclosure): support multiple key types for generating…
mirceanis Aug 4, 2023
57b6c58
feat(core-types): export a basic mapping between key types and algori…
mirceanis Aug 15, 2023
2851004
chore(deps): update all non-major dependencies
renovate[bot] Aug 15, 2023
384f7f5
chore(deps): update devdeps
renovate[bot] Aug 15, 2023
cafdc2a
chore(deps): update dependency puppeteer to v21.1.0
renovate[bot] Aug 21, 2023
518cc5a
fix(deps): Update did-vc-libraries
renovate[bot] Aug 24, 2023
9cb410b
chore(deps): update devdeps
renovate[bot] Aug 28, 2023
d72a3bc
chore(deps): update dependency lerna to v7.2.0
renovate[bot] Sep 4, 2023
cb5f9d7
fix(deps): Update did-vc-libraries
renovate[bot] Sep 5, 2023
e8c270f
chore(deps): update actions/checkout action to v4
renovate[bot] Sep 11, 2023
28c1224
fix(data-store): order skip take in orm and json (#1243)
simonas-notcat Sep 15, 2023
e2efa88
chore(deps): update devdeps
renovate[bot] Sep 16, 2023
ce9cca9
chore(deps): update devdeps
renovate[bot] Sep 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build-and-test-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:
shard: [1, 2, 3, 4, 5]
services:
postgres:
image: postgres:15.1
image: postgres:15.4
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: test123
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
runs-on: ubuntu-latest
needs: [test-integration]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-test-publish-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
shard: [1, 2, 3, 4, 5]
services:
postgres:
image: postgres:15.1
image: postgres:15.4
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: test123
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
runs-on: ubuntu-latest
needs: [test-integration]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
GH_EMAIL: ${{secrets.GH_EMAIL}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{secrets.GH_TOKEN}}
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 @@ -8,7 +8,7 @@ jobs:
merge-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: everlytic/[email protected]
with:
github_token: ${{ secrets.GH_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion __tests__/initial.migration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('database initial migration tests', () => {
}),
new DIDManager({
store: new DIDStore(dbConnection),
defaultProvider: 'did:ethr:goerli',
defaultProvider: 'did:key',
providers: {
// intentionally using deprecated config for backward compatibility checks
'did:ethr:goerli': new EthrDIDProvider({
Expand Down
2 changes: 1 addition & 1 deletion __tests__/localAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
}),
new DIDManager({
store: new DIDStore(dbConnection),
defaultProvider: 'did:ethr:goerli',
defaultProvider: 'did:ethr:ganache',
providers: {
'did:ethr': new EthrDIDProvider({
defaultKms: 'local',
Expand Down
2 changes: 1 addition & 1 deletion __tests__/localJsonStoreAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
}),
new DIDManager({
store: new DIDStoreJson(jsonFileStore),
defaultProvider: 'did:ethr:goerli',
defaultProvider: 'did:ethr',
providers: {
'did:ethr': new EthrDIDProvider({
defaultKms: 'local',
Expand Down
2 changes: 1 addition & 1 deletion __tests__/localMemoryStoreAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
}),
new DIDManager({
store: new MemoryDIDStore(),
defaultProvider: 'did:ethr:goerli',
defaultProvider: 'did:key',
providers: {
'did:ethr': new EthrDIDProvider({
defaultKms: 'local',
Expand Down
2 changes: 1 addition & 1 deletion __tests__/restAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ const setup = async (options?: IAgentOptions): Promise<boolean> => {
}),
new DIDManager({
store: new DIDStore(dbConnection),
defaultProvider: 'did:ethr:goerli',
defaultProvider: 'did:jwk',
providers: {
'did:ethr': new EthrDIDProvider({
defaultKms: 'local',
Expand Down
15 changes: 9 additions & 6 deletions __tests__/shared/credentialStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import { jest } from '@jest/globals'
type ConfiguredAgent = TAgent<IDIDManager & ICredentialPlugin & IDataStore & IDataStoreORM>

// Constant used to simulate exception flows
const simulateStatusVerificationFailure = 'Any unexpected failure during status verification.'
const simulateStatusVerificationFailure = 'Any_unexpected_failure_during_status_verification.'

// Constant used to simulate revoked credentials
const simulateRevokedCredential = 'A revoked credential.'
const simulateRevokedCredential = 'A_revoked_credential.'

// Constant used to simulate revoked credentials
const simulateNotRevokedCredential = 'A NOT revoked credential.'
const simulateNotRevokedCredential = 'A_NOT_revoked_credential.'

const callsCounter = jest.fn()

Expand Down Expand Up @@ -69,7 +69,11 @@ export default (testContext: {
],
})
agent = testContext.getAgent()
identifier = await agent.didManagerCreate({ kms: 'local' })
identifier = await agent.didManagerCreate({
kms: 'local',
provider: 'did:pkh',
options: { keyType: 'Secp256k1' },
})

rawCredential = buildCredential(identifier, {
type: 'ExoticStatusMethod2022',
Expand Down Expand Up @@ -208,7 +212,7 @@ export default (testContext: {
plugins: [],
})
agent = testContext.getAgent()
identifier = await agent.didManagerCreate({ kms: 'local' })
identifier = await agent.didManagerCreate({ kms: 'local', provider: 'did:jwk' })

rawCredential = {
issuer: { id: identifier.did },
Expand All @@ -234,7 +238,6 @@ export default (testContext: {
})
expect(vc).toHaveProperty('proof.jwt')

// TODO It`s an exception flow an it'd be better to throw an exception instead of returning false
await expect(agent.verifyCredential({ credential: vc })).rejects.toThrow(
`invalid_setup: The credential status can't be verified because there is no ICredentialStatusVerifier plugin installed.`,
)
Expand Down
7 changes: 0 additions & 7 deletions __tests__/shared/didManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,6 @@ export default (testContext: {
})

expect(identifier6).toEqual(identifier5)

const identifier7 = await agent.didManagerGetByAlias({
alias: 'alice',
// default provider is 'did:ethr:goerli'
})

expect(identifier7).toEqual(identifier4)
})

it('should get identifiers', async () => {
Expand Down
22 changes: 11 additions & 11 deletions __tests__/shared/documentationExamples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,41 +39,41 @@ export default (testContext: {
//DO NOT EDIT MANUALLY START

it('core-types-IResolver-getDIDComponentById example', async () => {
const did = 'did:ethr:goerli:0xb09b66026ba5909a7cfe99b76875431d2b8d5190'
const did = 'did:ethr:0xb09b66026ba5909a7cfe99b76875431d2b8d5190'
const didFragment = `${did}#controller`
const fragment = await agent.getDIDComponentById({
didDocument: (await agent.resolveDid({ didUrl: did }))?.didDocument,
didUrl: didFragment,
section: 'authentication',
})
expect(fragment).toEqual({
id: 'did:ethr:goerli:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',
id: 'did:ethr:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: 'did:ethr:goerli:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
blockchainAccountId: 'eip155:5:0xb09B66026bA5909A7CFE99b76875431D2b8D5190',
controller: 'did:ethr:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
blockchainAccountId: 'eip155:1:0xb09B66026bA5909A7CFE99b76875431D2b8D5190',
})
})

it('core-types-IResolver-resolveDid example', async () => {
const doc = await agent.resolveDid({
didUrl: 'did:ethr:goerli:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
didUrl: 'did:ethr:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
})
expect(doc.didDocument).toEqual({
'@context': [
'https://www.w3.org/ns/did/v1',
'https://w3id.org/security/suites/secp256k1recovery-2020/v2',
],
id: 'did:ethr:goerli:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
id: 'did:ethr:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
verificationMethod: [
{
id: 'did:ethr:goerli:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',
id: 'did:ethr:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: 'did:ethr:goerli:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
blockchainAccountId: 'eip155:5:0xb09B66026bA5909A7CFE99b76875431D2b8D5190',
controller: 'did:ethr:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
blockchainAccountId: 'eip155:1:0xb09B66026bA5909A7CFE99b76875431D2b8D5190',
},
],
authentication: ['did:ethr:goerli:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller'],
assertionMethod: ['did:ethr:goerli:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller'],
authentication: ['did:ethr:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller'],
assertionMethod: ['did:ethr:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller'],
})
})

Expand Down
81 changes: 80 additions & 1 deletion __tests__/shared/handleSdrMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default (testContext: {
afterAll(testContext.tearDown)

it('should create identifier', async () => {
identifier = await agent.didManagerCreate({ kms: 'local' })
identifier = await agent.didManagerCreate({ kms: 'local', provider: 'did:key' })
expect(identifier).toHaveProperty('did')
})

Expand Down Expand Up @@ -82,6 +82,85 @@ export default (testContext: {
expect(message.raw).toEqual(JWT)
})

it('should create and handle an SDR message with Ed25519', async () => {
const sdrIssuer = await agent.didManagerCreate({ provider: 'did:key', options: { keyType: 'Ed25519' } })
const req = await agent.createSelectiveDisclosureRequest({
data: {
issuer: sdrIssuer.did,
tag: 'sdr-one',
claims: [
{
reason: 'We need it',
claimType: 'name',
essential: true,
},
],
},
})

const message = await agent.handleMessage({
raw: req,
save: false,
})

expect(message.raw).toEqual(req)
})

it('should create and handle an SDR message with Secp256k1', async () => {
const sdrIssuer = await agent.didManagerCreate({
provider: 'did:ethr',
})
const req = await agent.createSelectiveDisclosureRequest({
data: {
issuer: sdrIssuer.did,
tag: 'sdr-one',
claims: [
{
reason: 'We need it',
claimType: 'name',
essential: true,
},
],
},
})

const message = await agent.handleMessage({
raw: req,
save: false,
})

expect(message.raw).toEqual(req)
})

it('should create and handle an SDR message with Secp256r1', async () => {
const sdrIssuer = await agent.didManagerCreate({
provider: 'did:jwk',
options: {
keyType: 'Secp256r1',
}
})
const req = await agent.createSelectiveDisclosureRequest({
data: {
issuer: sdrIssuer.did,
tag: 'sdr-one',
claims: [
{
reason: 'We need it',
claimType: 'name',
essential: true,
},
],
},
})

const message = await agent.handleMessage({
raw: req,
save: false,
})

expect(message.raw).toEqual(req)
})

it('should be able to find the request message', async () => {
const messages = await agent.dataStoreORMGetMessages()

Expand Down
16 changes: 13 additions & 3 deletions __tests__/shared/keyManager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
// noinspection ES6PreferShortImport

import { IAgentOptions, IDIDManager, IKeyManager, IResolver, TAgent, TKeyType } from '../../packages/core-types/src'
import {
IAgentOptions,
IDIDManager,
IKeyManager,
IResolver,
TAgent,
TKeyType,
} from '../../packages/core-types/src'
import { computeAddress, serialize } from '@ethersproject/transactions'
import { mapIdentifierKeysToDoc } from '../../packages/utils/src'
import { recoverTypedSignature, SignTypedDataVersion } from '@metamask/eth-sig-util'
Expand Down Expand Up @@ -476,7 +483,7 @@ export default (testContext: {
},
}

const identifier = await agent.didManagerCreate({ kms: 'local' })
const identifier = await agent.didManagerCreate({ kms: 'local', provider: 'did:pkh' })

const extendedKeys = await mapIdentifierKeysToDoc(identifier, 'verificationMethod', { agent })
const extendedKey = extendedKeys[0]
Expand Down Expand Up @@ -575,7 +582,10 @@ export default (testContext: {
},
}

const identifier = await agent.didManagerCreate({ kms: 'local' })
const identifier = await agent.didManagerCreate({
kms: 'local',
provider: 'did:pkh',
})

const extendedKeys = await mapIdentifierKeysToDoc(identifier, 'verificationMethod', { agent })
const extendedKey = extendedKeys[0]
Expand Down
2 changes: 1 addition & 1 deletion __tests__/shared/resolveDid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default (testContext: {
afterAll(testContext.tearDown)

it('should resolve didUrl', async () => {
const didUrl = 'did:ethr:goerli:0xb09b66026ba5909a7cfe99b76875431d2b8d5190'
const didUrl = 'did:ethr:0xb09b66026ba5909a7cfe99b76875431d2b8d5190'
const didDoc = (await agent.resolveDid({ didUrl })).didDocument
expect(didDoc?.id).toEqual(didUrl)
})
Expand Down
Loading