-
Notifications
You must be signed in to change notification settings - Fork 57
Conversation
Codecov Report
@@ Coverage Diff @@
## main #184 +/- ##
==========================================
- Coverage 55.16% 55.11% -0.06%
==========================================
Files 40 40
Lines 4374 4378 +4
==========================================
Hits 2413 2413
- Misses 1565 1569 +4
Partials 396 396
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
return false | ||
} | ||
|
||
func GetSupportedSignatureAlgs() []string { |
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.
@decentralgabe seems like arrays aren't yet supported golang/go#14332
I took stab at this without any success:
package util
type StringArray interface {
Add(s string) StringArray
Get(i int) string
Size() int
}
type StringArrayImpl struct {
items []string
}
func (stringArray StringArrayImpl) Add(s string) StringArray{
stringArray.items = append(stringArray.items, s)
return stringArray
}
func (stringArray StringArrayImpl) Get(i int) string {
return stringArray.items[i]
}
func (stringArray StringArrayImpl) Size() int {
return len(stringArray.items)
}
func ToStringArray(s []string) StringArray {
return StringArrayImpl{items: s}
}
where
func GetSupportedKeyTypes() util.StringArray {
return util.ToStringArray([]string{keyTypeToString(ssi.Ed25519), keyTypeToString(ssi.X25519), keyTypeToString(ssi.Secp256k1), keyTypeToString(ssi.P224), keyTypeToString(ssi.P256), keyTypeToString(ssi.P384), keyTypeToString(ssi.P521), keyTypeToString(ssi.RSA)})
}
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.
FYI: I've pushed this to https://github.com/nrobi144/ssi-sdk-mobile/blob/main/crypto/crypto.go
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.
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.
Something's up with struct type
s.
Changing func GenerateX25519Key() (CryptoKeyPair, error)
to func GenerateX25519Key() (string, error)
works.
Even though gomobile
has these rules:
- Any function type all of whose parameters and results have supported types. Functions must return either no results, one result, or two results where the type of the second is the built-in 'error' type.
- Any struct type, all of whose exported methods have supported function types and all of whose exported fields have supported types.
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.
Update: using pointers for struct
s works:
For ex:
func GenerateEd25519Key() (*CryptoKeyPair, error) {
privKey, pubKey, err := ssi.GenerateEd25519Key()
return &CryptoKeyPair{
PrivKey: privKey,
PubKey: pubKey,
}, err
}
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.
thanks @nrobi144 I'm going to close this PR in favor of your projects.
let me know if I can help with more go-specific stuff
No description provided.