Skip to content

Commit

Permalink
DID to DNS Packets (#5)
Browse files Browse the repository at this point in the history
* init commit

* to dns packet

* remove ts

* roundtrip dns packet

* pending

* roundtrip tested

* add ci

* set wd

* Better

* one more

* remove lint for now
  • Loading branch information
decentralgabe authored Oct 16, 2023
1 parent 63151c1 commit 5c9ad19
Show file tree
Hide file tree
Showing 11 changed files with 672 additions and 71 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: did-dht-ci

# when:
# - a pull request is opened against main
# - commits are pushed to main
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# used to run action manually via the UI
workflow_dispatch:

jobs:
vulnerability-scan:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./impl
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21.3

- name: Install Mage
run: go install github.com/magefile/mage

- name: Check Vulnerabilities
run: mage -v vuln
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./impl
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21.3

- name: Install Mage
run: go install github.com/magefile/mage

- name: Build
run: mage build

- name: Test
run: mage citest
45 changes: 45 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '34 18 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./impl
permissions:
actions: read
contents: read
security-events: write
env:
GOFLAGS: "-tags=jwx_es256k"

strategy:
fail-fast: false
matrix:
language: [ 'go' ]

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
10 changes: 9 additions & 1 deletion impl/cmd/cli/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,16 @@ var identityAddCmd = &cobra.Command{

rrds = append(rrds, &rr)
}
msg := dns.Msg{
MsgHdr: dns.MsgHdr{
Id: 0,
Response: true,
Authoritative: true,
},
Answer: rrds,
}
// generate put request
putReq, err := dht.CreatePKARRPutRequest(pubKey, privKey, rrds)
putReq, err := dht.CreatePKARRPutRequest(pubKey, privKey, msg)
if err != nil {
logrus.WithError(err).Error("failed to create put request")
return err
Expand Down
19 changes: 11 additions & 8 deletions impl/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/TBD54566975/did-dht-method
go 1.21

require (
github.com/TBD54566975/ssi-sdk v0.0.4-alpha
github.com/TBD54566975/ssi-sdk v0.0.4-alpha.0.20231012171634-7bd066d36fb1
github.com/anacrolix/dht/v2 v2.20.0
github.com/anacrolix/torrent v1.52.5
github.com/magefile/mage v1.15.0
Expand Down Expand Up @@ -32,33 +32,35 @@ require (
github.com/benbjohnson/immutable v0.4.1-0.20221220213129-8932b999621d // indirect
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.13.0 // indirect
github.com/go-playground/validator/v10 v10.15.1 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gowebpki/jcs v1.0.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/hyperledger/aries-framework-go v0.3.1 // indirect
github.com/hyperledger/aries-framework-go v0.3.2 // indirect
github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230427134832-0c9969493bd3 // indirect
github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 // indirect
github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230501135648-a9a7ad029347 // indirect
github.com/hyperledger/aries-framework-go/spi v0.0.0-20230427134832-0c9969493bd3 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kilic/bls12-381 v0.1.1-0.20210503002446-7b7597926c69 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/leodido/go-urn v1.2.3 // indirect
github.com/lestrrat-go/blackmagic v1.0.1 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/httprc v1.0.4 // indirect
github.com/lestrrat-go/iter v1.0.2 // indirect
github.com/lestrrat-go/jwx/v2 v2.0.9-0.20230429214153-5090ec1bd2cd // indirect
github.com/lestrrat-go/jwx/v2 v2.0.13 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
Expand All @@ -67,7 +69,7 @@ require (
github.com/multiformats/go-base36 v0.1.0 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multicodec v0.9.0 // indirect
github.com/multiformats/go-multihash v0.2.1 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/piprate/json-gold v0.5.0 // indirect
Expand All @@ -77,6 +79,7 @@ require (
github.com/rs/dnscache v0.0.0-20211102005908-e0241e321417 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
Expand Down
Loading

0 comments on commit 5c9ad19

Please sign in to comment.