Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

feat: Add did:jwk VDR - Read #310

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
53 changes: 53 additions & 0 deletions .github/workflows/vdr-jwk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# Copyright SecureKey Technologies Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
name: vdr-jwk
on:
push:
paths:
- 'component/vdr/jwk/**'
pull_request:
paths:
- 'component/vdr/jwk/**'
jobs:
linter:
name: Go linter
timeout-minutes: 10
env:
LINT_PATH: component/vdr/jwk
GOLANGCI_LINT_IMAGE: "golangci/golangci-lint:v1.50.0"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: Checks linter
timeout-minutes: 10
run: make lint
unitTest:
name: Unit test
runs-on: ubuntu-18.04
timeout-minutes: 15
env:
UNIT_TESTS_PATH: component/vdr/jwk
steps:
- name: Setup Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.19
id: go

- uses: actions/checkout@v2

- name: Run unit test
timeout-minutes: 15
run: make unit-test

- name: Upload coverage to Codecov
timeout-minutes: 10
if: github.repository == 'hyperledger/aries-framework-go-ext'
uses: codecov/codecov-action@v1.0.14
with:
file: ./coverage.out

176 changes: 176 additions & 0 deletions component/vdr/jwk/.custom_golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
#
# Copyright SecureKey Technologies Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

run:
concurrency: 4
deadline: 3m
issues-exit-code: 1
tests: true
build-tags: [""]
skip-dirs: [""]

output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true


linters-settings:
depguard:
list-type: denylist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
funlen:
lines: 100
statements: 50
goconst:
min-len: 2
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- unnamedResult
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/golangci/golangci-lint
gomnd:
# don't include the "operation" and "assign"
checks:
- argument
- case
- condition
- return
ignored-numbers:
- '0'
- '1'
- '2'
- '3'
ignored-functions:
- strings.SplitN

govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 140
misspell:
locale: US
nolintlint:
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
machine: false # don't require //nolint instead of // nolint
explain: false # don't require //nolint // my explanation instead of just //nolint

linters:
disable-all: true
enable:
- bodyclose
- depguard
- dogsled
- dupl
- errcheck
- exportloopref
- funlen
- gochecknoinits
- goconst
- gocritic
- gocyclo
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- nakedret
- noctx
- nolintlint
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- whitespace

# don't enable:
# - asciicheck
# - scopelint
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - interfacer
# - maligned
# - nestif
# - prealloc
# - testpackage
# - revive
# - wsl

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd
- dupl
- funlen
- bodyclose
- dupl
- goconst
- gosec
- noctx
- wrapcheck
- lll
- gocritic

- path: pkg/golinters/errcheck.go
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
- path: pkg/commands/run.go
text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead"
- path: pkg/commands/run.go
text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used."

- path: pkg/golinters/gofumpt.go
text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead."
- path: pkg/golinters/staticcheck_common.go
text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead."
- path: pkg/lint/lintersdb/manager.go
text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead."

exclude:
- \`config\` is a global variable
- Line contains TODO/BUG/FIXME
# Add comments for package
- at least one file in a package should have a package comment
# Allow package logger variables (for now)
- logger is a global variable
19 changes: 19 additions & 0 deletions component/vdr/jwk/creator.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/

package jwk

import (
"fmt"

"github.com/hyperledger/aries-framework-go/pkg/doc/did"
vdrapi "github.com/hyperledger/aries-framework-go/pkg/framework/aries/api/vdr"
)

// Create new DID document for didDoc.
func (v *VDR) Create(didDoc *did.Doc, opts ...vdrapi.DIDMethodOption) (*did.DocResolution, error) {
return nil, fmt.Errorf("TODO")
}
25 changes: 25 additions & 0 deletions component/vdr/jwk/creator_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/

package jwk_test

import (
"testing"

"github.com/stretchr/testify/require"

"github.com/hyperledger/aries-framework-go-ext/component/vdr/jwk"
)

func TestCreate(t *testing.T) {
t.Run("test create", func(t *testing.T) {
v := jwk.New()
doc, err := v.Create(nil)
require.Error(t, err)
require.Nil(t, doc)
require.Contains(t, err.Error(), "TODO")
})
}
36 changes: 36 additions & 0 deletions component/vdr/jwk/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright SecureKey Technologies Inc. All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
module github.com/hyperledger/aries-framework-go-ext/component/vdr/jwk

go 1.19

require (
github.com/hyperledger/aries-framework-go v0.1.9-0.20221201073943-47b08f16c301
github.com/stretchr/testify v1.8.1
)

require (
github.com/btcsuite/btcd v0.22.0-beta // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hyperledger/aries-framework-go/spi v0.0.0-20221025204933-b807371b6f1e // indirect
github.com/kilic/bls12-381 v0.1.1-0.20210503002446-7b7597926c69 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect
github.com/multiformats/go-multibase v0.1.1 // indirect
github.com/piprate/json-gold v0.4.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/cachecontrol v0.1.0 // indirect
github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693 // indirect
github.com/teserakt-io/golang-ed25519 v0.0.0-20210104091850-3888c087a4c8 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/sys v0.1.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading