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

Refactor to reflect did-io v1.0, crypto-ld and jsigs. #56

Merged
merged 20 commits into from May 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions .eslintrc.js
@@ -1,7 +1,13 @@
module.exports = {
root: true,
extends: ['eslint-config-digitalbazaar'],
extends: [
'eslint-config-digitalbazaar'
],
env: {
node: true
node: true,
browser: true
},
ignorePatterns: ['dist/'],
rules: {
}
}
};
73 changes: 73 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,73 @@
name: Node.js CI

on: [push]

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- name: Run eslint
run: npm run lint
test-node:
runs-on: ubuntu-latest
needs: [lint]
timeout-minutes: 10
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- name: Run test with Node.js ${{ matrix.node-version }}
run: npm run test-node
# test-karma:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are karma tests broken at the moment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gannan08 - yeah, they are. This lib didn't have a karma suite before; I started to add it in this PR, but it still needs more work.

# runs-on: ubuntu-latest
# needs: [lint]
# timeout-minutes: 10
# strategy:
# matrix:
# node-version: [14.x]
# steps:
# - uses: actions/checkout@v2
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node-version }}
# - run: npm install
# - name: Run karma tests
# run: npm run test-karma
coverage:
needs: [test-node, test-karma]
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- name: Generate coverage report
run: npm run coverage-ci
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage/lcov.info
fail_ci_if_error: true
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

48 changes: 48 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,53 @@
# did-veres-one ChangeLog

## 14.0.0 -

### Changed
- **BREAKING**: Update to the newest contexts, crypto suites, `did-io` version.
- **BREAKING**: Change `.generate()` return signature, now returns
`{didDocument, keyPairs, methodFor}`.
- **BREAKING**: Remove unused/obsolete `passphrase` parameter.
- **BREAKING**: Remove the `forceConstruct` parameter from `.get()` --
use the CachedResolver from https://github.com/digitalbazaar/did-io instead.
- **BREAKING**: Rename `.computeKeyId()` to `.computeId()`.

### Upgrading from <=12.x

**1)** DID Document `generate()` method return signature has changed.

**Before:** `const didDocument = await veresOneDriver.generate();`

The generated `didDocument` was an instance of the `VeresOneDidDoc` class,
and stored its own generated key pairs in `didDocument.keys`.

**Now:** `const {didDocument, keyPairs, methodFor} = await veresOneDriver.generate();`

In v13, the generated `didDocument` is a plain Javascript object, with no
methods. Generated keys are returned in the `keyPairs` property (a js `Map`
instance, with key pairs stored by key id).
In addition, a helper method `methodFor` is provided, to help retrieve keys
for a particular purpose. For example:
`methodFor({purpose: 'capabilityInvocation'})` returns the first available
public/private key pair instance that is referenced in the DID Document's
`capabilityInvocation` verification relationship.

**2)** Driver `.get()` method has changed -- no longer uses the `forceConstruct`
parameter. Developers are encouraged to use the CachedResolver from
https://github.com/digitalbazaar/did-io instead.
`driver.get()` can still be used to fetch either the full DID Document (via
`await driver.get({did})`) or a key document (via `await driver.get({url: keyId})`).

**3)** Check for `.computeKeyId()` usage. It's been renamed to `.computeId()`.

**4)** Validation methods have changed (used by the `did-veres-one` validator
node):

- `didDocument.validateDid({mode})` becomes:
`VeresOneDriver.validateDid({didDocument, mode})`
- `didDocument.validateMethodIds()` becomes:
`VeresOneDriver.validateMethodIds({didDocument})`


## 13.0.0 - 2021-03-12

### Changed
Expand Down