This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Go Mobile support for DID Key #457
Merged
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6adc743
mobile
cbf990d
mobile
02f1d5a
move
ad95bb9
handle compressed keys properly
b5de063
Merge branch 'main' into mobile
decentralgabe 5dcc770
Merge branch 'main' into mobile
decentralgabe b67b4c4
Merge branch 'main' into mobile
decentralgabe 54f5be8
pr comments
7d94143
add tests
fd002fd
Merge branch 'main' into mobile
decentralgabe 8d1e16d
comments and tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,8 @@ | |
.DS_Store | ||
|
||
# IDE | ||
.idea/ | ||
.idea/ | ||
|
||
# Mobile | ||
*.jar | ||
*.aar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
go 1.20 | ||
go 1.21 | ||
|
||
toolchain go1.21.0 | ||
|
||
use ( | ||
./sd-jwt | ||
. | ||
) | ||
./sd-jwt | ||
./mobile | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,8 @@ import ( | |
) | ||
|
||
const ( | ||
Go = "go" | ||
Go = "go" | ||
gomobile = "gomobile" | ||
) | ||
|
||
// Build builds the library. | ||
|
@@ -305,3 +306,34 @@ func Vuln() error { | |
func installGoVulnIfNotPresent() error { | ||
return installIfNotPresent("govulncheck", "golang.org/x/vuln/cmd/govulncheck@latest") | ||
} | ||
|
||
func installGoMobileIfNotPresent() error { | ||
return installIfNotPresent(gomobile, "golang.org/x/mobile/cmd/gomobile@latest") | ||
} | ||
|
||
// IOS Generates the iOS packages | ||
// Note: this command also installs "gomobile" if not present | ||
func IOS() error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this target, as well as the Android target, be documented in a README? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes good call |
||
if err := installGoMobileIfNotPresent(); err != nil { | ||
logrus.WithError(err).Fatal("Error installing gomobile") | ||
return err | ||
} | ||
|
||
println("Building iOS...") | ||
bindIOS := sh.RunCmd(gomobile, "bind", "-target", "ios", "-tags", "jwx_es256k") | ||
return bindIOS("./mobile") | ||
} | ||
|
||
// Android Generates the Android packages | ||
// Note: this command also installs "gomobile" if not present | ||
func Android() error { | ||
if err := installGoMobileIfNotPresent(); err != nil { | ||
logrus.WithError(err).Fatal("Error installing gomobile") | ||
return err | ||
} | ||
|
||
apiLevel := "33" | ||
println("Building Android - API Level: " + apiLevel + "...") | ||
bindAndroid := sh.RunCmd("gomobile", "bind", "-target", "android", "-androidapi", "33", "-tags", "jwx_es256k") | ||
return bindAndroid("./mobile") | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value of both options is the same. Is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, one used for marshaling one for unmarshaling
I could condense to a
ECDSACompressed
optionThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generally discourage using an
Option
type which has a field namedName
. It's bypasses the type system, and makes it easy to shoot yourself in the foot.I would suggest using an enum es below:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done