Skip to content

Commit

Permalink
Better IVMS101 Validation (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbengfort authored Sep 5, 2024
1 parent f74c234 commit 4c59f14
Show file tree
Hide file tree
Showing 20 changed files with 21,959 additions and 246 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,16 @@ jobs:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/trisacrypto/trisa
steps:
- name: Set up Go
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Cache Speedup
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -94,6 +99,11 @@ jobs:
with:
go-version: 1.22.x

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Cache Speedup
uses: actions/cache@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/bombsimon/tld-validator v1.2.33
github.com/google/uuid v1.6.0
github.com/joho/godotenv v1.5.1
github.com/nsf/jsondiff v0.0.0-20230430225905-43f6cf3098c1
github.com/stretchr/testify v1.9.0
github.com/trisacrypto/lei v1.0.0
github.com/urfave/cli/v2 v2.27.2
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/nsf/jsondiff v0.0.0-20230430225905-43f6cf3098c1 h1:dOYG7LS/WK00RWZc8XGgcUTlTxpp3mKhdR2Q9z9HbXM=
github.com/nsf/jsondiff v0.0.0-20230430225905-43f6cf3098c1/go.mod h1:mpRZBD8SJ55OIICQ3iWH0Yz3cjzA61JdqMLoWXeB2+8=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/trisacrypto/lei v1.0.0 h1:LKrwOgYjW+ljzBmN6hGgBbGFAktoRmovyY7ZYZB5/uI=
github.com/trisacrypto/lei v1.0.0/go.mod h1:OsJZIYPShoSETOphRXAIlHwwesIsvo5PPpEemp/wGZI=
github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI=
github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
Expand Down
3 changes: 3 additions & 0 deletions pkg/gleif/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package gleif

//go:generate python3 generate.py
44 changes: 44 additions & 0 deletions pkg/gleif/generate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3

import json

CODE_FILE = "gleif.gen.go"
AUTHORITIES = "testdata/registrationAuthorities.json"
HEADERS = [
"// Code generated by generate.py. DO NOT EDIT.",
"// source: registrationAuthorities.json",
"",
"package gleif",
"",
"var registrationAuthorities = RegistrationAuthorities{",
""
]


def load_authorities(path=AUTHORITIES):
with open(path, 'r') as f:
return json.load(f)


def main():
authorities = load_authorities()
with open(CODE_FILE, 'w') as f:
f.write("\n".join(HEADERS))

for authority in authorities:
f.write("\t{\n")
f.write(f"\t\tOption: \"{authority.get('option')}\",\n")
f.write(f"\t\tCountryName: \"{authority.get('country_name')}\",\n")
f.write(f"\t\tCountry: \"{authority.get('country')}\",\n")
f.write(f"\t\tJurisdiction: \"{authority.get('jurisdiction')}\",\n") # noqa
f.write(f"\t\tRegister: \"{authority.get('register')}\",\n")
f.write(f"\t\tOrganization: \"{authority.get('organization')}\",\n") # noqa
f.write(f"\t\tWebsite: \"{authority.get('website')}\",\n")
f.write(f"\t\tComments: `{authority.get('comments')}`,\n")
f.write("\t},\n")

f.write("}\n")


if __name__ == "__main__":
main()
Loading

0 comments on commit 4c59f14

Please sign in to comment.