-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement did-pkh #168
Implement did-pkh #168
Conversation
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.
looks great, minor changes. may want to add a GetSupportedNetworks()
method
did/model.go
Outdated
@@ -95,6 +95,8 @@ type VerificationMethod struct { | |||
PublicKeyJWK *cryptosuite.PublicKeyJWK `json:"publicKeyJwk,omitempty" validate:"omitempty,dive"` | |||
// https://datatracker.ietf.org/doc/html/draft-multiformats-multibase-03 | |||
PublicKeyMultibase string `json:"publicKeyMultibase,omitempty"` | |||
// for PKH DIDs - https://github.com/w3c-ccg/did-pkh/blob/90b28ad3c18d63822a8aab3c752302aa64fc9382/did-pkh-method-draft.md | |||
BlockchainAccountId string `json:"blockchainAccountId,omitempty"` |
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.
BlockchainAccountId string `json:"blockchainAccountId,omitempty"` | |
BlockchainAccountID string `json:"blockchainAccountId,omitempty"` |
did/pkh.go
Outdated
var knownDIDPKHContextJson interface{} | ||
err = json.Unmarshal([]byte(knownDIDPKHContext), &knownDIDPKHContextJson) | ||
if err != nil { | ||
return nil, util.LoggingErrorMsg(err, "could not unmarshal known context json") | ||
} |
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.
var knownDIDPKHContextJson interface{} | |
err = json.Unmarshal([]byte(knownDIDPKHContext), &knownDIDPKHContextJson) | |
if err != nil { | |
return nil, util.LoggingErrorMsg(err, "could not unmarshal known context json") | |
} | |
var knownDIDPKHContextJSON interface{} | |
if err := json.Unmarshal([]byte(knownDIDPKHContext), &knownDIDPKHContextJSON); err != nil { | |
return nil, util.LoggingErrorMsg(err, "could not unmarshal known context json") | |
} |
did/pkh.go
Outdated
} | ||
|
||
return &DIDDocument{ | ||
Context: knownDIDPKHContextJson, |
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.
Context: knownDIDPKHContextJson, | |
Context: knownDIDPKHContextJSON, |
did/pkh.go
Outdated
} | ||
|
||
func GetSupportedNetworks() []Network { | ||
networks := []Network{} |
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.
nit: favor var initialization
var networks []Network
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.
approving pending couple small comments - nice job!
This change implements they did-pkh method as specified here - https://github.com/w3c-ccg/did-pkh/blob/90b28ad3c18d63822a8aab3c752302aa64fc9382/did-pkh-method-draft.md
Linked issue here - #33
This change includes construction of a Bitcoin, Ethereum, or Polygon did:pkh from a network and an address. For more granular creation it can be constructed from a namespace, reference, and account address.
// Example Reference: did:pkh:namespace:reference:account_address
// Ethereum: did:pkh:eip155:1:0xb9c5714089478a327f09197987f16f9e5d936e8a