mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-04 18:31:41 +00:00
feature/implement did state (#15)
* refactor: update model proto * feat: add status field to Controller * feat: add Verification.Kind field to state protobuf to support different verification types * fix: remove QueryService and QueryResolve RPCs from query.proto
This commit is contained in:
@@ -66,18 +66,6 @@ func APIFormatPermissionScopes(scopes []types.PermissionScope) []didv1.Permissio
|
||||
return s
|
||||
}
|
||||
|
||||
func APIFormatServiceRecord(service *types.Service) *didv1.ServiceRecord {
|
||||
return &didv1.ServiceRecord{
|
||||
Id: service.Id,
|
||||
ServiceType: service.ServiceType,
|
||||
Authority: service.Authority,
|
||||
Origin: service.Origin,
|
||||
Description: service.Description,
|
||||
ServiceEndpoints: service.ServiceEndpoints,
|
||||
Permissions: APIFormatPermissions(service.Permissions),
|
||||
}
|
||||
}
|
||||
|
||||
func APIFormatPubKeyJWK(jwk *types.PubKey_JWK) *didv1.PubKey_JWK {
|
||||
return &didv1.PubKey_JWK{
|
||||
Kty: jwk.Kty,
|
||||
@@ -202,19 +190,6 @@ func ModuleTransportsToProtocol(transport []string) []protocol.AuthenticatorTran
|
||||
return tss
|
||||
}
|
||||
|
||||
// ModuleFormatAPIServiceRecord formats a service record for the module
|
||||
func ModuleFormatAPIServiceRecord(service *didv1.ServiceRecord) *types.Service {
|
||||
return &types.Service{
|
||||
Id: service.Id,
|
||||
ServiceType: service.ServiceType,
|
||||
Authority: service.Authority,
|
||||
Origin: service.Origin,
|
||||
Description: service.Description,
|
||||
ServiceEndpoints: service.ServiceEndpoints,
|
||||
Permissions: ModuleFormatAPIPermissions(service.Permissions),
|
||||
}
|
||||
}
|
||||
|
||||
func ModuleFormatAPIPermissions(permissions *didv1.Permissions) *types.Permissions {
|
||||
if permissions == nil {
|
||||
return nil
|
||||
|
||||
@@ -23,8 +23,8 @@ type PublicKey interface {
|
||||
}
|
||||
|
||||
// CreateAuthnVerification creates a new verification method for an authn method
|
||||
func CreateAuthnVerification(namespace types.DIDNamespace, issuer string, controller string, pubkey *types.PubKey, identifier string) *types.VerificationMethod {
|
||||
return &types.VerificationMethod{
|
||||
func CreateAuthnVerification(namespace types.DIDNamespace, issuer string, controller string, pubkey *types.PubKey, identifier string) *types.Verification {
|
||||
return &types.Verification{
|
||||
Method: namespace,
|
||||
Controller: controller,
|
||||
PublicKey: pubkey,
|
||||
@@ -34,8 +34,8 @@ func CreateAuthnVerification(namespace types.DIDNamespace, issuer string, contro
|
||||
}
|
||||
|
||||
// CreateWalletVerification creates a new verification method for a wallet
|
||||
func CreateWalletVerification(namespace types.DIDNamespace, controller string, pubkey *types.PubKey, identifier string) *didv1.VerificationMethod {
|
||||
return &didv1.VerificationMethod{
|
||||
func CreateWalletVerification(namespace types.DIDNamespace, controller string, pubkey *types.PubKey, identifier string) *didv1.Verification {
|
||||
return &didv1.Verification{
|
||||
Method: APIFormatDIDNamespace(namespace),
|
||||
Controller: controller,
|
||||
PublicKey: APIFormatPubKey(pubkey),
|
||||
@@ -63,8 +63,8 @@ func ExtractWebAuthnPublicKey(keyBytes []byte) (*types.PubKey_JWK, error) {
|
||||
}
|
||||
|
||||
// NewInitialWalletAccounts creates a new set of verification methods for a wallet
|
||||
func NewInitialWalletAccounts(controller string, pubkey *types.PubKey) ([]*didv1.VerificationMethod, error) {
|
||||
var verificationMethods []*didv1.VerificationMethod
|
||||
func NewInitialWalletAccounts(controller string, pubkey *types.PubKey) ([]*didv1.Verification, error) {
|
||||
var verificationMethods []*didv1.Verification
|
||||
for method, chain := range types.InitialChainCodes {
|
||||
nk, err := computeBip32AccountPublicKey(pubkey, chain, 0)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user