Feature/update dockerfile (#6)

* chore: remove unused new.Dockerfile

* feat: add DID model definitions

* fix: Fix EncodePublicKey method in KeyInfo struct

* feat: Update `EncodePublicKey` to be the inverse of `DecodePublicKey`

* refactor: update AssetInfo protobuf definition

* fix: update default assets with correct asset types

* fix: Initialize IPFS client and check for mounted directories

* feat: Improve IPFS client initialization and mount checking

* feat: Add local filesystem check for IPFS and IPNS

* fix: Use Unixfs().Get() instead of Cat() for IPFS and IPNS content retrieval

* feat: Update GetCID and GetIPNS functions to read data from IPFS node

* fix: Ensure IPFS client is initialized before pinning CID

* feat: Add AddFile and AddFolder methods

* feat: add IPFS file system abstraction

* feat: Implement IPFS file, location, and filesystem abstractions

* refactor: remove unused functions and types

* refactor: remove unused FileSystem interface

* feat: add initial wasm entrypoint

* feat: add basic vault command operations

* docs: add vault module features

* test: remove test for MsgUpdateParams

* refactor: Replace PrimaryKey with Property struct in zkprop.go

* feat: Update the `CreateWitness` and `CreateAccumulator` and `VerifyWitness` and `UpdateAccumulator` to Use the new `Accumulator` and `Witness` types. Then Clean up the code in the file and refactor the marshalling methods

* <no value>

* feat: add KeyCurve and KeyType to KeyInfo in genesis

* feat: add WASM build step to devbox.json

* feat: Add zkgate.go file

* feat: Uncomment and modify zkgate code to work with Property struct

* feat: Merge zkgate.go and zkprop.go logic

* feat: implement API endpoints for profile management

* refactor: remove unused template file

* feat(orm): remove unused ORM models

* feat: add persistent SQLite database support in WASM

* fix: Update module names in protobuf files

* feat: Add method to initialize SQLite database

* fix: update go-sqlite3 dependency to version 1.14.23

* feat: introduce database layer

* feat: Implement database layer for Vault node

* feature/update-dockerfile

* feat: Add keyshares table

* fix: Reorder the SQL statements in the tables.go file

* feat: Update the `createCredentialsTable` method to match the proper Credential struct

* feat: Update createProfilesTable and add createPropertiesTable

* feat: Add constant SQL queries to queries.go and use prepared statements in db.go

* feat: Add createKeysharesTable to internal/db/db.go

* feat: Update `createPermissionsTable` to match Permissions struct

* feat: Add database enum types

* feat: Add DIDNamespace and PermissionScope enums

* feat: Add DBConfig and DBOption types

* feat: Update the db implementation to use the provided go library

* fix: update db implementation to use go-sqlite3 v0.18.2

* fix: Refactor database connection and statement handling

* feat: Simplify db.go implementation

* feat: Convert constant SQL queries to functions in queries.go and update db.go to use prepared statements

* feat: Add models.go file with database table structs

* fix: Remove unused statement map and prepare statements

diff --git a/internal/db/db.go b/internal/db/db.go
index 201d09b..d4d4d4e 100644
--- a/internal/db/db.go
+++ b/internal/db/db.go
@@ -32,11 +32,6 @@ func Open(config *DBConfig) (*DB, error) {
 		Conn: conn,
 	}

-	if err := createTables(db); err != nil {
-		conn.Close()
-		return nil, fmt.Errorf("failed to create tables: %w", err)
-	}
-
 	return db, nil
 }

@@ -61,114 +56,3 @@ func createTables(db *DB) error {
 	return nil
 }

-// AddAccount adds a new account to the database
-func (db *DB) AddAccount(name, address string) error {
-	return db.Exec(insertAccountQuery(name, address))
-}
-
-// AddAsset adds a new asset to the database
-func (db *DB) AddAsset(name, symbol string, decimals int, chainID int64) error {
-	return db.Exec(insertAssetQuery(name, symbol, decimals, chainID))
-}
-
-// AddChain adds a new chain to the database
-func (db *DB) AddChain(name, networkID string) error {
-	return db.Exec(insertChainQuery(name, networkID))
-}
-
-// AddCredential adds a new credential to the database
-func (db *DB) AddCredential(
-	handle, controller, attestationType, origin string,
-	credentialID, publicKey []byte,
-	transport string,
-	signCount uint32,
-	userPresent, userVerified, backupEligible, backupState, cloneWarning bool,
-) error {
-	return db.Exec(insertCredentialQuery(
-		handle,
-		controller,
-		attestationType,
-		origin,
-		credentialID,
-		publicKey,
-		transport,
-		signCount,
-		userPresent,
-		userVerified,
-		backupEligible,
-		backupState,
-		cloneWarning,
-	))
-}
-
-// AddProfile adds a new profile to the database
-func (db *DB) AddProfile(
-	id, subject, controller, originURI, publicMetadata, privateMetadata string,
-) error {
-	return db.statements["insertProfile"].Exec(
-		id, subject, controller, originURI, publicMetadata, privateMetadata,
-	)
-}
-
-// AddProperty adds a new property to the database
-func (db *DB) AddProperty(
-	profileID, key, accumulator, propertyKey string,
-) error {
-	return db.statements["insertProperty"].Exec(
-		profileID, key, accumulator, propertyKey,
-	)
-}
-
-// AddPermission adds a new permission to the database
-func (db *DB) AddPermission(
-	serviceID string,
-	grants []DIDNamespace,
-	scopes []PermissionScope,
-) error {
-	grantsJSON, err := json.Marshal(grants)
-	if err != nil {
-		return fmt.Errorf("failed to marshal grants: %w", err)
-	}
-
-	scopesJSON, err := json.Marshal(scopes)
-	if err != nil {
-		return fmt.Errorf("failed to marshal scopes: %w", err)
-	}
-
-	return db.statements["insertPermission"].Exec(
-		serviceID, string(grantsJSON), string(scopesJSON),
-	)
-}
-
-// GetPermission retrieves the permission for the given service ID
-func (db *DB) GetPermission(serviceID string) ([]DIDNamespace, []PermissionScope, error) {
-	row := db.statements["getPermission"].QueryRow(serviceID)
-
-	var grantsJSON, scopesJSON string
-	if err := row.Scan(&grantsJSON, &scopesJSON); err != nil {
-		return nil, nil, fmt.Errorf("failed to get permission: %w", err)
-	}
-
-	var grants []DIDNamespace
-	if err := json.Unmarshal([]byte(grantsJSON), &grants); err != nil {
-		return nil, nil, fmt.Errorf("failed to unmarshal grants: %w", err)
-	}
-
-	var scopes []PermissionScope
-	if err := json.Unmarshal([]byte(scopesJSON), &scopes); err != nil {
-		return nil, nil, fmt.Errorf("failed to unmarshal scopes: %w", err)
-	}
-
-	return grants, scopes, nil
-}
-
-// Close closes the database connection and finalizes all prepared statements
-func (db *DB) Close() error {
-	for _, stmt := range db.statements {
-		stmt.Finalize()
-	}
-	return db.Conn.Close()
-}
diff --git a/internal/db/queries.go b/internal/db/queries.go
index 807d701..e69de29 100644
--- a/internal/db/queries.go
+++ b/internal/db/queries.go
@@ -1,79 +0,0 @@
-package db
-
-import "fmt"
-
-// Account queries
-func insertAccountQuery(name, address string) string {
-	return fmt.Sprintf(`INSERT INTO accounts (name, address) VALUES (%s, %s)`, name, address)
-}
-
-// Asset queries
-func insertAssetQuery(name, symbol string, decimals int, chainID int64) string {
-	return fmt.Sprintf(
-		`INSERT INTO assets (name, symbol, decimals, chain_id) VALUES (%s, %s, %d, %d)`,
-		name,
-		symbol,
-		decimals,
-		chainID,
-	)
-}
-
-// Chain queries
-func insertChainQuery(name string, networkID string) string {
-	return fmt.Sprintf(`INSERT INTO chains (name, network_id) VALUES (%s, %d)`, name, networkID)
-}
-
-// Credential queries
-func insertCredentialQuery(
-	handle, controller, attestationType, origin string,
-	credentialID, publicKey []byte,
-	transport string,
-	signCount uint32,
-	userPresent, userVerified, backupEligible, backupState, cloneWarning bool,
-) string {
-	return fmt.Sprintf(`INSERT INTO credentials (
-		handle, controller, attestation_type, origin,
-		credential_id, public_key, transport, sign_count,
-		user_present, user_verified, backup_eligible,
-		backup_state, clone_warning
-	) VALUES (%s, %s, %s, %s, %s, %s, %s, %d, %t, %t, %t, %t, %t)`,
-		handle, controller, attestationType, origin,
-		credentialID, publicKey, transport, signCount,
-		userPresent, userVerified, backupEligible,
-		backupState, cloneWarning)
-}
-
-// Profile queries
-func insertProfileQuery(
-	id, subject, controller, originURI, publicMetadata, privateMetadata string,
-) string {
-	return fmt.Sprintf(`INSERT INTO profiles (
-		id, subject, controller, origin_uri,
-		public_metadata, private_metadata
-	) VALUES (%s, %s, %s, %s, %s, %s)`,
-		id, subject, controller, originURI,
-		publicMetadata, privateMetadata)
-}
-
-// Property queries
-func insertPropertyQuery(profileID, key, accumulator, propertyKey string) string {
-	return fmt.Sprintf(`INSERT INTO properties (
-		profile_id, key, accumulator, property_key
-	) VALUES (%s, %s, %s, %s)`,
-		profileID, key, accumulator, propertyKey)
-}
-
-// Permission queries
-func insertPermissionQuery(serviceID, grants, scopes string) string {
-	return fmt.Sprintf(
-		`INSERT INTO permissions (service_id, grants, scopes) VALUES (%s, %s, %s)`,
-		serviceID,
-		grants,
-		scopes,
-	)
-}
-
-// GetPermission query
-func getPermissionQuery(serviceID string) string {
-	return fmt.Sprintf(`SELECT grants, scopes FROM permissions WHERE service_id = %s`, serviceID)
-}

* fix: update Makefile to use sonrd instead of wasmd

* feat: Add targets for templ and vault in Makefile and use only make in devbox.json

* feat: add SQLite database support

* bump: version 0.6.0 → 0.7.0

* refactor: upgrade actions to latest versions
This commit is contained in:
Prad Nukala
2024-09-05 01:24:57 -04:00
committed by GitHub
parent fd82cf4f3d
commit 8010e6b069
123 changed files with 24666 additions and 14591 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ package module
import (
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
modulev1 "github.com/onsonr/hway/api/did/v1"
modulev1 "github.com/onsonr/sonr/api/did/v1"
)
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
+2 -2
View File
@@ -17,8 +17,8 @@ import (
"cosmossdk.io/depinject"
"cosmossdk.io/log"
modulev1 "github.com/onsonr/hway/api/did/module/v1"
"github.com/onsonr/hway/x/did/keeper"
modulev1 "github.com/onsonr/sonr/api/did/module/v1"
"github.com/onsonr/sonr/x/did/keeper"
)
var _ appmodule.AppModule = AppModule{}
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context"
"cosmossdk.io/log"
"github.com/onsonr/hway/x/did/types"
"github.com/onsonr/sonr/x/did/types"
)
// Logger returns the logger
+1 -2
View File
@@ -5,7 +5,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/onsonr/hway/x/did/types"
"github.com/onsonr/sonr/x/did/types"
)
func TestGenesis(t *testing.T) {
@@ -20,7 +20,6 @@ func TestGenesis(t *testing.T) {
err := f.k.InitGenesis(f.ctx, genesisState)
require.NoError(t, err)
got := f.k.ExportGenesis(f.ctx)
require.NotNil(t, got)
+2 -2
View File
@@ -10,8 +10,8 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
apiv1 "github.com/onsonr/hway/api/did/v1"
"github.com/onsonr/hway/x/did/types"
apiv1 "github.com/onsonr/sonr/api/did/v1"
"github.com/onsonr/sonr/x/did/types"
)
// Keeper defines the middleware keeper.
+3 -3
View File
@@ -26,9 +26,9 @@ import (
"cosmossdk.io/core/store"
module "github.com/onsonr/hway/x/did"
"github.com/onsonr/hway/x/did/keeper"
"github.com/onsonr/hway/x/did/types"
module "github.com/onsonr/sonr/x/did"
"github.com/onsonr/sonr/x/did/keeper"
"github.com/onsonr/sonr/x/did/types"
"github.com/strangelove-ventures/poa"
)
+13 -13
View File
@@ -5,8 +5,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
// "github.com/onsonr/hway/internal/local"
"github.com/onsonr/hway/x/did/types"
// "github.com/onsonr/sonr/internal/local"
"github.com/onsonr/sonr/x/did/types"
)
var _ types.QueryServer = Querier{}
@@ -20,7 +20,7 @@ func NewQuerier(keeper Keeper) Querier {
}
// Params returns the total set of did parameters.
func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
func (k Querier) Params(c context.Context, req *types.QueryRequest) (*types.QueryParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
p, err := k.Keeper.Params.Get(ctx)
@@ -32,31 +32,31 @@ func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*type
}
// Accounts implements types.QueryServer.
func (k Querier) Accounts(goCtx context.Context, req *types.QueryAccountsRequest) (*types.QueryAccountsResponse, error) {
func (k Querier) Accounts(goCtx context.Context, req *types.QueryRequest) (*types.QueryAccountsResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
return &types.QueryAccountsResponse{}, nil
}
// Credentials implements types.QueryServer.
func (k Querier) Credentials(goCtx context.Context, req *types.QueryCredentialsRequest) (*types.QueryCredentialsResponse, error) {
func (k Querier) Credentials(goCtx context.Context, req *types.QueryRequest) (*types.QueryCredentialsResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
return &types.QueryCredentialsResponse{}, nil
}
// Identities implements types.QueryServer.
func (k Querier) Identities(goCtx context.Context, req *types.QueryIdentitiesRequest) (*types.QueryIdentitiesResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
return &types.QueryIdentitiesResponse{}, nil
}
// Resolve implements types.QueryServer.
func (k Querier) Resolve(goCtx context.Context, req *types.QueryResolveRequest) (*types.QueryResolveResponse, error) {
func (k Querier) Resolve(goCtx context.Context, req *types.QueryRequest) (*types.QueryResolveResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
return &types.QueryResolveResponse{}, nil
}
// Service implements types.QueryServer.
func (k Querier) Service(goCtx context.Context, req *types.QueryServiceRequest) (*types.QueryServiceResponse, error) {
func (k Querier) Service(goCtx context.Context, req *types.QueryRequest) (*types.QueryServiceResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
return &types.QueryServiceResponse{}, nil
}
// Token implements types.QueryServer.
func (k Querier) Token(goCtx context.Context, req *types.QueryRequest) (*types.QueryTokenResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
return &types.QueryTokenResponse{}, nil
}
+26 -16
View File
@@ -7,8 +7,9 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"cosmossdk.io/errors"
didv1 "github.com/onsonr/hway/api/did/v1"
"github.com/onsonr/hway/x/did/types"
didv1 "github.com/onsonr/sonr/api/did/v1"
"github.com/onsonr/sonr/internal/files"
"github.com/onsonr/sonr/x/did/types"
)
type msgServer struct {
@@ -31,13 +32,23 @@ func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams
return nil, ms.k.Params.Set(ctx, msg.Params)
}
// Authenticate implements types.MsgServer.
func (ms msgServer) Authenticate(ctx context.Context, msg *types.MsgAuthenticate) (*types.MsgAuthenticateResponse, error) {
// Authorize implements types.MsgServer.
func (ms msgServer) Authorize(ctx context.Context, msg *types.MsgAuthorize) (*types.MsgAuthorizeResponse, error) {
if ms.k.authority != msg.Authority {
return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, msg.Authority)
}
// ctx := sdk.UnwrapSDKContext(goCtx)
return &types.MsgAuthenticateResponse{}, nil
return &types.MsgAuthorizeResponse{}, nil
}
// AllocateVault implements types.MsgServer.
func (ms msgServer) AllocateVault(goCtx context.Context, msg *types.MsgAllocateVault) (*types.MsgAllocateVaultResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
err := files.Assemble("/tmp/sonr-testnet-1/vaults/0")
if err != nil {
return nil, err
}
return &types.MsgAllocateVaultResponse{}, nil
}
// RegisterController implements types.MsgServer.
@@ -46,26 +57,25 @@ func (ms msgServer) RegisterController(goCtx context.Context, msg *types.MsgRegi
return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, msg.Authority)
}
ctx := sdk.UnwrapSDKContext(goCtx)
svc := didv1.Service{
ControllerDid: msg.Authority,
svc := didv1.ServiceRecord{
Controller: msg.Authority,
}
ms.k.OrmDB.ServiceTable().Insert(ctx, &svc)
ms.k.OrmDB.ServiceRecordTable().Insert(ctx, &svc)
return &types.MsgRegisterControllerResponse{}, nil
}
// RegisterService implements types.MsgServer.
func (ms msgServer) RegisterService(ctx context.Context, msg *types.MsgRegisterService) (*types.MsgRegisterServiceResponse, error) {
if ms.k.authority != msg.Authority {
return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, msg.Authority)
if ms.k.authority != msg.Controller {
return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, msg.Controller)
}
// ctx := sdk.UnwrapSDKContext(goCtx)
return &types.MsgRegisterServiceResponse{}, nil
}
// ProveWitness implements types.MsgServer.
func (ms msgServer) ProveWitness(ctx context.Context, msg *types.MsgProveWitness) (*types.MsgProveWitnessResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
return &types.MsgProveWitnessResponse{}, nil
svc := didv1.ServiceRecord{
Controller: msg.Controller,
}
ms.k.OrmDB.ServiceRecordTable().Insert(ctx, &svc)
return &types.MsgRegisterServiceResponse{}, nil
}
// SyncVault implements types.MsgServer.
-55
View File
@@ -1,55 +0,0 @@
package keeper_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/onsonr/hway/x/did/types"
)
func TestParams(t *testing.T) {
f := SetupTest(t)
require := require.New(t)
testCases := []struct {
name string
request *types.MsgUpdateParams
err bool
}{
{
name: "fail; invalid authority",
request: &types.MsgUpdateParams{
Authority: f.addrs[0].String(),
Params: types.DefaultParams(),
},
err: true,
},
{
name: "success",
request: &types.MsgUpdateParams{
Authority: f.govModAddr,
Params: types.DefaultParams(),
},
err: false,
},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
_, err := f.msgServer.UpdateParams(f.ctx, tc.request)
if tc.err {
require.Error(err)
} else {
require.NoError(err)
r, err := f.queryServer.Params(f.ctx, &types.QueryParamsRequest{})
require.NoError(err)
require.EqualValues(&tc.request.Params, r.Params)
}
})
}
}
+25 -4
View File
@@ -1,9 +1,13 @@
package keeper
func (k Keeper) insertAliasFromDisplayName() {
}
import (
didv1 "github.com/onsonr/sonr/api/did/v1"
"github.com/onsonr/sonr/x/did/types"
func (k Keeper) insertAssertionFromIdentity() {
sdk "github.com/cosmos/cosmos-sdk/types"
)
func (k Keeper) convertProfileToVerification() {
}
func (k Keeper) insertAuthenticationFromCredential() {
@@ -12,5 +16,22 @@ func (k Keeper) insertAuthenticationFromCredential() {
func (k Keeper) insertControllerFromMotrVault() {
}
func (k Keeper) insertDelegationFromAccount() {
func (k Keeper) insertDelegationFromAccount(ctx sdk.Context, address string, label string) (*didv1.Delegation, error) {
del, err := k.OrmDB.DelegationTable().GetByControllerAccountLabel(ctx, address, label)
if err != nil {
return nil, err
}
return del, nil
}
func (k Keeper) insertServiceRecord(ctx sdk.Context, msg *types.MsgRegisterService) error {
record, err := msg.ExtractServiceRecord()
if err != nil {
return err
}
err = k.OrmDB.ServiceRecordTable().Insert(ctx, record)
if err != nil {
return err
}
return nil
}
+14
View File
@@ -0,0 +1,14 @@
package keeper
import sdk "github.com/cosmos/cosmos-sdk/types"
func (k Keeper) ValidServiceOrigin(ctx sdk.Context, origin string) bool {
rec, err := k.OrmDB.ServiceRecordTable().GetByOriginUri(ctx, origin)
if err != nil {
return false
}
if rec == nil {
return false
}
return true
}
+2 -2
View File
@@ -18,8 +18,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/onsonr/hway/x/did/keeper"
"github.com/onsonr/hway/x/did/types"
"github.com/onsonr/sonr/x/did/keeper"
"github.com/onsonr/sonr/x/did/types"
// this line is used by starport scaffolding # 1
)
+4 -4
View File
@@ -176,7 +176,7 @@ func init() {
func init() { proto.RegisterFile("did/v1/accounts.proto", fileDescriptor_2125a09fb14c3bc3) }
var fileDescriptor_2125a09fb14c3bc3 = []byte{
// 148 bytes of a gzipped FileDescriptorProto
// 145 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0xc9, 0x4c, 0xd1,
0x2f, 0x33, 0xd4, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f,
0xc9, 0x17, 0x62, 0x4b, 0xc9, 0x4c, 0xd1, 0x2b, 0x33, 0x54, 0xe2, 0xe1, 0xe2, 0x72, 0x2a, 0x49,
@@ -184,9 +184,9 @@ var fileDescriptor_2125a09fb14c3bc3 = []byte{
0x5e, 0x11, 0x94, 0xe7, 0x64, 0x73, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e,
0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51,
0x4a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xf9, 0x79, 0xc5, 0xf9,
0x79, 0x45, 0xfa, 0x19, 0xe5, 0x89, 0x95, 0xfa, 0x15, 0xfa, 0x20, 0x97, 0x94, 0x54, 0x16, 0xa4,
0x16, 0x27, 0xb1, 0x81, 0x1d, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x96, 0xc2, 0x4c, 0x7c,
0x9d, 0x00, 0x00, 0x00,
0x79, 0x45, 0xfa, 0x60, 0xa2, 0x42, 0x1f, 0xe4, 0x92, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36,
0xb0, 0x23, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x82, 0x7e, 0x89, 0x0a, 0x9d, 0x00, 0x00,
0x00,
}
func (m *BtcAccount) Marshal() (dAtA []byte, err error) {
+6 -4
View File
@@ -4,6 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
// this line is used by starport scaffolding # 1
@@ -26,16 +27,17 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
}
func RegisterInterfaces(registry types.InterfaceRegistry) {
//registry.RegisterImplementations(
//(*cryptotypes.PubKey)(nil),
// &PublicKey{},
//)
registry.RegisterImplementations(
(*cryptotypes.PubKey)(nil),
&PubKey{},
)
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgUpdateParams{},
&MsgRegisterController{},
&MsgRegisterService{},
&MsgAllocateVault{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
+445
View File
@@ -0,0 +1,445 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: did/v1/constants.proto
package types
import (
fmt "fmt"
proto "github.com/cosmos/gogoproto/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// AssetType defines the type of asset: native, wrapped, staking, pool, or unspecified
type AssetType int32
const (
AssetType_ASSET_TYPE_UNSPECIFIED AssetType = 0
AssetType_ASSET_TYPE_NATIVE AssetType = 1
AssetType_ASSET_TYPE_WRAPPED AssetType = 2
AssetType_ASSET_TYPE_STAKING AssetType = 3
AssetType_ASSET_TYPE_POOL AssetType = 4
AssetType_ASSET_TYPE_IBC AssetType = 5
AssetType_ASSET_TYPE_CW20 AssetType = 6
)
var AssetType_name = map[int32]string{
0: "ASSET_TYPE_UNSPECIFIED",
1: "ASSET_TYPE_NATIVE",
2: "ASSET_TYPE_WRAPPED",
3: "ASSET_TYPE_STAKING",
4: "ASSET_TYPE_POOL",
5: "ASSET_TYPE_IBC",
6: "ASSET_TYPE_CW20",
}
var AssetType_value = map[string]int32{
"ASSET_TYPE_UNSPECIFIED": 0,
"ASSET_TYPE_NATIVE": 1,
"ASSET_TYPE_WRAPPED": 2,
"ASSET_TYPE_STAKING": 3,
"ASSET_TYPE_POOL": 4,
"ASSET_TYPE_IBC": 5,
"ASSET_TYPE_CW20": 6,
}
func (x AssetType) String() string {
return proto.EnumName(AssetType_name, int32(x))
}
func (AssetType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7cc61ab03a01b9c8, []int{0}
}
// DIDNamespace define the different namespaces of DID
type DIDNamespace int32
const (
DIDNamespace_DID_NAMESPACE_UNSPECIFIED DIDNamespace = 0
DIDNamespace_DID_NAMESPACE_IPFS DIDNamespace = 1
DIDNamespace_DID_NAMESPACE_SONR DIDNamespace = 2
DIDNamespace_DID_NAMESPACE_BITCOIN DIDNamespace = 3
DIDNamespace_DID_NAMESPACE_ETHEREUM DIDNamespace = 4
DIDNamespace_DID_NAMESPACE_IBC DIDNamespace = 5
DIDNamespace_DID_NAMESPACE_WEBAUTHN DIDNamespace = 6
DIDNamespace_DID_NAMESPACE_DWN DIDNamespace = 7
DIDNamespace_DID_NAMESPACE_SERVICE DIDNamespace = 8
)
var DIDNamespace_name = map[int32]string{
0: "DID_NAMESPACE_UNSPECIFIED",
1: "DID_NAMESPACE_IPFS",
2: "DID_NAMESPACE_SONR",
3: "DID_NAMESPACE_BITCOIN",
4: "DID_NAMESPACE_ETHEREUM",
5: "DID_NAMESPACE_IBC",
6: "DID_NAMESPACE_WEBAUTHN",
7: "DID_NAMESPACE_DWN",
8: "DID_NAMESPACE_SERVICE",
}
var DIDNamespace_value = map[string]int32{
"DID_NAMESPACE_UNSPECIFIED": 0,
"DID_NAMESPACE_IPFS": 1,
"DID_NAMESPACE_SONR": 2,
"DID_NAMESPACE_BITCOIN": 3,
"DID_NAMESPACE_ETHEREUM": 4,
"DID_NAMESPACE_IBC": 5,
"DID_NAMESPACE_WEBAUTHN": 6,
"DID_NAMESPACE_DWN": 7,
"DID_NAMESPACE_SERVICE": 8,
}
func (x DIDNamespace) String() string {
return proto.EnumName(DIDNamespace_name, int32(x))
}
func (DIDNamespace) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7cc61ab03a01b9c8, []int{1}
}
// KeyAlgorithm defines the key algorithm
type KeyAlgorithm int32
const (
KeyAlgorithm_KEY_ALGORITHM_UNSPECIFIED KeyAlgorithm = 0
KeyAlgorithm_KEY_ALGORITHM_ES256 KeyAlgorithm = 1
KeyAlgorithm_KEY_ALGORITHM_ES384 KeyAlgorithm = 2
KeyAlgorithm_KEY_ALGORITHM_ES512 KeyAlgorithm = 3
KeyAlgorithm_KEY_ALGORITHM_EDDSA KeyAlgorithm = 4
KeyAlgorithm_KEY_ALGORITHM_ES256K KeyAlgorithm = 5
KeyAlgorithm_KEY_ALGORITHM_BLS12377 KeyAlgorithm = 6
KeyAlgorithm_KEY_ALGORITHM_KECCAK256 KeyAlgorithm = 7
)
var KeyAlgorithm_name = map[int32]string{
0: "KEY_ALGORITHM_UNSPECIFIED",
1: "KEY_ALGORITHM_ES256",
2: "KEY_ALGORITHM_ES384",
3: "KEY_ALGORITHM_ES512",
4: "KEY_ALGORITHM_EDDSA",
5: "KEY_ALGORITHM_ES256K",
6: "KEY_ALGORITHM_BLS12377",
7: "KEY_ALGORITHM_KECCAK256",
}
var KeyAlgorithm_value = map[string]int32{
"KEY_ALGORITHM_UNSPECIFIED": 0,
"KEY_ALGORITHM_ES256": 1,
"KEY_ALGORITHM_ES384": 2,
"KEY_ALGORITHM_ES512": 3,
"KEY_ALGORITHM_EDDSA": 4,
"KEY_ALGORITHM_ES256K": 5,
"KEY_ALGORITHM_BLS12377": 6,
"KEY_ALGORITHM_KECCAK256": 7,
}
func (x KeyAlgorithm) String() string {
return proto.EnumName(KeyAlgorithm_name, int32(x))
}
func (KeyAlgorithm) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7cc61ab03a01b9c8, []int{2}
}
// KeyCurve defines the key curve
type KeyCurve int32
const (
KeyCurve_KEY_CURVE_UNSPECIFIED KeyCurve = 0
KeyCurve_KEY_CURVE_P256 KeyCurve = 1
KeyCurve_KEY_CURVE_P384 KeyCurve = 2
KeyCurve_KEY_CURVE_P521 KeyCurve = 3
KeyCurve_KEY_CURVE_X25519 KeyCurve = 4
KeyCurve_KEY_CURVE_X448 KeyCurve = 5
KeyCurve_KEY_CURVE_ED25519 KeyCurve = 6
KeyCurve_KEY_CURVE_ED448 KeyCurve = 7
KeyCurve_KEY_CURVE_SECP256K1 KeyCurve = 8
)
var KeyCurve_name = map[int32]string{
0: "KEY_CURVE_UNSPECIFIED",
1: "KEY_CURVE_P256",
2: "KEY_CURVE_P384",
3: "KEY_CURVE_P521",
4: "KEY_CURVE_X25519",
5: "KEY_CURVE_X448",
6: "KEY_CURVE_ED25519",
7: "KEY_CURVE_ED448",
8: "KEY_CURVE_SECP256K1",
}
var KeyCurve_value = map[string]int32{
"KEY_CURVE_UNSPECIFIED": 0,
"KEY_CURVE_P256": 1,
"KEY_CURVE_P384": 2,
"KEY_CURVE_P521": 3,
"KEY_CURVE_X25519": 4,
"KEY_CURVE_X448": 5,
"KEY_CURVE_ED25519": 6,
"KEY_CURVE_ED448": 7,
"KEY_CURVE_SECP256K1": 8,
}
func (x KeyCurve) String() string {
return proto.EnumName(KeyCurve_name, int32(x))
}
func (KeyCurve) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7cc61ab03a01b9c8, []int{3}
}
// KeyEncoding defines the key encoding
type KeyEncoding int32
const (
KeyEncoding_KEY_ENCODING_UNSPECIFIED KeyEncoding = 0
KeyEncoding_KEY_ENCODING_RAW KeyEncoding = 1
KeyEncoding_KEY_ENCODING_HEX KeyEncoding = 2
KeyEncoding_KEY_ENCODING_MULTIBASE KeyEncoding = 3
KeyEncoding_KEY_ENCODING_JWK KeyEncoding = 4
)
var KeyEncoding_name = map[int32]string{
0: "KEY_ENCODING_UNSPECIFIED",
1: "KEY_ENCODING_RAW",
2: "KEY_ENCODING_HEX",
3: "KEY_ENCODING_MULTIBASE",
4: "KEY_ENCODING_JWK",
}
var KeyEncoding_value = map[string]int32{
"KEY_ENCODING_UNSPECIFIED": 0,
"KEY_ENCODING_RAW": 1,
"KEY_ENCODING_HEX": 2,
"KEY_ENCODING_MULTIBASE": 3,
"KEY_ENCODING_JWK": 4,
}
func (x KeyEncoding) String() string {
return proto.EnumName(KeyEncoding_name, int32(x))
}
func (KeyEncoding) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7cc61ab03a01b9c8, []int{4}
}
// KeyRole defines the kind of key
type KeyRole int32
const (
KeyRole_KEY_ROLE_UNSPECIFIED KeyRole = 0
// Blockchain key types
KeyRole_KEY_ROLE_AUTHENTICATION KeyRole = 1
KeyRole_KEY_ROLE_ASSERTION KeyRole = 2
KeyRole_KEY_ROLE_DELEGATION KeyRole = 3
KeyRole_KEY_ROLE_INVOCATION KeyRole = 4
)
var KeyRole_name = map[int32]string{
0: "KEY_ROLE_UNSPECIFIED",
1: "KEY_ROLE_AUTHENTICATION",
2: "KEY_ROLE_ASSERTION",
3: "KEY_ROLE_DELEGATION",
4: "KEY_ROLE_INVOCATION",
}
var KeyRole_value = map[string]int32{
"KEY_ROLE_UNSPECIFIED": 0,
"KEY_ROLE_AUTHENTICATION": 1,
"KEY_ROLE_ASSERTION": 2,
"KEY_ROLE_DELEGATION": 3,
"KEY_ROLE_INVOCATION": 4,
}
func (x KeyRole) String() string {
return proto.EnumName(KeyRole_name, int32(x))
}
func (KeyRole) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7cc61ab03a01b9c8, []int{5}
}
// KeyType defines the key type
type KeyType int32
const (
KeyType_KEY_TYPE_UNSPECIFIED KeyType = 0
KeyType_KEY_TYPE_OCTET KeyType = 1
KeyType_KEY_TYPE_ELLIPTIC KeyType = 2
KeyType_KEY_TYPE_RSA KeyType = 3
KeyType_KEY_TYPE_SYMMETRIC KeyType = 4
KeyType_KEY_TYPE_HMAC KeyType = 5
)
var KeyType_name = map[int32]string{
0: "KEY_TYPE_UNSPECIFIED",
1: "KEY_TYPE_OCTET",
2: "KEY_TYPE_ELLIPTIC",
3: "KEY_TYPE_RSA",
4: "KEY_TYPE_SYMMETRIC",
5: "KEY_TYPE_HMAC",
}
var KeyType_value = map[string]int32{
"KEY_TYPE_UNSPECIFIED": 0,
"KEY_TYPE_OCTET": 1,
"KEY_TYPE_ELLIPTIC": 2,
"KEY_TYPE_RSA": 3,
"KEY_TYPE_SYMMETRIC": 4,
"KEY_TYPE_HMAC": 5,
}
func (x KeyType) String() string {
return proto.EnumName(KeyType_name, int32(x))
}
func (KeyType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7cc61ab03a01b9c8, []int{6}
}
// PermissionScope define the Capabilities Controllers can grant for Services
type PermissionScope int32
const (
PermissionScope_PERMISSION_SCOPE_UNSPECIFIED PermissionScope = 0
PermissionScope_PERMISSION_SCOPE_BASIC_INFO PermissionScope = 1
PermissionScope_PERMISSION_SCOPE_RECORDS_READ PermissionScope = 2
PermissionScope_PERMISSION_SCOPE_RECORDS_WRITE PermissionScope = 3
PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_READ PermissionScope = 4
PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_WRITE PermissionScope = 5
PermissionScope_PERMISSION_SCOPE_WALLETS_READ PermissionScope = 6
PermissionScope_PERMISSION_SCOPE_WALLETS_CREATE PermissionScope = 7
PermissionScope_PERMISSION_SCOPE_WALLETS_SUBSCRIBE PermissionScope = 8
PermissionScope_PERMISSION_SCOPE_WALLETS_UPDATE PermissionScope = 9
PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_VERIFY PermissionScope = 10
PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_BROADCAST PermissionScope = 11
PermissionScope_PERMISSION_SCOPE_ADMIN_USER PermissionScope = 12
PermissionScope_PERMISSION_SCOPE_ADMIN_VALIDATOR PermissionScope = 13
)
var PermissionScope_name = map[int32]string{
0: "PERMISSION_SCOPE_UNSPECIFIED",
1: "PERMISSION_SCOPE_BASIC_INFO",
2: "PERMISSION_SCOPE_RECORDS_READ",
3: "PERMISSION_SCOPE_RECORDS_WRITE",
4: "PERMISSION_SCOPE_TRANSACTIONS_READ",
5: "PERMISSION_SCOPE_TRANSACTIONS_WRITE",
6: "PERMISSION_SCOPE_WALLETS_READ",
7: "PERMISSION_SCOPE_WALLETS_CREATE",
8: "PERMISSION_SCOPE_WALLETS_SUBSCRIBE",
9: "PERMISSION_SCOPE_WALLETS_UPDATE",
10: "PERMISSION_SCOPE_TRANSACTIONS_VERIFY",
11: "PERMISSION_SCOPE_TRANSACTIONS_BROADCAST",
12: "PERMISSION_SCOPE_ADMIN_USER",
13: "PERMISSION_SCOPE_ADMIN_VALIDATOR",
}
var PermissionScope_value = map[string]int32{
"PERMISSION_SCOPE_UNSPECIFIED": 0,
"PERMISSION_SCOPE_BASIC_INFO": 1,
"PERMISSION_SCOPE_RECORDS_READ": 2,
"PERMISSION_SCOPE_RECORDS_WRITE": 3,
"PERMISSION_SCOPE_TRANSACTIONS_READ": 4,
"PERMISSION_SCOPE_TRANSACTIONS_WRITE": 5,
"PERMISSION_SCOPE_WALLETS_READ": 6,
"PERMISSION_SCOPE_WALLETS_CREATE": 7,
"PERMISSION_SCOPE_WALLETS_SUBSCRIBE": 8,
"PERMISSION_SCOPE_WALLETS_UPDATE": 9,
"PERMISSION_SCOPE_TRANSACTIONS_VERIFY": 10,
"PERMISSION_SCOPE_TRANSACTIONS_BROADCAST": 11,
"PERMISSION_SCOPE_ADMIN_USER": 12,
"PERMISSION_SCOPE_ADMIN_VALIDATOR": 13,
}
func (x PermissionScope) String() string {
return proto.EnumName(PermissionScope_name, int32(x))
}
func (PermissionScope) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_7cc61ab03a01b9c8, []int{7}
}
func init() {
proto.RegisterEnum("did.v1.AssetType", AssetType_name, AssetType_value)
proto.RegisterEnum("did.v1.DIDNamespace", DIDNamespace_name, DIDNamespace_value)
proto.RegisterEnum("did.v1.KeyAlgorithm", KeyAlgorithm_name, KeyAlgorithm_value)
proto.RegisterEnum("did.v1.KeyCurve", KeyCurve_name, KeyCurve_value)
proto.RegisterEnum("did.v1.KeyEncoding", KeyEncoding_name, KeyEncoding_value)
proto.RegisterEnum("did.v1.KeyRole", KeyRole_name, KeyRole_value)
proto.RegisterEnum("did.v1.KeyType", KeyType_name, KeyType_value)
proto.RegisterEnum("did.v1.PermissionScope", PermissionScope_name, PermissionScope_value)
}
func init() { proto.RegisterFile("did/v1/constants.proto", fileDescriptor_7cc61ab03a01b9c8) }
var fileDescriptor_7cc61ab03a01b9c8 = []byte{
// 902 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x95, 0xdf, 0x72, 0xda, 0x46,
0x14, 0xc6, 0x2d, 0x83, 0xb1, 0xb3, 0x71, 0x92, 0x93, 0x4d, 0xe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b0, 0x89, 0x49, 0x55, 0x4d, 0xc5, 0xa5, 0x30, 0x11,
0xb6, 0xae, 0x2d, 0x56, 0xf5, 0xad, 0xa8, 0xd8, 0x0d, 0xfa, 0x35, 0x79, 0x7d, 0x7d, 0xfa, 0x1a,
0x4a, 0x71, 0x70, 0x04, 0x84, 0x7e, 0x43, 0xde, 0x5c, 0xef, 0x34, 0xa5, 0xc7, 0x2c, 0xce, 0x94,
0x86, 0x9b, 0x2b, 0x97, 0xc4, 0xac, 0x8a, 0x70, 0x1b, 0x55, 0x85, 0x12, 0xb6, 0xe9, 0x6b, 0xf2,
0xe2, 0x0a, 0x43, 0x8d, 0x39, 0xc2, 0x62, 0xda, 0x93, 0x70, 0xcb, 0xfc, 0xe1, 0xaf, 0x8b, 0xac,
0x71, 0x7e, 0x91, 0x35, 0xfe, 0xb9, 0xc8, 0x1a, 0xbf, 0x5f, 0x66, 0xd7, 0xce, 0x2f, 0xb3, 0x6b,
0x7f, 0x5f, 0x66, 0xd7, 0x7e, 0x7a, 0x79, 0xd2, 0x1e, 0x7c, 0xfc, 0xfc, 0x61, 0xb7, 0x19, 0x9e,
0xe6, 0xc3, 0x4e, 0x3f, 0xec, 0xf4, 0xf2, 0xa3, 0x9f, 0x9f, 0xf3, 0xd1, 0x07, 0x78, 0x30, 0xec,
0x06, 0xfd, 0x0f, 0x99, 0xd1, 0xa7, 0x77, 0xef, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x40, 0x58,
0x91, 0x1e, 0x94, 0x07, 0x00, 0x00,
}
+109
View File
@@ -0,0 +1,109 @@
package types
// DefaultAssets returns the default asset infos: BTC, ETH, SNR, and USDC
func DefaultAssets() []*AssetInfo {
return []*AssetInfo{
{
Name: "Bitcoin",
Symbol: "BTC",
Hrp: "bc",
Index: 0,
AssetType: AssetType_ASSET_TYPE_NATIVE,
IconUrl: "https://cdn.sonr.land/BTC.svg",
},
{
Name: "Ethereum",
Symbol: "ETH",
Hrp: "eth",
Index: 64,
AssetType: AssetType_ASSET_TYPE_NATIVE,
IconUrl: "https://cdn.sonr.land/ETH.svg",
},
{
Name: "Sonr",
Symbol: "SNR",
Hrp: "idx",
Index: 703,
AssetType: AssetType_ASSET_TYPE_NATIVE,
IconUrl: "https://cdn.sonr.land/SNR.svg",
},
}
}
// DefaultChains returns the default chain infos: Bitcoin, Ethereum, and Sonr.
func DefaultChains() []*ChainInfo {
return []*ChainInfo{}
}
// DefaultKeyInfos returns the default key infos: secp256k1, ed25519, keccak256, and bls12377.
func DefaultKeyInfos() []*KeyInfo {
return []*KeyInfo{
//
// Identity Key Info
//
// Sonr Controller Key Info
{
Role: KeyRole_KEY_ROLE_INVOCATION,
Algorithm: KeyAlgorithm_KEY_ALGORITHM_ES256K,
Encoding: KeyEncoding_KEY_ENCODING_HEX,
},
{
Role: KeyRole_KEY_ROLE_ASSERTION,
Algorithm: KeyAlgorithm_KEY_ALGORITHM_BLS12377,
Encoding: KeyEncoding_KEY_ENCODING_MULTIBASE,
},
//
// Blockchain Key Info
//
// Ethereum Key Info
{
Role: KeyRole_KEY_ROLE_DELEGATION,
Algorithm: KeyAlgorithm_KEY_ALGORITHM_KECCAK256,
Encoding: KeyEncoding_KEY_ENCODING_HEX,
},
// Bitcoin Key Info
{
Role: KeyRole_KEY_ROLE_DELEGATION,
Algorithm: KeyAlgorithm_KEY_ALGORITHM_ES256K,
Encoding: KeyEncoding_KEY_ENCODING_HEX,
},
//
// Authentication Key Info
//
// Browser based WebAuthn
{
Role: KeyRole_KEY_ROLE_AUTHENTICATION,
Algorithm: KeyAlgorithm_KEY_ALGORITHM_ES256,
Encoding: KeyEncoding_KEY_ENCODING_RAW,
},
// FIDO U2F
{
Role: KeyRole_KEY_ROLE_AUTHENTICATION,
Algorithm: KeyAlgorithm_KEY_ALGORITHM_ES256K,
Encoding: KeyEncoding_KEY_ENCODING_RAW,
},
// Cross-Platform Passkeys
{
Role: KeyRole_KEY_ROLE_AUTHENTICATION,
Algorithm: KeyAlgorithm_KEY_ALGORITHM_EDDSA,
Encoding: KeyEncoding_KEY_ENCODING_RAW,
},
}
}
func DefaultOpenIDConfig() *OpenIDConfig {
return &OpenIDConfig{
Issuer: "https://sonr.id",
AuthorizationEndpoint: "https://api.sonr.id/auth",
TokenEndpoint: "https://api.sonr.id/token",
UserinfoEndpoint: "https://api.sonr.id/userinfo",
ScopesSupported: []string{"openid", "profile", "email", "web3", "sonr"},
ResponseTypesSupported: []string{"code"},
ResponseModesSupported: []string{"query", "form_post"},
GrantTypesSupported: []string{"authorization_code", "refresh_token"},
AcrValuesSupported: []string{"passkey"},
SubjectTypesSupported: []string{"public"},
}
}
@@ -11,7 +11,7 @@ import (
// VerifySignature verifies the signature of a message
func VerifySignature(key []byte, msg []byte, sig []byte) bool {
pp, err := BuildEcPoint(key)
pp, err := buildEcPoint(key)
if err != nil {
return false
}
@@ -29,7 +29,7 @@ func VerifySignature(key []byte, msg []byte, sig []byte) bool {
}
// BuildEcPoint builds an elliptic curve point from a compressed byte slice
func BuildEcPoint(pubKey []byte) (*curves.EcPoint, error) {
func buildEcPoint(pubKey []byte) (*curves.EcPoint, error) {
crv := curves.K256()
x := new(big.Int).SetBytes(pubKey[1:33])
y := new(big.Int).SetBytes(pubKey[33:])
-120
View File
@@ -1,120 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: did/v1/enums.proto
package types
import (
fmt "fmt"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// PermissionScope define the Capabilities Controllers can grant for Services
type PermissionScope int32
const (
PermissionScope_PERMISSION_SCOPE_UNSPECIFIED PermissionScope = 0
PermissionScope_PERMISSION_SCOPE_PROFILE_NAME PermissionScope = 1
PermissionScope_PERMISSION_SCOPE_IDENTIFIERS_EMAIL PermissionScope = 2
PermissionScope_PERMISSION_SCOPE_IDENTIFIERS_PHONE PermissionScope = 3
PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_READ PermissionScope = 4
PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_WRITE PermissionScope = 5
PermissionScope_PERMISSION_SCOPE_WALLETS_READ PermissionScope = 6
PermissionScope_PERMISSION_SCOPE_WALLETS_CREATE PermissionScope = 7
PermissionScope_PERMISSION_SCOPE_WALLETS_SUBSCRIBE PermissionScope = 8
PermissionScope_PERMISSION_SCOPE_WALLETS_UPDATE PermissionScope = 9
PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_VERIFY PermissionScope = 10
PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_BROADCAST PermissionScope = 11
PermissionScope_PERMISSION_SCOPE_ADMIN_USER PermissionScope = 12
PermissionScope_PERMISSION_SCOPE_ADMIN_VALIDATOR PermissionScope = 13
)
var PermissionScope_name = map[int32]string{
0: "PERMISSION_SCOPE_UNSPECIFIED",
1: "PERMISSION_SCOPE_PROFILE_NAME",
2: "PERMISSION_SCOPE_IDENTIFIERS_EMAIL",
3: "PERMISSION_SCOPE_IDENTIFIERS_PHONE",
4: "PERMISSION_SCOPE_TRANSACTIONS_READ",
5: "PERMISSION_SCOPE_TRANSACTIONS_WRITE",
6: "PERMISSION_SCOPE_WALLETS_READ",
7: "PERMISSION_SCOPE_WALLETS_CREATE",
8: "PERMISSION_SCOPE_WALLETS_SUBSCRIBE",
9: "PERMISSION_SCOPE_WALLETS_UPDATE",
10: "PERMISSION_SCOPE_TRANSACTIONS_VERIFY",
11: "PERMISSION_SCOPE_TRANSACTIONS_BROADCAST",
12: "PERMISSION_SCOPE_ADMIN_USER",
13: "PERMISSION_SCOPE_ADMIN_VALIDATOR",
}
var PermissionScope_value = map[string]int32{
"PERMISSION_SCOPE_UNSPECIFIED": 0,
"PERMISSION_SCOPE_PROFILE_NAME": 1,
"PERMISSION_SCOPE_IDENTIFIERS_EMAIL": 2,
"PERMISSION_SCOPE_IDENTIFIERS_PHONE": 3,
"PERMISSION_SCOPE_TRANSACTIONS_READ": 4,
"PERMISSION_SCOPE_TRANSACTIONS_WRITE": 5,
"PERMISSION_SCOPE_WALLETS_READ": 6,
"PERMISSION_SCOPE_WALLETS_CREATE": 7,
"PERMISSION_SCOPE_WALLETS_SUBSCRIBE": 8,
"PERMISSION_SCOPE_WALLETS_UPDATE": 9,
"PERMISSION_SCOPE_TRANSACTIONS_VERIFY": 10,
"PERMISSION_SCOPE_TRANSACTIONS_BROADCAST": 11,
"PERMISSION_SCOPE_ADMIN_USER": 12,
"PERMISSION_SCOPE_ADMIN_VALIDATOR": 13,
}
func (x PermissionScope) String() string {
return proto.EnumName(PermissionScope_name, int32(x))
}
func (PermissionScope) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_001c58538597e328, []int{0}
}
func init() {
proto.RegisterEnum("did.v1.PermissionScope", PermissionScope_name, PermissionScope_value)
}
func init() { proto.RegisterFile("did/v1/enums.proto", fileDescriptor_001c58538597e328) }
var fileDescriptor_001c58538597e328 = []byte{
// 388 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0xd2, 0xc1, 0x6e, 0xd3, 0x30,
0x18, 0x07, 0xf0, 0x04, 0x46, 0x01, 0x03, 0xc2, 0x58, 0x9c, 0x06, 0x64, 0x63, 0x9b, 0x18, 0x02,
0xa9, 0xd6, 0xc4, 0x95, 0x8b, 0x93, 0x7c, 0x15, 0x96, 0x12, 0x27, 0xb2, 0x9d, 0x4d, 0x70, 0x89,
0xd6, 0x26, 0x6a, 0x73, 0x48, 0x5c, 0x35, 0x6d, 0xa1, 0x6f, 0xc1, 0x73, 0xf0, 0x24, 0x1c, 0x7b,
0xe4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0x17, 0xfb, 0x87, 0x54, 0xe2, 0x2a, 0x4f,
0x72, 0x17, 0xf0, 0x83, 0xd6, 0xb0, 0x24, 0xf6, 0x9b, 0xb0, 0x87, 0xe4, 0x2d, 0xba, 0x68, 0xdf,
0xfe, 0x1a, 0x24, 0xef, 0x7d, 0xc6, 0x88, 0xbc, 0x47, 0x97, 0xed, 0xd2, 0x95, 0x11, 0xf3, 0x3d,
0xa6, 0x34, 0x7e, 0x44, 0x4e, 0xd0, 0x8b, 0x1d, 0xcc, 0xfc, 0x90, 0x8b, 0x34, 0x51, 0x20, 0xf1,
0x63, 0x72, 0x81, 0x4e, 0x0f, 0x80, 0x6b, 0x16, 0x70, 0x9f, 0xe9, 0x48, 0xe2, 0x27, 0xee, 0xc7,
0x9f, 0x2b, 0xc7, 0x5e, 0xae, 0x1c, 0xfb, 0xf7, 0xca, 0xb1, 0xbf, 0xaf, 0x1d, 0x6b, 0xb9, 0x76,
0xac, 0x5f, 0x6b, 0xc7, 0xfa, 0x72, 0x36, 0x2c, 0xa6, 0xa3, 0x59, 0xbf, 0x3b, 0x30, 0x25, 0x35,
0x55, 0x6d, 0xaa, 0x09, 0x1d, 0x7d, 0xbd, 0x5d, 0xd0, 0x6f, 0xb4, 0x29, 0xe9, 0x74, 0x31, 0xce,
0xeb, 0x7e, 0x67, 0xd3, 0xb8, 0x0f, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9e, 0x1a, 0xa8, 0xd9,
0xb8, 0x02, 0x00, 0x00,
}
+1
View File
@@ -12,4 +12,5 @@ var (
ErrMinimumAssertions = sdkerrors.Register(ModuleName, 300, "at least one assertion is required for account initialization")
ErrInvalidControllers = sdkerrors.Register(ModuleName, 301, "no more than one controller can be used for account initialization")
ErrMaximumAuthenticators = sdkerrors.Register(ModuleName, 302, "more authenticators provided than the total accepted count")
ErrUnsupportedKeyEncoding = sdkerrors.Register(ModuleName, 400, "unsupported key encoding")
)
+18
View File
@@ -0,0 +1,18 @@
package types
import didv1 "github.com/onsonr/sonr/api/did/v1"
func (m *MsgRegisterService) ExtractServiceRecord() (*didv1.ServiceRecord, error) {
return &didv1.ServiceRecord{
Controller: m.Controller,
OriginUri: m.OriginUri,
Description: m.Description,
}, nil
}
func convertPermissions(permissions *Permissions) *didv1.Permissions {
if permissions == nil {
return nil
}
return &didv1.Permissions{}
}
+6 -1
View File
@@ -25,7 +25,12 @@ func (gs GenesisState) Validate() error {
// DefaultParams returns default module parameters.
func DefaultParams() Params {
return Params{}
return Params{
WhitelistedAssets: DefaultAssets(),
WhitelistedChains: DefaultChains(),
AllowedPublicKeys: DefaultKeyInfos(),
OpenidConfig: DefaultOpenIDConfig(),
}
}
// Stringer method for Params.
+1700 -1103
View File
File diff suppressed because it is too large Load Diff
+1 -9
View File
@@ -3,7 +3,7 @@ package types_test
import (
"testing"
"github.com/onsonr/hway/x/did/types"
"github.com/onsonr/sonr/x/did/types"
"github.com/stretchr/testify/require"
)
@@ -19,14 +19,6 @@ func TestGenesisState_Validate(t *testing.T) {
genState: types.DefaultGenesis(),
valid: true,
},
{
desc: "valid genesis state",
genState: &types.GenesisState{
// this line is used by starport scaffolding # types/genesis/validField
},
valid: true,
},
// this line is used by starport scaffolding # types/genesis/testcase
}
for _, tc := range tests {
+89
View File
@@ -0,0 +1,89 @@
package types
import (
"encoding/hex"
"github.com/mr-tron/base58/base58"
)
//
// # Genesis Structures
//
// Equal returns true if two asset infos are equal
func (a *AssetInfo) Equal(b *AssetInfo) bool {
if a == nil && b == nil {
return true
}
return false
}
// Equal returns true if two chain infos are equal
func (c *ChainInfo) Equal(b *ChainInfo) bool {
if c == nil && b == nil {
return true
}
return false
}
// Equal returns true if two OpenID config infos are equal
func (o *OpenIDConfig) Equal(b *OpenIDConfig) bool {
if o == nil && b == nil {
return true
}
return false
}
// Equal returns true if two key infos are equal
func (k *KeyInfo) Equal(b *KeyInfo) bool {
if k == nil && b == nil {
return true
}
return false
}
// Equal returns true if two validator infos are equal
func (v *ValidatorInfo) Equal(b *ValidatorInfo) bool {
if v == nil && b == nil {
return true
}
return false
}
// DecodePublicKey extracts the public key from the given data
func (k *KeyInfo) DecodePublicKey(data interface{}) ([]byte, error) {
var bz []byte
switch v := data.(type) {
case string:
bz = []byte(v)
case []byte:
bz = v
default:
return nil, ErrUnsupportedKeyEncoding
}
if k.Encoding == KeyEncoding_KEY_ENCODING_RAW {
return bz, nil
}
if k.Encoding == KeyEncoding_KEY_ENCODING_HEX {
return hex.DecodeString(string(bz))
}
if k.Encoding == KeyEncoding_KEY_ENCODING_MULTIBASE {
return base58.Decode(string(bz))
}
return nil, ErrUnsupportedKeyEncoding
}
// EncodePublicKey encodes the public key according to the KeyInfo's encoding
func (k *KeyInfo) EncodePublicKey(data []byte) (string, error) {
if k.Encoding == KeyEncoding_KEY_ENCODING_RAW {
return string(data), nil
}
if k.Encoding == KeyEncoding_KEY_ENCODING_HEX {
return hex.EncodeToString(data), nil
}
if k.Encoding == KeyEncoding_KEY_ENCODING_MULTIBASE {
return base58.Encode(data), nil
}
return "", ErrUnsupportedKeyEncoding
}
+1676 -478
View File
File diff suppressed because it is too large Load Diff
+39 -4
View File
@@ -65,7 +65,7 @@ func NewMsgRegisterController(
func (msg MsgRegisterController) Route() string { return ModuleName }
// Type returns the the action
func (msg MsgRegisterController) Type() string { return "initialize_controller" }
func (msg MsgRegisterController) Type() string { return "register_controller" }
// GetSignBytes implements the LegacyMsg interface.
func (msg MsgRegisterController) GetSignBytes() []byte {
@@ -92,7 +92,7 @@ func NewMsgRegisterService(
sender sdk.Address,
) (*MsgRegisterService, error) {
return &MsgRegisterService{
Authority: sender.String(),
Controller: sender.String(),
}, nil
}
@@ -100,7 +100,7 @@ func NewMsgRegisterService(
func (msg MsgRegisterService) Route() string { return ModuleName }
// Type returns the the action
func (msg MsgRegisterService) Type() string { return "initialize_controller" }
func (msg MsgRegisterService) Type() string { return "register_service" }
// GetSignBytes implements the LegacyMsg interface.
func (msg MsgRegisterService) GetSignBytes() []byte {
@@ -109,7 +109,7 @@ func (msg MsgRegisterService) GetSignBytes() []byte {
// GetSigners returns the expected signers for a MsgUpdateParams message.
func (msg *MsgRegisterService) GetSigners() []sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
addr, _ := sdk.AccAddressFromBech32(msg.Controller)
return []sdk.AccAddress{addr}
}
@@ -117,3 +117,38 @@ func (msg *MsgRegisterService) GetSigners() []sdk.AccAddress {
func (msg *MsgRegisterService) Validate() error {
return nil
}
//
// [AllocateVault]
//
// NewMsgAllocateVault creates a new instance of MsgAllocateVault
func NewMsgAllocateVault(
sender sdk.Address,
) (*MsgAllocateVault, error) {
return &MsgAllocateVault{
Authority: sender.String(),
}, nil
}
// Route returns the name of the module
func (msg MsgAllocateVault) Route() string { return ModuleName }
// Type returns the the action
func (msg MsgAllocateVault) Type() string { return "allocate_vault" }
// GetSignBytes implements the LegacyMsg interface.
func (msg MsgAllocateVault) GetSignBytes() []byte {
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
}
// GetSigners returns the expected signers for a MsgUpdateParams message.
func (msg *MsgAllocateVault) GetSigners() []sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
return []sdk.AccAddress{addr}
}
// Vaalidate does a sanity check on the provided data.
func (msg *MsgAllocateVault) Validate() error {
return nil
}
+27
View File
@@ -0,0 +1,27 @@
package types
// DiscoveryDocument represents the OIDC discovery document.
type DiscoveryDocument struct {
Issuer string `json:"issuer"`
AuthorizationEndpoint string `json:"authorization_endpoint"`
TokenEndpoint string `json:"token_endpoint"`
UserinfoEndpoint string `json:"userinfo_endpoint"`
JwksURI string `json:"jwks_uri"`
RegistrationEndpoint string `json:"registration_endpoint"`
ScopesSupported []string `json:"scopes_supported"`
ResponseTypesSupported []string `json:"response_types_supported"`
SubjectTypesSupported []string `json:"subject_types_supported"`
IDTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported"`
ClaimsSupported []string `json:"claims_supported"`
GrantTypesSupported []string `json:"grant_types_supported"`
TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
}
// UserInfo represents the user information.
type UserInfo struct {
DID string `json:"did"`
Sub string `json:"sub"`
Name string `json:"name"`
Email string `json:"email"`
// Add other claims as needed
}
+3 -3
View File
@@ -21,9 +21,9 @@ var (
StringToPermissionScope = map[string]PermissionScope{
"PERMISSION_SCOPE_UNSPECIFIED": PermissionScope_PERMISSION_SCOPE_UNSPECIFIED,
"PERMISSION_SCOPE_PROFILE_NAME": PermissionScope_PERMISSION_SCOPE_PROFILE_NAME,
"PERMISSION_SCOPE_IDENTIFIERS_EMAIL": PermissionScope_PERMISSION_SCOPE_IDENTIFIERS_EMAIL,
"PERMISSION_SCOPE_IDENTIFIERS_PHONE": PermissionScope_PERMISSION_SCOPE_IDENTIFIERS_PHONE,
"PERMISSION_SCOPE_BASIC_INFO": PermissionScope_PERMISSION_SCOPE_BASIC_INFO,
"PERMISSION_SCOPE_IDENTIFIERS_EMAIL": PermissionScope_PERMISSION_SCOPE_RECORDS_READ,
"PERMISSION_SCOPE_IDENTIFIERS_PHONE": PermissionScope_PERMISSION_SCOPE_RECORDS_WRITE,
"PERMISSION_SCOPE_TRANSACTIONS_READ": PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_READ,
"PERMISSION_SCOPE_TRANSACTIONS_WRITE": PermissionScope_PERMISSION_SCOPE_TRANSACTIONS_WRITE,
"PERMISSION_SCOPE_WALLETS_READ": PermissionScope_PERMISSION_SCOPE_WALLETS_READ,
+40
View File
@@ -0,0 +1,40 @@
package types
import (
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
)
// NewEthPublicKey returns a new ethereum public key
func NewPublicKey(data []byte, keyInfo *KeyInfo) (*PubKey, error) {
return &PubKey{
Role: keyInfo.Role,
}, nil
}
// Address returns the address of the public key
func (k *PubKey) Address() cryptotypes.Address {
return nil
}
// Bytes returns the raw bytes of the public key
func (k *PubKey) Bytes() []byte {
return k.GetRaw()
}
// VerifySignature verifies a signature over the given message
func (k *PubKey) VerifySignature(msg []byte, sig []byte) bool {
return false
}
// Equals returns true if two public keys are equal
func (k *PubKey) Equals(k2 cryptotypes.PubKey) bool {
if k == nil && k2 == nil {
return true
}
return false
}
// Type returns the type of the public key
func (k *PubKey) Type() string {
return ""
}
+735 -1286
View File
File diff suppressed because it is too large Load Diff
+206 -134
View File
@@ -33,26 +33,48 @@ var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
var _ = metadata.Join
var (
filter_Query_Params_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
var protoReq QueryRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Params_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryParamsRequest
var protoReq QueryRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Params_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Params(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_Accounts_0 = &utilities.DoubleArray{Encoding: map[string]int{"did": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
func request_Query_Accounts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAccountsRequest
var protoReq QueryRequest
var metadata runtime.ServerMetadata
var (
@@ -73,13 +95,20 @@ func request_Query_Accounts_0(ctx context.Context, marshaler runtime.Marshaler,
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Accounts_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Accounts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Accounts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryAccountsRequest
var protoReq QueryRequest
var metadata runtime.ServerMetadata
var (
@@ -100,13 +129,24 @@ func local_request_Query_Accounts_0(ctx context.Context, marshaler runtime.Marsh
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Accounts_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Accounts(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_Credentials_0 = &utilities.DoubleArray{Encoding: map[string]int{"origin": 0, "subject": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
)
func request_Query_Credentials_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryCredentialsRequest
var protoReq QueryRequest
var metadata runtime.ServerMetadata
var (
@@ -116,17 +156,6 @@ func request_Query_Credentials_0(ctx context.Context, marshaler runtime.Marshale
_ = err
)
val, ok = pathParams["did"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "did")
}
protoReq.Did, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
val, ok = pathParams["origin"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "origin")
@@ -138,13 +167,31 @@ func request_Query_Credentials_0(ctx context.Context, marshaler runtime.Marshale
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "origin", err)
}
val, ok = pathParams["subject"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject")
}
protoReq.Subject, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Credentials_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Credentials(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Credentials_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryCredentialsRequest
var protoReq QueryRequest
var metadata runtime.ServerMetadata
var (
@@ -154,17 +201,6 @@ func local_request_Query_Credentials_0(ctx context.Context, marshaler runtime.Ma
_ = err
)
val, ok = pathParams["did"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "did")
}
protoReq.Did, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
val, ok = pathParams["origin"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "origin")
@@ -176,67 +212,35 @@ func local_request_Query_Credentials_0(ctx context.Context, marshaler runtime.Ma
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "origin", err)
}
val, ok = pathParams["subject"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject")
}
protoReq.Subject, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Credentials_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Credentials(ctx, &protoReq)
return msg, metadata, err
}
func request_Query_Identities_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryIdentitiesRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["did"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "did")
}
protoReq.Did, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
msg, err := client.Identities(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Identities_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryIdentitiesRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["did"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "did")
}
protoReq.Did, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
msg, err := server.Identities(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_Resolve_0 = &utilities.DoubleArray{Encoding: map[string]int{"did": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
func request_Query_Resolve_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryResolveRequest
var protoReq QueryRequest
var metadata runtime.ServerMetadata
var (
@@ -257,13 +261,20 @@ func request_Query_Resolve_0(ctx context.Context, marshaler runtime.Marshaler, c
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Resolve_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Resolve(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Resolve_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryResolveRequest
var protoReq QueryRequest
var metadata runtime.ServerMetadata
var (
@@ -284,13 +295,24 @@ func local_request_Query_Resolve_0(ctx context.Context, marshaler runtime.Marsha
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Resolve_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Resolve(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_Service_0 = &utilities.DoubleArray{Encoding: map[string]int{"origin": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
func request_Query_Service_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryServiceRequest
var protoReq QueryRequest
var metadata runtime.ServerMetadata
var (
@@ -311,13 +333,20 @@ func request_Query_Service_0(ctx context.Context, marshaler runtime.Marshaler, c
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "origin", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Service_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Service(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Service_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryServiceRequest
var protoReq QueryRequest
var metadata runtime.ServerMetadata
var (
@@ -338,11 +367,54 @@ func local_request_Query_Service_0(ctx context.Context, marshaler runtime.Marsha
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "origin", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Service_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Service(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_Token_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_Token_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Token_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Token(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Token_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Token_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Token(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -418,29 +490,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
mux.Handle("GET", pattern_Query_Identities_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Identities_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Identities_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_Resolve_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -487,6 +536,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
mux.Handle("POST", pattern_Query_Token_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Token_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Token_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -588,26 +660,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
mux.Handle("GET", pattern_Query_Identities_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_Identities_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Identities_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_Query_Resolve_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -648,6 +700,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
mux.Handle("POST", pattern_Query_Token_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_Token_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Token_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -656,13 +728,13 @@ var (
pattern_Query_Accounts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 0, 2, 1}, []string{"did", "accounts"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Credentials_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"did", "origin", "credentials"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Credentials_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"service", "origin", "subject", "credentials"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Identities_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 0, 2, 1}, []string{"did", "identities"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Resolve_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 0}, []string{"did"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Resolve_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 0}, []string{"did", "resolve"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Service_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"service", "origin"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Service_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"did", "service", "origin"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Token_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"token"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
@@ -672,9 +744,9 @@ var (
forward_Query_Credentials_0 = runtime.ForwardResponseMessage
forward_Query_Identities_0 = runtime.ForwardResponseMessage
forward_Query_Resolve_0 = runtime.ForwardResponseMessage
forward_Query_Service_0 = runtime.ForwardResponseMessage
forward_Query_Token_0 = runtime.ForwardResponseMessage
)
+8
View File
@@ -2,3 +2,11 @@ package types
// ByteArray is a list of byte arrays
type ByteArray = [][]byte
// ToVerificationMethod converts a Profile to a VerificationMethod
func (p Profile) ToVerificationMethod() VerificationMethod {
return VerificationMethod{
Id: p.Id,
Controller: p.Controller,
}
}
+587 -95
View File
@@ -33,8 +33,14 @@ type Assertion struct {
PublicKey *PubKey `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
// The value of the linked identifier
CredentialId []byte `protobuf:"bytes,4,opt,name=credential_id,json=credentialId,proto3" json:"credential_id,omitempty"`
// The display label of the attestation
CredentialLabel string `protobuf:"bytes,5,opt,name=credential_label,json=credentialLabel,proto3" json:"credential_label,omitempty"`
// The origin of the attestation
Origin string `protobuf:"bytes,6,opt,name=origin,proto3" json:"origin,omitempty"`
// The subject of the attestation
Subject string `protobuf:"bytes,7,opt,name=subject,proto3" json:"subject,omitempty"`
// Metadata is optional additional information about the assertion
Metadata *Metadata `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"`
Metadata *Metadata `protobuf:"bytes,8,opt,name=metadata,proto3" json:"metadata,omitempty"`
}
func (m *Assertion) Reset() { *m = Assertion{} }
@@ -98,6 +104,27 @@ func (m *Assertion) GetCredentialId() []byte {
return nil
}
func (m *Assertion) GetCredentialLabel() string {
if m != nil {
return m.CredentialLabel
}
return ""
}
func (m *Assertion) GetOrigin() string {
if m != nil {
return m.Origin
}
return ""
}
func (m *Assertion) GetSubject() string {
if m != nil {
return m.Subject
}
return ""
}
func (m *Assertion) GetMetadata() *Metadata {
if m != nil {
return m.Metadata
@@ -202,6 +229,8 @@ type Controller struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// The DID of the controller
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
// Aliases of the controller
Aliases []string `protobuf:"bytes,3,rep,name=aliases,proto3" json:"aliases,omitempty"`
// PubKey is the verification method
PublicKey *PubKey `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
// The vault address or identifier
@@ -255,6 +284,13 @@ func (m *Controller) GetAddress() string {
return ""
}
func (m *Controller) GetAliases() []string {
if m != nil {
return m.Aliases
}
return nil
}
func (m *Controller) GetPublicKey() *PubKey {
if m != nil {
return m.PublicKey
@@ -276,9 +312,15 @@ type Delegation struct {
// The Decentralized Identifier of the delegated account
Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"`
// Resolved from module parameters
ChainInfoId string `protobuf:"bytes,3,opt,name=chain_info_id,json=chainInfoId,proto3" json:"chain_info_id,omitempty"`
ChainIndex string `protobuf:"bytes,3,opt,name=chain_index,json=chainIndex,proto3" json:"chain_index,omitempty"`
// The delegation proof or verification method
PublicKey *PubKey `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
// The Account Address
AccountAddress string `protobuf:"bytes,5,opt,name=account_address,json=accountAddress,proto3" json:"account_address,omitempty"`
// The Account label
AccountLabel string `protobuf:"bytes,6,opt,name=account_label,json=accountLabel,proto3" json:"account_label,omitempty"`
// The Chain ID
ChainId string `protobuf:"bytes,7,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}
func (m *Delegation) Reset() { *m = Delegation{} }
@@ -328,9 +370,9 @@ func (m *Delegation) GetController() string {
return ""
}
func (m *Delegation) GetChainInfoId() string {
func (m *Delegation) GetChainIndex() string {
if m != nil {
return m.ChainInfoId
return m.ChainIndex
}
return ""
}
@@ -342,34 +384,59 @@ func (m *Delegation) GetPublicKey() *PubKey {
return nil
}
// Service represents a service in a DID Document
type Service struct {
func (m *Delegation) GetAccountAddress() string {
if m != nil {
return m.AccountAddress
}
return ""
}
func (m *Delegation) GetAccountLabel() string {
if m != nil {
return m.AccountLabel
}
return ""
}
func (m *Delegation) GetChainId() string {
if m != nil {
return m.ChainId
}
return ""
}
// ServiceRecord represents a decentralized service in a DID Document
type ServiceRecord struct {
// The ID of the service
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// The type of the service
ServiceType string `protobuf:"bytes,2,opt,name=service_type,json=serviceType,proto3" json:"service_type,omitempty"`
// The controller DID of the service
ControllerDid string `protobuf:"bytes,3,opt,name=controller_did,json=controllerDid,proto3" json:"controller_did,omitempty"`
Controller string `protobuf:"bytes,3,opt,name=controller,proto3" json:"controller,omitempty"`
// The domain name of the service
OriginUri string `protobuf:"bytes,4,opt,name=origin_uri,json=originUri,proto3" json:"origin_uri,omitempty"`
// The description of the service
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
// The service endpoint
ServiceEndpoints map[string]string `protobuf:"bytes,5,rep,name=service_endpoints,json=serviceEndpoints,proto3" json:"service_endpoints,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
ServiceEndpoints map[string]string `protobuf:"bytes,6,rep,name=service_endpoints,json=serviceEndpoints,proto3" json:"service_endpoints,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
// Scopes is the Authorization Grants of the service
Permissions *Permissions `protobuf:"bytes,6,opt,name=permissions,proto3" json:"permissions,omitempty"`
Permissions *Permissions `protobuf:"bytes,7,opt,name=permissions,proto3" json:"permissions,omitempty"`
// Metadata is optional additional information about the service
Metadata *Metadata `protobuf:"bytes,8,opt,name=metadata,proto3" json:"metadata,omitempty"`
}
func (m *Service) Reset() { *m = Service{} }
func (m *Service) String() string { return proto.CompactTextString(m) }
func (*Service) ProtoMessage() {}
func (*Service) Descriptor() ([]byte, []int) {
func (m *ServiceRecord) Reset() { *m = ServiceRecord{} }
func (m *ServiceRecord) String() string { return proto.CompactTextString(m) }
func (*ServiceRecord) ProtoMessage() {}
func (*ServiceRecord) Descriptor() ([]byte, []int) {
return fileDescriptor_f44bb702879c34b4, []int{4}
}
func (m *Service) XXX_Unmarshal(b []byte) error {
func (m *ServiceRecord) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Service) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
func (m *ServiceRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Service.Marshal(b, m, deterministic)
return xxx_messageInfo_ServiceRecord.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@@ -379,112 +446,137 @@ func (m *Service) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
func (m *Service) XXX_Merge(src proto.Message) {
xxx_messageInfo_Service.Merge(m, src)
func (m *ServiceRecord) XXX_Merge(src proto.Message) {
xxx_messageInfo_ServiceRecord.Merge(m, src)
}
func (m *Service) XXX_Size() int {
func (m *ServiceRecord) XXX_Size() int {
return m.Size()
}
func (m *Service) XXX_DiscardUnknown() {
xxx_messageInfo_Service.DiscardUnknown(m)
func (m *ServiceRecord) XXX_DiscardUnknown() {
xxx_messageInfo_ServiceRecord.DiscardUnknown(m)
}
var xxx_messageInfo_Service proto.InternalMessageInfo
var xxx_messageInfo_ServiceRecord proto.InternalMessageInfo
func (m *Service) GetId() string {
func (m *ServiceRecord) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Service) GetServiceType() string {
func (m *ServiceRecord) GetServiceType() string {
if m != nil {
return m.ServiceType
}
return ""
}
func (m *Service) GetControllerDid() string {
func (m *ServiceRecord) GetController() string {
if m != nil {
return m.ControllerDid
return m.Controller
}
return ""
}
func (m *Service) GetOriginUri() string {
func (m *ServiceRecord) GetOriginUri() string {
if m != nil {
return m.OriginUri
}
return ""
}
func (m *Service) GetServiceEndpoints() map[string]string {
func (m *ServiceRecord) GetDescription() string {
if m != nil {
return m.Description
}
return ""
}
func (m *ServiceRecord) GetServiceEndpoints() map[string]string {
if m != nil {
return m.ServiceEndpoints
}
return nil
}
func (m *Service) GetPermissions() *Permissions {
func (m *ServiceRecord) GetPermissions() *Permissions {
if m != nil {
return m.Permissions
}
return nil
}
func (m *ServiceRecord) GetMetadata() *Metadata {
if m != nil {
return m.Metadata
}
return nil
}
func init() {
proto.RegisterType((*Assertion)(nil), "did.v1.Assertion")
proto.RegisterType((*Attestation)(nil), "did.v1.Attestation")
proto.RegisterType((*Controller)(nil), "did.v1.Controller")
proto.RegisterType((*Delegation)(nil), "did.v1.Delegation")
proto.RegisterType((*Service)(nil), "did.v1.Service")
proto.RegisterMapType((map[string]string)(nil), "did.v1.Service.ServiceEndpointsEntry")
proto.RegisterType((*ServiceRecord)(nil), "did.v1.ServiceRecord")
proto.RegisterMapType((map[string]string)(nil), "did.v1.ServiceRecord.ServiceEndpointsEntry")
}
func init() { proto.RegisterFile("did/v1/state.proto", fileDescriptor_f44bb702879c34b4) }
var fileDescriptor_f44bb702879c34b4 = []byte{
// 613 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0x4f, 0x6b, 0xd4, 0x40,
0x18, 0xc6, 0x3b, 0xfb, 0xaf, 0xcd, 0xbb, 0xed, 0xb2, 0x4e, 0xab, 0x86, 0x8a, 0x61, 0x8d, 0x16,
0xf6, 0x50, 0x37, 0xb4, 0x22, 0x48, 0xf1, 0x52, 0xdb, 0x1e, 0x4a, 0x11, 0x24, 0xea, 0xc5, 0x4b,
0xc8, 0x66, 0xa6, 0xdb, 0xd1, 0x64, 0x66, 0x99, 0x99, 0xac, 0xe6, 0x4b, 0x88, 0xf8, 0x01, 0xf4,
0xeb, 0x78, 0x11, 0x0a, 0x5e, 0x3c, 0xca, 0xf6, 0x1b, 0xf4, 0x13, 0x48, 0x92, 0x49, 0xb7, 0xae,
0x42, 0xd1, 0x83, 0xa7, 0xdd, 0xf7, 0xc9, 0x93, 0x99, 0xe7, 0xf7, 0xcc, 0x10, 0xc0, 0x84, 0x11,
0x6f, 0xb2, 0xe5, 0x29, 0x1d, 0x6a, 0x3a, 0x18, 0x4b, 0xa1, 0x05, 0x6e, 0x11, 0x46, 0x06, 0x93,
0xad, 0xf5, 0x9b, 0x91, 0x50, 0x89, 0x50, 0x9e, 0x90, 0x49, 0x6e, 0x11, 0x32, 0x29, 0x0d, 0xeb,
0x6b, 0xe6, 0xa5, 0x11, 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6b, 0xb6, 0x7a, 0x51, 0xcc, 0xec, 0x91, 0x7f, 0xd9,
0xb7, 0xbe, 0x07, 0xd7, 0xff, 0xb8, 0x03, 0xee, 0x42, 0x3d, 0x2f, 0xb8, 0x6c, 0x27, 0xff, 0x8b,
0xd7, 0xa0, 0x39, 0x09, 0xe3, 0xb4, 0xea, 0xa5, 0x1c, 0x76, 0x6a, 0x8f, 0xd0, 0x5c, 0xc9, 0xcd,
0x27, 0x8f, 0xbf, 0x4c, 0x1d, 0x74, 0x3a, 0x75, 0xd0, 0x8f, 0xa9, 0x83, 0x3e, 0x9c, 0x39, 0x0b,
0xa7, 0x67, 0xce, 0xc2, 0xf7, 0x33, 0x67, 0xe1, 0x95, 0x3b, 0x62, 0xfa, 0x24, 0x1d, 0x0e, 0x22,
0x91, 0x78, 0x82, 0x2b, 0xc1, 0xa5, 0x77, 0xf2, 0x36, 0xcc, 0xbc, 0x77, 0x5e, 0xfe, 0xa1, 0xca,
0x5b, 0x57, 0xc3, 0x56, 0xf1, 0x95, 0x7a, 0xf0, 0x33, 0x00, 0x00, 0xff, 0xff, 0x13, 0xa6, 0x96,
0x2c, 0x07, 0x05, 0x00, 0x00,
// 796 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x95, 0x41, 0x4f, 0x23, 0x37,
0x14, 0xc7, 0x99, 0x99, 0x24, 0x24, 0x6f, 0x92, 0x10, 0x0c, 0x14, 0x17, 0xd4, 0x69, 0x08, 0x87,
0xa6, 0x2a, 0x4d, 0x04, 0x55, 0xd5, 0x2a, 0x6a, 0x0f, 0x94, 0x72, 0x40, 0xb4, 0x52, 0x95, 0xb6,
0x52, 0xc5, 0x25, 0x9d, 0x8c, 0xad, 0xe0, 0x76, 0x32, 0x8e, 0x6c, 0x4f, 0x44, 0x3e, 0x43, 0xa5,
0xaa, 0x9f, 0xa0, 0x9f, 0xa7, 0x87, 0x1e, 0x90,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0xce, 0x22, 0x25, 0x71, 0xa9, 0xe9, 0xb4, 0xdd, 0x83, 0xcf, 0xb2, 0x6e,
0xdd, 0xaa, 0x22, 0x5b, 0x1d, 0x67, 0xee, 0xe3, 0x48, 0x89, 0x59, 0xbf, 0x21, 0x17, 0x64, 0xf4,
0x25, 0xb8, 0x13, 0x2a, 0xc6, 0x4c, 0x4a, 0xc6, 0x23, 0xa9, 0xdb, 0xe0, 0x1e, 0xac, 0xdd, 0xdc,
0x80, 0x79, 0xa8, 0x9f, 0xf7, 0x3d, 0xee, 0x11, 0xdc, 0x3a, 0x82, 0x8d, 0x77, 0xe6, 0x83, 0x1a,
0xe0, 0x24, 0xf7, 0x2e, 0x85, 0x9d, 0xfc, 0x8b, 0xd6, 0xa1, 0x38, 0xf5, 0xc3, 0x38, 0xc3, 0x9c,
0x2e, 0x7a, 0xf6, 0xd7, 0xd6, 0xc2, 0xc3, 0xd0, 0xc8, 0x23, 0xd5, 0x97, 0x60, 0x1b, 0x36, 0xee,
0x3c, 0x0a, 0x3a, 0x98, 0x4c, 0x52, 0xf1, 0xbb, 0x6f, 0xfe, 0xbb, 0xf2, 0xac, 0xcb, 0x2b, 0xcf,
0x7a, 0x79, 0xe5, 0x59, 0xff, 0x5c, 0x7b, 0x4b, 0x97, 0xd7, 0xde, 0xd2, 0xf3, 0x6b, 0x6f, 0xe9,
0xac, 0x35, 0x62, 0xea, 0x3c, 0x1e, 0x76, 0x02, 0x3e, 0xee, 0xf2, 0x48, 0xf2, 0x48, 0x74, 0xf5,
0x9f, 0x8b, 0x6e, 0xf2, 0xb5, 0x4b, 0x7a, 0x2e, 0x87, 0x25, 0xfd, 0xa9, 0xfb, 0xe2, 0x6d, 0x00,
0x00, 0x00, 0xff, 0xff, 0x39, 0xd5, 0x9b, 0xc7, 0x4c, 0x07, 0x00, 0x00,
}
func (m *Assertion) Marshal() (dAtA []byte, err error) {
@@ -517,6 +609,27 @@ func (m *Assertion) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintState(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x42
}
if len(m.Subject) > 0 {
i -= len(m.Subject)
copy(dAtA[i:], m.Subject)
i = encodeVarintState(dAtA, i, uint64(len(m.Subject)))
i--
dAtA[i] = 0x3a
}
if len(m.Origin) > 0 {
i -= len(m.Origin)
copy(dAtA[i:], m.Origin)
i = encodeVarintState(dAtA, i, uint64(len(m.Origin)))
i--
dAtA[i] = 0x32
}
if len(m.CredentialLabel) > 0 {
i -= len(m.CredentialLabel)
copy(dAtA[i:], m.CredentialLabel)
i = encodeVarintState(dAtA, i, uint64(len(m.CredentialLabel)))
i--
dAtA[i] = 0x2a
}
if len(m.CredentialId) > 0 {
@@ -669,6 +782,15 @@ func (m *Controller) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x22
}
if len(m.Aliases) > 0 {
for iNdEx := len(m.Aliases) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Aliases[iNdEx])
copy(dAtA[i:], m.Aliases[iNdEx])
i = encodeVarintState(dAtA, i, uint64(len(m.Aliases[iNdEx])))
i--
dAtA[i] = 0x1a
}
}
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
@@ -706,6 +828,27 @@ func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.ChainId) > 0 {
i -= len(m.ChainId)
copy(dAtA[i:], m.ChainId)
i = encodeVarintState(dAtA, i, uint64(len(m.ChainId)))
i--
dAtA[i] = 0x3a
}
if len(m.AccountLabel) > 0 {
i -= len(m.AccountLabel)
copy(dAtA[i:], m.AccountLabel)
i = encodeVarintState(dAtA, i, uint64(len(m.AccountLabel)))
i--
dAtA[i] = 0x32
}
if len(m.AccountAddress) > 0 {
i -= len(m.AccountAddress)
copy(dAtA[i:], m.AccountAddress)
i = encodeVarintState(dAtA, i, uint64(len(m.AccountAddress)))
i--
dAtA[i] = 0x2a
}
if m.PublicKey != nil {
{
size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i])
@@ -718,10 +861,10 @@ func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x22
}
if len(m.ChainInfoId) > 0 {
i -= len(m.ChainInfoId)
copy(dAtA[i:], m.ChainInfoId)
i = encodeVarintState(dAtA, i, uint64(len(m.ChainInfoId)))
if len(m.ChainIndex) > 0 {
i -= len(m.ChainIndex)
copy(dAtA[i:], m.ChainIndex)
i = encodeVarintState(dAtA, i, uint64(len(m.ChainIndex)))
i--
dAtA[i] = 0x1a
}
@@ -742,7 +885,7 @@ func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *Service) Marshal() (dAtA []byte, err error) {
func (m *ServiceRecord) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@@ -752,16 +895,28 @@ func (m *Service) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
func (m *Service) MarshalTo(dAtA []byte) (int, error) {
func (m *ServiceRecord) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Service) MarshalToSizedBuffer(dAtA []byte) (int, error) {
func (m *ServiceRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Metadata != nil {
{
size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintState(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x42
}
if m.Permissions != nil {
{
size, err := m.Permissions.MarshalToSizedBuffer(dAtA[:i])
@@ -772,7 +927,7 @@ func (m *Service) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintState(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x32
dAtA[i] = 0x3a
}
if len(m.ServiceEndpoints) > 0 {
for k := range m.ServiceEndpoints {
@@ -790,9 +945,16 @@ func (m *Service) MarshalToSizedBuffer(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i = encodeVarintState(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x2a
dAtA[i] = 0x32
}
}
if len(m.Description) > 0 {
i -= len(m.Description)
copy(dAtA[i:], m.Description)
i = encodeVarintState(dAtA, i, uint64(len(m.Description)))
i--
dAtA[i] = 0x2a
}
if len(m.OriginUri) > 0 {
i -= len(m.OriginUri)
copy(dAtA[i:], m.OriginUri)
@@ -800,10 +962,10 @@ func (m *Service) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x22
}
if len(m.ControllerDid) > 0 {
i -= len(m.ControllerDid)
copy(dAtA[i:], m.ControllerDid)
i = encodeVarintState(dAtA, i, uint64(len(m.ControllerDid)))
if len(m.Controller) > 0 {
i -= len(m.Controller)
copy(dAtA[i:], m.Controller)
i = encodeVarintState(dAtA, i, uint64(len(m.Controller)))
i--
dAtA[i] = 0x1a
}
@@ -857,6 +1019,18 @@ func (m *Assertion) Size() (n int) {
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.CredentialLabel)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.Origin)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.Subject)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
if m.Metadata != nil {
l = m.Metadata.Size()
n += 1 + l + sovState(uint64(l))
@@ -911,6 +1085,12 @@ func (m *Controller) Size() (n int) {
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
if len(m.Aliases) > 0 {
for _, s := range m.Aliases {
l = len(s)
n += 1 + l + sovState(uint64(l))
}
}
if m.PublicKey != nil {
l = m.PublicKey.Size()
n += 1 + l + sovState(uint64(l))
@@ -936,7 +1116,7 @@ func (m *Delegation) Size() (n int) {
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.ChainInfoId)
l = len(m.ChainIndex)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
@@ -944,10 +1124,22 @@ func (m *Delegation) Size() (n int) {
l = m.PublicKey.Size()
n += 1 + l + sovState(uint64(l))
}
l = len(m.AccountAddress)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.AccountLabel)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.ChainId)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
return n
}
func (m *Service) Size() (n int) {
func (m *ServiceRecord) Size() (n int) {
if m == nil {
return 0
}
@@ -961,7 +1153,7 @@ func (m *Service) Size() (n int) {
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.ControllerDid)
l = len(m.Controller)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
@@ -969,6 +1161,10 @@ func (m *Service) Size() (n int) {
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.Description)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
if len(m.ServiceEndpoints) > 0 {
for k, v := range m.ServiceEndpoints {
_ = k
@@ -981,6 +1177,10 @@ func (m *Service) Size() (n int) {
l = m.Permissions.Size()
n += 1 + l + sovState(uint64(l))
}
if m.Metadata != nil {
l = m.Metadata.Size()
n += 1 + l + sovState(uint64(l))
}
return n
}
@@ -1154,6 +1354,102 @@ func (m *Assertion) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CredentialLabel", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CredentialLabel = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Origin = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Subject = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
}
@@ -1553,6 +1849,38 @@ func (m *Controller) Unmarshal(dAtA []byte) error {
}
m.Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Aliases", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Aliases = append(m.Aliases, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType)
@@ -1737,7 +2065,7 @@ func (m *Delegation) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainInfoId", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field ChainIndex", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -1765,7 +2093,7 @@ func (m *Delegation) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ChainInfoId = string(dAtA[iNdEx:postIndex])
m.ChainIndex = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
@@ -1803,6 +2131,102 @@ func (m *Delegation) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AccountAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.AccountAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AccountLabel", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.AccountLabel = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ChainId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipState(dAtA[iNdEx:])
@@ -1824,7 +2248,7 @@ func (m *Delegation) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *Service) Unmarshal(dAtA []byte) error {
func (m *ServiceRecord) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -1847,10 +2271,10 @@ func (m *Service) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Service: wiretype end group for non-group")
return fmt.Errorf("proto: ServiceRecord: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Service: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: ServiceRecord: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
@@ -1919,7 +2343,7 @@ func (m *Service) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ControllerDid", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -1947,7 +2371,7 @@ func (m *Service) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ControllerDid = string(dAtA[iNdEx:postIndex])
m.Controller = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
@@ -1982,6 +2406,38 @@ func (m *Service) Unmarshal(dAtA []byte) error {
m.OriginUri = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Description = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ServiceEndpoints", wireType)
}
@@ -2108,7 +2564,7 @@ func (m *Service) Unmarshal(dAtA []byte) error {
}
m.ServiceEndpoints[mapkey] = mapvalue
iNdEx = postIndex
case 6:
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType)
}
@@ -2144,6 +2600,42 @@ func (m *Service) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Metadata == nil {
m.Metadata = &Metadata{}
}
if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipState(dAtA[iNdEx:])
+1609 -413
View File
File diff suppressed because it is too large Load Diff
-15
View File
@@ -1,15 +0,0 @@
package types
func (a *AssetInfo) Equal(b *AssetInfo) bool {
if a == nil && b == nil {
return true
}
return false
}
func (c *ChainInfo) Equal(b *ChainInfo) bool {
if c == nil && b == nil {
return true
}
return false
}
File diff suppressed because it is too large Load Diff
@@ -10,8 +10,8 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
)
// ComputePublicKey computes the public key of a child key given the extended public key, chain code, and index.
func ComputePublicKey(extPubKey []byte, chainCode uint32, index int) ([]byte, error) {
// ComputeAccountPublicKey computes the public key of a child key given the extended public key, chain code, and index.
func ComputeAccountPublicKey(extPubKey []byte, chainCode uint32, index int) ([]byte, error) {
// Check if the index is a hardened child key
if chainCode&0x80000000 != 0 && index < 0 {
return nil, errors.New("invalid index")
+11
View File
@@ -0,0 +1,11 @@
package types
import sdk "github.com/cosmos/cosmos-sdk/types"
func (t *Token) Validate(permissions string) error {
return nil
}
func (t *Token) Verify(msg sdk.Msg) error {
return nil
}
+145
View File
@@ -0,0 +1,145 @@
package types
import (
"fmt"
"github.com/onsonr/crypto/accumulator"
"github.com/onsonr/crypto/core/curves"
)
// Element is the element for the BLS scheme
type Element = accumulator.Element
// NewProperty creates a new Property which is used for ZKP
func NewProperty(propertyKey string, pubKey []byte) (*Property, error) {
input := append(pubKey, []byte(propertyKey)...)
hash := []byte(input)
curve := curves.BLS12381(&curves.PointBls12381G1{})
key, err := new(accumulator.SecretKey).New(curve, hash[:])
if err != nil {
return nil, fmt.Errorf("failed to create secret key: %w", err)
}
keyBytes, err := key.MarshalBinary()
if err != nil {
return nil, fmt.Errorf("failed to marshal secret key: %w", err)
}
return &Property{Key: keyBytes}, nil
}
// CreateAccumulator creates a new accumulator
func CreateAccumulator(prop *Property, values ...string) (*Accumulator, error) {
curve := curves.BLS12381(&curves.PointBls12381G1{})
acc, err := new(accumulator.Accumulator).New(curve)
if err != nil {
return nil, err
}
secretKey := new(accumulator.SecretKey)
if err := secretKey.UnmarshalBinary(prop.Key); err != nil {
return nil, err
}
fin, _, err := acc.Update(secretKey, ConvertValuesToZeroKnowledgeElements(values), nil)
if err != nil {
return nil, err
}
accBytes, err := fin.MarshalBinary()
if err != nil {
return nil, fmt.Errorf("failed to marshal accumulator: %w", err)
}
return &Accumulator{Accumulator: accBytes}, nil
}
// CreateWitness creates a witness for the accumulator for a given value
func CreateWitness(prop *Property, acc *Accumulator, value string) (*Witness, error) {
curve := curves.BLS12381(&curves.PointBls12381G1{})
element := curve.Scalar.Hash([]byte(value))
secretKey := new(accumulator.SecretKey)
if err := secretKey.UnmarshalBinary(prop.Key); err != nil {
return nil, err
}
accObj := new(accumulator.Accumulator)
if err := accObj.UnmarshalBinary(acc.Accumulator); err != nil {
return nil, fmt.Errorf("failed to unmarshal accumulator: %w", err)
}
mw, err := new(accumulator.MembershipWitness).New(element, accObj, secretKey)
if err != nil {
return nil, err
}
witnessBytes, err := mw.MarshalBinary()
if err != nil {
return nil, fmt.Errorf("failed to marshal witness: %w", err)
}
return &Witness{Witness: witnessBytes}, nil
}
// VerifyWitness proves that a value is a member of the accumulator
func VerifyWitness(prop *Property, acc *Accumulator, witness *Witness) error {
secretKey := new(accumulator.SecretKey)
if err := secretKey.UnmarshalBinary(prop.Key); err != nil {
return err
}
curve := curves.BLS12381(&curves.PointBls12381G1{})
publicKey, err := secretKey.GetPublicKey(curve)
if err != nil {
return err
}
accObj := new(accumulator.Accumulator)
if err := accObj.UnmarshalBinary(acc.Accumulator); err != nil {
return fmt.Errorf("failed to unmarshal accumulator: %w", err)
}
witnessObj := new(accumulator.MembershipWitness)
if err := witnessObj.UnmarshalBinary(witness.Witness); err != nil {
return fmt.Errorf("failed to unmarshal witness: %w", err)
}
return witnessObj.Verify(publicKey, accObj)
}
// UpdateAccumulator updates the accumulator with new values
func UpdateAccumulator(prop *Property, acc *Accumulator, addValues []string, removeValues []string) (*Accumulator, error) {
secretKey := new(accumulator.SecretKey)
if err := secretKey.UnmarshalBinary(prop.Key); err != nil {
return nil, err
}
accObj := new(accumulator.Accumulator)
if err := accObj.UnmarshalBinary(acc.Accumulator); err != nil {
return nil, fmt.Errorf("failed to unmarshal accumulator: %w", err)
}
updatedAcc, _, err := accObj.Update(secretKey, ConvertValuesToZeroKnowledgeElements(addValues), ConvertValuesToZeroKnowledgeElements(removeValues))
if err != nil {
return nil, err
}
updatedAccBytes, err := updatedAcc.MarshalBinary()
if err != nil {
return nil, fmt.Errorf("failed to marshal updated accumulator: %w", err)
}
return &Accumulator{Accumulator: updatedAccBytes}, nil
}
// ConvertValuesToZeroKnowledgeElements converts a slice of strings to a slice of accumulator elements
func ConvertValuesToZeroKnowledgeElements(values []string) []Element {
curve := curves.BLS12381(&curves.PointBls12381G1{})
elements := make([]accumulator.Element, len(values))
for i, value := range values {
elements[i] = curve.Scalar.Hash([]byte(value))
}
return elements
}
+1 -1
View File
@@ -1,7 +1,7 @@
package oracle
import (
"github.com/onsonr/hway/x/oracle/keeper"
"github.com/onsonr/sonr/x/oracle/keeper"
sdk "github.com/cosmos/cosmos-sdk/types"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
+1 -1
View File
@@ -1,7 +1,7 @@
package keeper
import (
"github.com/onsonr/hway/x/oracle/types"
"github.com/onsonr/sonr/x/oracle/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
+1 -1
View File
@@ -1,7 +1,7 @@
package keeper
import (
"github.com/onsonr/hway/x/oracle/types"
"github.com/onsonr/sonr/x/oracle/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
+2 -2
View File
@@ -4,8 +4,8 @@ import (
"encoding/json"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/onsonr/hway/x/oracle/keeper"
"github.com/onsonr/hway/x/oracle/types"
"github.com/onsonr/sonr/x/oracle/keeper"
"github.com/onsonr/sonr/x/oracle/types"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
+3 -4
View File
@@ -67,7 +67,7 @@ func init() {
func init() { proto.RegisterFile("oracle/v1/genesis.proto", fileDescriptor_14b982a0a6345d1d) }
var fileDescriptor_14b982a0a6345d1d = []byte{
// 147 bytes of a gzipped FileDescriptorProto
// 144 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x2f, 0x4a, 0x4c,
0xce, 0x49, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28,
0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0x48, 0xe8, 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7,
@@ -75,9 +75,8 @@ var fileDescriptor_14b982a0a6345d1d = []byte{
0xc4, 0x92, 0x54, 0x27, 0xfb, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48,
0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x52,
0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xcf, 0xcf, 0x2b, 0xce, 0xcf,
0x2b, 0xd2, 0xcf, 0x28, 0x4f, 0xac, 0xd4, 0xaf, 0xd0, 0x87, 0x5a, 0x5e, 0x52, 0x59, 0x90, 0x5a,
0x9c, 0xc4, 0x06, 0x36, 0xd7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x25, 0x38, 0x48, 0xfb, 0x93,
0x00, 0x00, 0x00,
0x2b, 0xd2, 0x07, 0x13, 0x15, 0xfa, 0x50, 0xcb, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0,
0xe6, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x74, 0xe4, 0x19, 0x43, 0x93, 0x00, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
+4 -4
View File
@@ -24,14 +24,14 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func init() { proto.RegisterFile("oracle/v1/query.proto", fileDescriptor_34238c8dfdfcd7ec) }
var fileDescriptor_34238c8dfdfcd7ec = []byte{
// 133 bytes of a gzipped FileDescriptorProto
// 130 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcd, 0x2f, 0x4a, 0x4c,
0xce, 0x49, 0xd5, 0x2f, 0x33, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f,
0xc9, 0x17, 0xe2, 0x84, 0x08, 0xeb, 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x45,
0xf5, 0x41, 0x2c, 0x88, 0x02, 0x27, 0xfb, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c,
0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63,
0x88, 0x52, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xcf, 0xcf, 0x2b,
0xce, 0xcf, 0x2b, 0xd2, 0xcf, 0x28, 0x4f, 0xac, 0xd4, 0xaf, 0xd0, 0x87, 0x5a, 0x55, 0x52, 0x59,
0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x36, 0xc7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x7f, 0x61,
0xbe, 0x81, 0x00, 0x00, 0x00,
0xce, 0xcf, 0x2b, 0xd2, 0x07, 0x13, 0x15, 0xfa, 0x50, 0xab, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93,
0xd8, 0xc0, 0xe6, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x4d, 0xa3, 0x30, 0x06, 0x81, 0x00,
0x00, 0x00,
}
+3 -4
View File
@@ -24,14 +24,13 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func init() { proto.RegisterFile("oracle/v1/tx.proto", fileDescriptor_31571edce0094a5d) }
var fileDescriptor_31571edce0094a5d = []byte{
// 130 bytes of a gzipped FileDescriptorProto
// 127 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xca, 0x2f, 0x4a, 0x4c,
0xce, 0x49, 0xd5, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2,
0x84, 0x88, 0xe9, 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x45, 0xf5, 0x41, 0x2c,
0x88, 0x02, 0x27, 0xfb, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e,
0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x52, 0x4d,
0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xcf, 0xcf, 0x2b, 0xce, 0xcf, 0x2b,
0xd2, 0xcf, 0x28, 0x4f, 0xac, 0xd4, 0xaf, 0xd0, 0x87, 0xda, 0x53, 0x52, 0x59, 0x90, 0x5a, 0x9c,
0xc4, 0x06, 0x36, 0xc7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x39, 0x40, 0x7c, 0x7a, 0x7e, 0x00,
0x00, 0x00,
0xd2, 0x07, 0x13, 0x15, 0xfa, 0x50, 0x7b, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xe6,
0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x68, 0x9c, 0x2d, 0xc2, 0x7e, 0x00, 0x00, 0x00,
}