mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feature/ipfs vault allocation (#8)
* refactor: move constants to genesis.proto * feat: add ipfs_active flag to genesis state * feat: add IPFS connection initialization to keeper * feat: add testnet process-compose * refactor: rename sonr-testnet docker image to sonr-runner * refactor: update docker-vm-release workflow to use 'latest' tag * feat: add permission to workflows * feat: add new service chain execution * feat: add abstract vault class to pkl * feat: use jetpackio/devbox image for runner * feat: introduce dwn for local service worker * refactor: remove unnecessary dockerfile layers * refactor(deploy): Update Dockerfile to copy go.mod and go.sum from the parent directory * build: move Dockerfile to root directory * build: Add Dockerfile for deployment * feat: Update Dockerfile to work with Go project in parent directory * build: Update docker-compose.yaml to use relative paths * feat: Update docker-compose to work with new image and parent git directory * refactor: remove unnecessary test script * <no value> * feat: add test_node script for running node tests * feat: add IPFS cluster to testnet * feat: add docker image for sonr-runner * fix: typo in export path * feat(did): Add Localhost Registration Enabled Genesis Option * feat: add support for Sqlite DB in vault * feat: improve vault model JSON serialization * feat: support querying HTMX endpoint for DID * feat: Add primary key, unique, default, not null, auto increment, and foreign key field types * feat: Add PublicKey model in pkl/vault.pkl * feat: add frontend server * refactor: move dwn.wasm to vfs directory * feat(frontend): remove frontend server implementation * feat: Add a frontend server and web auth protocol * feat: implement new key types for MPC and ZK proofs * fix: Update enum types and DefaultKeyInfos * fix: correct typo in KeyAlgorithm enum * feat(did): add attestation format validation * feat: Add x/did/builder/extractor.go * feat: Update JWK parsing in x/did/builder/extractor.go * feat: Use github.com/onsonr/sonr/x/did/types package * feat: Extract and format public keys from WebAuthn credentials * feat: Introduce a new `mapToJWK` function to convert a map to a `types.JWK` struct * feat: add support for extracting JWK public keys * feat: remove VerificationMethod struct * refactor: extract public key extraction logic * feat: add helper functions to map COSECurveID to JWK curve names * feat: pin initial vault
This commit is contained in:
@@ -0,0 +1,176 @@
|
||||
package builder
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
|
||||
"github.com/go-webauthn/webauthn/protocol/webauthncose"
|
||||
didv1 "github.com/onsonr/sonr/api/did/v1"
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
)
|
||||
|
||||
func FormatEC2PublicKey(key *webauthncose.EC2PublicKeyData) (*types.JWK, error) {
|
||||
curve, err := GetCOSECurveName(key.Curve)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
jwkMap := map[string]interface{}{
|
||||
"kty": "EC",
|
||||
"crv": curve,
|
||||
"x": base64.RawURLEncoding.EncodeToString(key.XCoord),
|
||||
"y": base64.RawURLEncoding.EncodeToString(key.YCoord),
|
||||
}
|
||||
|
||||
return MapToJWK(jwkMap)
|
||||
}
|
||||
|
||||
func FormatRSAPublicKey(key *webauthncose.RSAPublicKeyData) (*types.JWK, error) {
|
||||
jwkMap := map[string]interface{}{
|
||||
"kty": "RSA",
|
||||
"n": base64.RawURLEncoding.EncodeToString(key.Modulus),
|
||||
"e": base64.RawURLEncoding.EncodeToString(key.Exponent),
|
||||
}
|
||||
|
||||
return MapToJWK(jwkMap)
|
||||
}
|
||||
|
||||
func FormatOKPPublicKey(key *webauthncose.OKPPublicKeyData) (*types.JWK, error) {
|
||||
curve, err := getOKPCurveName(key.Curve)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
jwkMap := map[string]interface{}{
|
||||
"kty": "OKP",
|
||||
"crv": curve,
|
||||
"x": base64.RawURLEncoding.EncodeToString(key.XCoord),
|
||||
}
|
||||
|
||||
return MapToJWK(jwkMap)
|
||||
}
|
||||
|
||||
func MapToJWK(m map[string]interface{}) (*types.JWK, error) {
|
||||
jwk := &types.JWK{}
|
||||
for k, v := range m {
|
||||
switch k {
|
||||
case "kty":
|
||||
jwk.Kty = v.(string)
|
||||
case "crv":
|
||||
jwk.Crv = v.(string)
|
||||
case "x":
|
||||
jwk.X = v.(string)
|
||||
case "y":
|
||||
jwk.Y = v.(string)
|
||||
case "n":
|
||||
jwk.N = v.(string)
|
||||
case "e":
|
||||
jwk.E = v.(string)
|
||||
}
|
||||
}
|
||||
return jwk, nil
|
||||
}
|
||||
|
||||
func GetCOSECurveName(curveID int64) (string, error) {
|
||||
switch curveID {
|
||||
case int64(webauthncose.P256):
|
||||
return "P-256", nil
|
||||
case int64(webauthncose.P384):
|
||||
return "P-384", nil
|
||||
case int64(webauthncose.P521):
|
||||
return "P-521", nil
|
||||
default:
|
||||
return "", fmt.Errorf("unknown curve ID: %d", curveID)
|
||||
}
|
||||
}
|
||||
|
||||
func getOKPCurveName(curveID int64) (string, error) {
|
||||
switch curveID {
|
||||
case int64(webauthncose.Ed25519):
|
||||
return "Ed25519", nil
|
||||
default:
|
||||
return "", fmt.Errorf("unknown OKP curve ID: %d", curveID)
|
||||
}
|
||||
}
|
||||
|
||||
func ModulePubKeyToAPI(pk *types.PubKey) *didv1.PubKey {
|
||||
return &didv1.PubKey{
|
||||
Role: ModuleKeyRoleToAPI(pk.GetRole()),
|
||||
Algorithm: ModuleKeyAlgorithmToAPI(pk.GetAlgorithm()),
|
||||
Encoding: ModuleKeyEncodingToAPI(pk.GetEncoding()),
|
||||
Curve: ModuleKeyCurveToAPI(pk.GetCurve()),
|
||||
KeyType: ModuleKeyTypeToAPI(pk.GetKeyType()),
|
||||
Raw: pk.GetRaw(),
|
||||
}
|
||||
}
|
||||
|
||||
func ModuleKeyRoleToAPI(role types.KeyRole) didv1.KeyRole {
|
||||
switch role {
|
||||
case types.KeyRole_KEY_ROLE_INVOCATION:
|
||||
return didv1.KeyRole_KEY_ROLE_INVOCATION
|
||||
case types.KeyRole_KEY_ROLE_ASSERTION:
|
||||
return didv1.KeyRole_KEY_ROLE_ASSERTION
|
||||
case types.KeyRole_KEY_ROLE_DELEGATION:
|
||||
return didv1.KeyRole_KEY_ROLE_DELEGATION
|
||||
default:
|
||||
return didv1.KeyRole_KEY_ROLE_INVOCATION
|
||||
}
|
||||
}
|
||||
|
||||
func ModuleKeyAlgorithmToAPI(algorithm types.KeyAlgorithm) didv1.KeyAlgorithm {
|
||||
switch algorithm {
|
||||
case types.KeyAlgorithm_KEY_ALGORITHM_ES256K:
|
||||
return didv1.KeyAlgorithm_KEY_ALGORITHM_ES256K
|
||||
case types.KeyAlgorithm_KEY_ALGORITHM_ES256:
|
||||
return didv1.KeyAlgorithm_KEY_ALGORITHM_ES256
|
||||
case types.KeyAlgorithm_KEY_ALGORITHM_ES384:
|
||||
return didv1.KeyAlgorithm_KEY_ALGORITHM_ES384
|
||||
case types.KeyAlgorithm_KEY_ALGORITHM_ES512:
|
||||
return didv1.KeyAlgorithm_KEY_ALGORITHM_ES512
|
||||
case types.KeyAlgorithm_KEY_ALGORITHM_EDDSA:
|
||||
return didv1.KeyAlgorithm_KEY_ALGORITHM_EDDSA
|
||||
default:
|
||||
return didv1.KeyAlgorithm_KEY_ALGORITHM_ES256K
|
||||
}
|
||||
}
|
||||
|
||||
func ModuleKeyCurveToAPI(curve types.KeyCurve) didv1.KeyCurve {
|
||||
switch curve {
|
||||
case types.KeyCurve_KEY_CURVE_P256:
|
||||
return didv1.KeyCurve_KEY_CURVE_P256
|
||||
case types.KeyCurve_KEY_CURVE_SECP256K1:
|
||||
return didv1.KeyCurve_KEY_CURVE_SECP256K1
|
||||
case types.KeyCurve_KEY_CURVE_BLS12381:
|
||||
return didv1.KeyCurve_KEY_CURVE_BLS12381
|
||||
case types.KeyCurve_KEY_CURVE_KECCAK256:
|
||||
return didv1.KeyCurve_KEY_CURVE_KECCAK256
|
||||
default:
|
||||
return didv1.KeyCurve_KEY_CURVE_P256
|
||||
}
|
||||
}
|
||||
|
||||
func ModuleKeyEncodingToAPI(encoding types.KeyEncoding) didv1.KeyEncoding {
|
||||
switch encoding {
|
||||
case types.KeyEncoding_KEY_ENCODING_RAW:
|
||||
return didv1.KeyEncoding_KEY_ENCODING_RAW
|
||||
case types.KeyEncoding_KEY_ENCODING_HEX:
|
||||
return didv1.KeyEncoding_KEY_ENCODING_HEX
|
||||
case types.KeyEncoding_KEY_ENCODING_MULTIBASE:
|
||||
return didv1.KeyEncoding_KEY_ENCODING_MULTIBASE
|
||||
default:
|
||||
return didv1.KeyEncoding_KEY_ENCODING_RAW
|
||||
}
|
||||
}
|
||||
|
||||
func ModuleKeyTypeToAPI(keyType types.KeyType) didv1.KeyType {
|
||||
switch keyType {
|
||||
case types.KeyType_KEY_TYPE_BIP32:
|
||||
return didv1.KeyType_KEY_TYPE_BIP32
|
||||
case types.KeyType_KEY_TYPE_ZK:
|
||||
return didv1.KeyType_KEY_TYPE_ZK
|
||||
case types.KeyType_KEY_TYPE_WEBAUTHN:
|
||||
return didv1.KeyType_KEY_TYPE_WEBAUTHN
|
||||
default:
|
||||
return didv1.KeyType_KEY_TYPE_BIP32
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package builder
|
||||
|
||||
import (
|
||||
"crypto/hmac"
|
||||
"crypto/sha512"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"math/big"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
)
|
||||
|
||||
// ComputeAccountPublicKey computes the public key of a child key given the extended public key, chain code, and index.
|
||||
func computeBip32AccountPublicKey(extPubKey PublicKey, chainCode types.ChainCode, index int) (*types.PubKey, error) {
|
||||
// Check if the index is a hardened child key
|
||||
if chainCode&0x80000000 != 0 && index < 0 {
|
||||
return nil, errors.New("invalid index")
|
||||
}
|
||||
|
||||
// Serialize the public key
|
||||
pubKey, err := btcec.ParsePubKey(extPubKey.GetRaw())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pubKeyBytes := pubKey.SerializeCompressed()
|
||||
|
||||
// Serialize the index
|
||||
indexBytes := make([]byte, 4)
|
||||
binary.BigEndian.PutUint32(indexBytes, uint32(index))
|
||||
|
||||
// Compute the HMAC-SHA512
|
||||
mac := hmac.New(sha512.New, []byte{byte(chainCode)})
|
||||
mac.Write(pubKeyBytes)
|
||||
mac.Write(indexBytes)
|
||||
I := mac.Sum(nil)
|
||||
|
||||
// Split I into two 32-byte sequences
|
||||
IL := I[:32]
|
||||
|
||||
// Convert IL to a big integer
|
||||
ilNum := new(big.Int).SetBytes(IL)
|
||||
|
||||
// Check if parse256(IL) >= n
|
||||
curve := btcec.S256()
|
||||
if ilNum.Cmp(curve.N) >= 0 {
|
||||
return nil, errors.New("invalid child key")
|
||||
}
|
||||
|
||||
// Compute the child public key
|
||||
ilx, ily := curve.ScalarBaseMult(IL)
|
||||
childX, childY := curve.Add(ilx, ily, pubKey.X(), pubKey.Y())
|
||||
lx := newBigIntFieldVal(childX)
|
||||
ly := newBigIntFieldVal(childY)
|
||||
|
||||
// Create the child public key
|
||||
childPubKey := btcec.NewPublicKey(lx, ly)
|
||||
pk, err := types.NewPublicKey(childPubKey.SerializeCompressed(), types.ChainCodeKeyInfos[chainCode])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return pk, nil
|
||||
}
|
||||
|
||||
// newBigIntFieldVal creates a new field value from a big integer.
|
||||
func newBigIntFieldVal(val *big.Int) *btcec.FieldVal {
|
||||
lx := new(btcec.FieldVal)
|
||||
lx.SetByteSlice(val.Bytes())
|
||||
return lx
|
||||
}
|
||||
@@ -0,0 +1,334 @@
|
||||
package builder
|
||||
|
||||
import (
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
)
|
||||
|
||||
type (
|
||||
AuthenticatorAttachment string
|
||||
AuthenticatorTransport string
|
||||
)
|
||||
|
||||
const (
|
||||
// Platform represents a platform authenticator is attached using a client device-specific transport, called
|
||||
// platform attachment, and is usually not removable from the client device. A public key credential bound to a
|
||||
// platform authenticator is called a platform credential.
|
||||
Platform AuthenticatorAttachment = "platform"
|
||||
|
||||
// CrossPlatform represents a roaming authenticator is attached using cross-platform transports, called
|
||||
// cross-platform attachment. Authenticators of this class are removable from, and can "roam" among, client devices.
|
||||
// A public key credential bound to a roaming authenticator is called a roaming credential.
|
||||
CrossPlatform AuthenticatorAttachment = "cross-platform"
|
||||
)
|
||||
|
||||
func ParseAuthenticatorAttachment(s string) AuthenticatorAttachment {
|
||||
switch s {
|
||||
case "platform":
|
||||
return Platform
|
||||
default:
|
||||
return CrossPlatform
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
// USB indicates the respective authenticator can be contacted over removable USB.
|
||||
USB AuthenticatorTransport = "usb"
|
||||
|
||||
// NFC indicates the respective authenticator can be contacted over Near Field Communication (NFC).
|
||||
NFC AuthenticatorTransport = "nfc"
|
||||
|
||||
// BLE indicates the respective authenticator can be contacted over Bluetooth Smart (Bluetooth Low Energy / BLE).
|
||||
BLE AuthenticatorTransport = "ble"
|
||||
|
||||
// SmartCard indicates the respective authenticator can be contacted over ISO/IEC 7816 smart card with contacts.
|
||||
//
|
||||
// WebAuthn Level 3.
|
||||
SmartCard AuthenticatorTransport = "smart-card"
|
||||
|
||||
// Hybrid indicates the respective authenticator can be contacted using a combination of (often separate)
|
||||
// data-transport and proximity mechanisms. This supports, for example, authentication on a desktop computer using
|
||||
// a smartphone.
|
||||
//
|
||||
// WebAuthn Level 3.
|
||||
Hybrid AuthenticatorTransport = "hybrid"
|
||||
|
||||
// Internal indicates the respective authenticator is contacted using a client device-specific transport, i.e., it
|
||||
// is a platform authenticator. These authenticators are not removable from the client device.
|
||||
Internal AuthenticatorTransport = "internal"
|
||||
)
|
||||
|
||||
func ParseAuthenticatorTransport(s string) AuthenticatorTransport {
|
||||
switch s {
|
||||
case "usb":
|
||||
return USB
|
||||
case "nfc":
|
||||
return NFC
|
||||
case "ble":
|
||||
return BLE
|
||||
case "smart-card":
|
||||
return SmartCard
|
||||
case "hybrid":
|
||||
return Hybrid
|
||||
default:
|
||||
return Internal
|
||||
}
|
||||
}
|
||||
|
||||
type AuthenticatorFlags byte
|
||||
|
||||
const (
|
||||
// FlagUserPresent Bit 00000001 in the byte sequence. Tells us if user is present. Also referred to as the UP flag.
|
||||
FlagUserPresent AuthenticatorFlags = 1 << iota // Referred to as UP
|
||||
|
||||
// FlagRFU1 is a reserved for future use flag.
|
||||
FlagRFU1
|
||||
|
||||
// FlagUserVerified Bit 00000100 in the byte sequence. Tells us if user is verified
|
||||
// by the authenticator using a biometric or PIN. Also referred to as the UV flag.
|
||||
FlagUserVerified
|
||||
|
||||
// FlagBackupEligible Bit 00001000 in the byte sequence. Tells us if a backup is eligible for device. Also referred
|
||||
// to as the BE flag.
|
||||
FlagBackupEligible // Referred to as BE
|
||||
|
||||
// FlagBackupState Bit 00010000 in the byte sequence. Tells us if a backup state for device. Also referred to as the
|
||||
// BS flag.
|
||||
FlagBackupState
|
||||
|
||||
// FlagRFU2 is a reserved for future use flag.
|
||||
FlagRFU2
|
||||
|
||||
// FlagAttestedCredentialData Bit 01000000 in the byte sequence. Indicates whether
|
||||
// the authenticator added attested credential data. Also referred to as the AT flag.
|
||||
FlagAttestedCredentialData
|
||||
|
||||
// FlagHasExtensions Bit 10000000 in the byte sequence. Indicates if the authenticator data has extensions. Also
|
||||
// referred to as the ED flag.
|
||||
FlagHasExtensions
|
||||
)
|
||||
|
||||
type AttestationFormat string
|
||||
|
||||
const (
|
||||
// AttestationFormatPacked is the "packed" attestation statement format is a WebAuthn-optimized format for
|
||||
// attestation. It uses a very compact but still extensible encoding method. This format is implementable by
|
||||
// authenticators with limited resources (e.g., secure elements).
|
||||
AttestationFormatPacked AttestationFormat = "packed"
|
||||
|
||||
// AttestationFormatTPM is the TPM attestation statement format returns an attestation statement in the same format
|
||||
// as the packed attestation statement format, although the rawData and signature fields are computed differently.
|
||||
AttestationFormatTPM AttestationFormat = "tpm"
|
||||
|
||||
// AttestationFormatAndroidKey is the attestation statement format for platform authenticators on versions "N", and
|
||||
// later, which may provide this proprietary "hardware attestation" statement.
|
||||
AttestationFormatAndroidKey AttestationFormat = "android-key"
|
||||
|
||||
// AttestationFormatAndroidSafetyNet is the attestation statement format that Android-based platform authenticators
|
||||
// MAY produce an attestation statement based on the Android SafetyNet API.
|
||||
AttestationFormatAndroidSafetyNet AttestationFormat = "android-safetynet"
|
||||
|
||||
// AttestationFormatFIDOUniversalSecondFactor is the attestation statement format that is used with FIDO U2F
|
||||
// authenticators.
|
||||
AttestationFormatFIDOUniversalSecondFactor AttestationFormat = "fido-u2f"
|
||||
|
||||
// AttestationFormatApple is the attestation statement format that is used with Apple devices' platform
|
||||
// authenticators.
|
||||
AttestationFormatApple AttestationFormat = "apple"
|
||||
|
||||
// AttestationFormatNone is the attestation statement format that is used to replace any authenticator-provided
|
||||
// attestation statement when a WebAuthn Relying Party indicates it does not wish to receive attestation information.
|
||||
AttestationFormatNone AttestationFormat = "none"
|
||||
)
|
||||
|
||||
func ExtractAttestationFormats(p *types.Params) []AttestationFormat {
|
||||
var formats []AttestationFormat
|
||||
for _, v := range p.AttestationFormats {
|
||||
formats = append(formats, parseAttestationFormat(v))
|
||||
}
|
||||
return formats
|
||||
}
|
||||
|
||||
func parseAttestationFormat(s string) AttestationFormat {
|
||||
switch s {
|
||||
case "packed":
|
||||
return AttestationFormatPacked
|
||||
case "tpm":
|
||||
return AttestationFormatTPM
|
||||
case "android-key":
|
||||
return AttestationFormatAndroidKey
|
||||
case "android-safetynet":
|
||||
return AttestationFormatAndroidSafetyNet
|
||||
case "fido-u2f":
|
||||
return AttestationFormatFIDOUniversalSecondFactor
|
||||
case "apple":
|
||||
return AttestationFormatApple
|
||||
case "none":
|
||||
return AttestationFormatNone
|
||||
default:
|
||||
return AttestationFormatPacked
|
||||
}
|
||||
}
|
||||
|
||||
type CredentialType string
|
||||
|
||||
const (
|
||||
CredentialTypePublicKeyCredential CredentialType = "public-key"
|
||||
)
|
||||
|
||||
type ConveyancePreference string
|
||||
|
||||
const (
|
||||
// PreferNoAttestation is a ConveyancePreference value.
|
||||
//
|
||||
// This value indicates that the Relying Party is not interested in authenticator attestation. For example, in order
|
||||
// to potentially avoid having to obtain user consent to relay identifying information to the Relying Party, or to
|
||||
// save a round trip to an Attestation CA or Anonymization CA.
|
||||
//
|
||||
// This is the default value.
|
||||
//
|
||||
// Specification: §5.4.7. Attestation Conveyance Preference Enumeration (https://www.w3.org/TR/webauthn/#dom-attestationconveyancepreference-none)
|
||||
PreferNoAttestation ConveyancePreference = "none"
|
||||
|
||||
// PreferIndirectAttestation is a ConveyancePreference value.
|
||||
//
|
||||
// This value indicates that the Relying Party prefers an attestation conveyance yielding verifiable attestation
|
||||
// statements, but allows the client to decide how to obtain such attestation statements. The client MAY replace the
|
||||
// authenticator-generated attestation statements with attestation statements generated by an Anonymization CA, in
|
||||
// order to protect the user’s privacy, or to assist Relying Parties with attestation verification in a
|
||||
// heterogeneous ecosystem.
|
||||
//
|
||||
// Note: There is no guarantee that the Relying Party will obtain a verifiable attestation statement in this case.
|
||||
// For example, in the case that the authenticator employs self attestation.
|
||||
//
|
||||
// Specification: §5.4.7. Attestation Conveyance Preference Enumeration (https://www.w3.org/TR/webauthn/#dom-attestationconveyancepreference-indirect)
|
||||
PreferIndirectAttestation ConveyancePreference = "indirect"
|
||||
|
||||
// PreferDirectAttestation is a ConveyancePreference value.
|
||||
//
|
||||
// This value indicates that the Relying Party wants to receive the attestation statement as generated by the
|
||||
// authenticator.
|
||||
//
|
||||
// Specification: §5.4.7. Attestation Conveyance Preference Enumeration (https://www.w3.org/TR/webauthn/#dom-attestationconveyancepreference-direct)
|
||||
PreferDirectAttestation ConveyancePreference = "direct"
|
||||
|
||||
// PreferEnterpriseAttestation is a ConveyancePreference value.
|
||||
//
|
||||
// This value indicates that the Relying Party wants to receive an attestation statement that may include uniquely
|
||||
// identifying information. This is intended for controlled deployments within an enterprise where the organization
|
||||
// wishes to tie registrations to specific authenticators. User agents MUST NOT provide such an attestation unless
|
||||
// the user agent or authenticator configuration permits it for the requested RP ID.
|
||||
//
|
||||
// If permitted, the user agent SHOULD signal to the authenticator (at invocation time) that enterprise
|
||||
// attestation is requested, and convey the resulting AAGUID and attestation statement, unaltered, to the Relying
|
||||
// Party.
|
||||
//
|
||||
// Specification: §5.4.7. Attestation Conveyance Preference Enumeration (https://www.w3.org/TR/webauthn/#dom-attestationconveyancepreference-enterprise)
|
||||
PreferEnterpriseAttestation ConveyancePreference = "enterprise"
|
||||
)
|
||||
|
||||
func ExtractConveyancePreference(p *types.Params) ConveyancePreference {
|
||||
switch p.ConveyancePreference {
|
||||
case "none":
|
||||
return PreferNoAttestation
|
||||
case "indirect":
|
||||
return PreferIndirectAttestation
|
||||
case "direct":
|
||||
return PreferDirectAttestation
|
||||
case "enterprise":
|
||||
return PreferEnterpriseAttestation
|
||||
default:
|
||||
return PreferNoAttestation
|
||||
}
|
||||
}
|
||||
|
||||
type PublicKeyCredentialHints string
|
||||
|
||||
const (
|
||||
// PublicKeyCredentialHintSecurityKey is a PublicKeyCredentialHint that indicates that the Relying Party believes
|
||||
// that users will satisfy this request with a physical security key. For example, an enterprise Relying Party may
|
||||
// set this hint if they have issued security keys to their employees and will only accept those authenticators for
|
||||
// registration and authentication.
|
||||
//
|
||||
// For compatibility with older user agents, when this hint is used in PublicKeyCredentialCreationOptions, the
|
||||
// authenticatorAttachment SHOULD be set to cross-platform.
|
||||
PublicKeyCredentialHintSecurityKey PublicKeyCredentialHints = "security-key"
|
||||
|
||||
// PublicKeyCredentialHintClientDevice is a PublicKeyCredentialHint that indicates that the Relying Party believes
|
||||
// that users will satisfy this request with a platform authenticator attached to the client device.
|
||||
//
|
||||
// For compatibility with older user agents, when this hint is used in PublicKeyCredentialCreationOptions, the
|
||||
// authenticatorAttachment SHOULD be set to platform.
|
||||
PublicKeyCredentialHintClientDevice PublicKeyCredentialHints = "client-device"
|
||||
|
||||
// PublicKeyCredentialHintHybrid is a PublicKeyCredentialHint that indicates that the Relying Party believes that
|
||||
// users will satisfy this request with general-purpose authenticators such as smartphones. For example, a consumer
|
||||
// Relying Party may believe that only a small fraction of their customers possesses dedicated security keys. This
|
||||
// option also implies that the local platform authenticator should not be promoted in the UI.
|
||||
//
|
||||
// For compatibility with older user agents, when this hint is used in PublicKeyCredentialCreationOptions, the
|
||||
// authenticatorAttachment SHOULD be set to cross-platform.
|
||||
PublicKeyCredentialHintHybrid PublicKeyCredentialHints = "hybrid"
|
||||
)
|
||||
|
||||
func ParsePublicKeyCredentialHints(s string) PublicKeyCredentialHints {
|
||||
switch s {
|
||||
case "security-key":
|
||||
return PublicKeyCredentialHintSecurityKey
|
||||
case "client-device":
|
||||
return PublicKeyCredentialHintClientDevice
|
||||
case "hybrid":
|
||||
return PublicKeyCredentialHintHybrid
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
type AttestedCredentialData struct {
|
||||
AAGUID []byte `json:"aaguid"`
|
||||
CredentialID []byte `json:"credential_id"`
|
||||
|
||||
// The raw credential public key bytes received from the attestation data.
|
||||
CredentialPublicKey []byte `json:"public_key"`
|
||||
}
|
||||
|
||||
type ResidentKeyRequirement string
|
||||
|
||||
const (
|
||||
// ResidentKeyRequirementDiscouraged indicates the Relying Party prefers creating a server-side credential, but will
|
||||
// accept a client-side discoverable credential. This is the default.
|
||||
ResidentKeyRequirementDiscouraged ResidentKeyRequirement = "discouraged"
|
||||
|
||||
// ResidentKeyRequirementPreferred indicates to the client we would prefer a discoverable credential.
|
||||
ResidentKeyRequirementPreferred ResidentKeyRequirement = "preferred"
|
||||
|
||||
// ResidentKeyRequirementRequired indicates the Relying Party requires a client-side discoverable credential, and is
|
||||
// prepared to receive an error if a client-side discoverable credential cannot be created.
|
||||
ResidentKeyRequirementRequired ResidentKeyRequirement = "required"
|
||||
)
|
||||
|
||||
func ParseResidentKeyRequirement(s string) ResidentKeyRequirement {
|
||||
switch s {
|
||||
case "discouraged":
|
||||
return ResidentKeyRequirementDiscouraged
|
||||
case "preferred":
|
||||
return ResidentKeyRequirementPreferred
|
||||
default:
|
||||
return ResidentKeyRequirementRequired
|
||||
}
|
||||
}
|
||||
|
||||
type (
|
||||
AuthenticationExtensions map[string]any
|
||||
UserVerificationRequirement string
|
||||
)
|
||||
|
||||
const (
|
||||
// VerificationRequired User verification is required to create/release a credential
|
||||
VerificationRequired UserVerificationRequirement = "required"
|
||||
|
||||
// VerificationPreferred User verification is preferred to create/release a credential
|
||||
VerificationPreferred UserVerificationRequirement = "preferred" // This is the default
|
||||
|
||||
// VerificationDiscouraged The authenticator should not verify the user for the credential
|
||||
VerificationDiscouraged UserVerificationRequirement = "discouraged"
|
||||
)
|
||||
@@ -0,0 +1,82 @@
|
||||
package builder
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
)
|
||||
|
||||
type AuthenticatorResponse struct {
|
||||
// From the spec https://www.w3.org/TR/webauthn/#dom-authenticatorresponse-clientdatajson
|
||||
// This attribute contains a JSON serialization of the client data passed to the authenticator
|
||||
// by the client in its call to either create() or get().
|
||||
ClientDataJSON URLEncodedBase64 `json:"clientDataJSON"`
|
||||
}
|
||||
|
||||
type AuthenticatorAttestationResponse struct {
|
||||
// The byte slice of clientDataJSON, which becomes CollectedClientData
|
||||
AuthenticatorResponse
|
||||
|
||||
Transports []string `json:"transports,omitempty"`
|
||||
|
||||
AuthenticatorData URLEncodedBase64 `json:"authenticatorData"`
|
||||
|
||||
PublicKey URLEncodedBase64 `json:"publicKey"`
|
||||
|
||||
PublicKeyAlgorithm int64 `json:"publicKeyAlgorithm"`
|
||||
|
||||
// AttestationObject is the byte slice version of attestationObject.
|
||||
// This attribute contains an attestation object, which is opaque to, and
|
||||
// cryptographically protected against tampering by, the client. The
|
||||
// attestation object contains both authenticator data and an attestation
|
||||
// statement. The former contains the AAGUID, a unique credential ID, and
|
||||
// the credential public key. The contents of the attestation statement are
|
||||
// determined by the attestation statement format used by the authenticator.
|
||||
// It also contains any additional information that the Relying Party's server
|
||||
// requires to validate the attestation statement, as well as to decode and
|
||||
// validate the authenticator data along with the JSON-serialized client data.
|
||||
AttestationObject URLEncodedBase64 `json:"attestationObject"`
|
||||
}
|
||||
|
||||
type PublicKeyCredentialCreationOptions struct {
|
||||
RelyingParty RelyingPartyEntity `json:"rp"`
|
||||
User UserEntity `json:"user"`
|
||||
Challenge URLEncodedBase64 `json:"challenge"`
|
||||
Parameters []CredentialParameter `json:"pubKeyCredParams,omitempty"`
|
||||
Timeout int `json:"timeout,omitempty"`
|
||||
CredentialExcludeList []CredentialDescriptor `json:"excludeCredentials,omitempty"`
|
||||
AuthenticatorSelection AuthenticatorSelection `json:"authenticatorSelection,omitempty"`
|
||||
Hints []PublicKeyCredentialHints `json:"hints,omitempty"`
|
||||
Attestation ConveyancePreference `json:"attestation,omitempty"`
|
||||
AttestationFormats []AttestationFormat `json:"attestationFormats,omitempty"`
|
||||
Extensions AuthenticationExtensions `json:"extensions,omitempty"`
|
||||
}
|
||||
|
||||
func NewRegistrationOptions(origin string, subject string, vaultCID string, params *types.Params) (*PublicKeyCredentialCreationOptions, error) {
|
||||
chal, err := CreateChallenge()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &PublicKeyCredentialCreationOptions{
|
||||
RelyingParty: NewRelayingParty(origin, subject),
|
||||
User: NewUserEntity(subject, subject, vaultCID),
|
||||
Parameters: ExtractCredentialParameters(params),
|
||||
Timeout: 20,
|
||||
CredentialExcludeList: nil,
|
||||
Challenge: chal,
|
||||
AuthenticatorSelection: AuthenticatorSelection{},
|
||||
Hints: nil,
|
||||
Attestation: ExtractConveyancePreference(params),
|
||||
AttestationFormats: ExtractAttestationFormats(params),
|
||||
Extensions: nil,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func UnmarshalAuthenticatorResponse(data []byte) (*AuthenticatorResponse, error) {
|
||||
var ar AuthenticatorResponse
|
||||
err := json.Unmarshal(data, &ar)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ar, nil
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package builder
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
|
||||
"github.com/go-webauthn/webauthn/protocol/webauthncose"
|
||||
)
|
||||
|
||||
// PublicKey is an interface for a public key
|
||||
type PublicKey interface {
|
||||
cryptotypes.PubKey
|
||||
Clone() cryptotypes.PubKey
|
||||
GetRaw() []byte
|
||||
GetRole() types.KeyRole
|
||||
GetAlgorithm() types.KeyAlgorithm
|
||||
GetEncoding() types.KeyEncoding
|
||||
GetCurve() types.KeyCurve
|
||||
GetKeyType() types.KeyType
|
||||
}
|
||||
|
||||
// CreateAuthnVerification creates a new verification method for an authn method
|
||||
func CreateAuthnVerification(namespace types.DIDNamespace, issuer string, controller string, pubkey *types.PubKey, identifier string) *types.VerificationMethod {
|
||||
return &types.VerificationMethod{
|
||||
Method: namespace,
|
||||
Controller: controller,
|
||||
PublicKey: pubkey,
|
||||
Id: identifier,
|
||||
Issuer: issuer,
|
||||
}
|
||||
}
|
||||
|
||||
// CreateWalletVerification creates a new verification method for a wallet
|
||||
func CreateWalletVerification(namespace types.DIDNamespace, controller string, pubkey *types.PubKey, identifier string) *types.VerificationMethod {
|
||||
return &types.VerificationMethod{
|
||||
Method: namespace,
|
||||
Controller: controller,
|
||||
PublicKey: pubkey,
|
||||
Id: identifier,
|
||||
}
|
||||
}
|
||||
|
||||
// ExtractWebAuthnPublicKey parses the raw public key bytes and returns a JWK representation
|
||||
func ExtractWebAuthnPublicKey(keyBytes []byte) (*types.JWK, error) {
|
||||
key, err := webauthncose.ParsePublicKey(keyBytes)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse public key: %w", err)
|
||||
}
|
||||
|
||||
switch k := key.(type) {
|
||||
case *webauthncose.EC2PublicKeyData:
|
||||
return FormatEC2PublicKey(k)
|
||||
case *webauthncose.RSAPublicKeyData:
|
||||
return FormatRSAPublicKey(k)
|
||||
case *webauthncose.OKPPublicKeyData:
|
||||
return FormatOKPPublicKey(k)
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported key type")
|
||||
}
|
||||
}
|
||||
|
||||
// NewInitialWalletAccounts creates a new set of verification methods for a wallet
|
||||
func NewInitialWalletAccounts(controller string, pubkey *types.PubKey) ([]*types.VerificationMethod, error) {
|
||||
var verificationMethods []*types.VerificationMethod
|
||||
for method, chain := range types.InitialChainCodes {
|
||||
nk, err := computeBip32AccountPublicKey(pubkey, chain, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
addr, err := chain.FormatAddress(nk)
|
||||
if err != nil {
|
||||
return nil, nil
|
||||
}
|
||||
verificationMethods = append(verificationMethods, CreateWalletVerification(method, controller, nk, method.FormatDID(addr)))
|
||||
}
|
||||
return verificationMethods, nil
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package builder
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
)
|
||||
|
||||
// ChallengeLength - Length of bytes to generate for a challenge.
|
||||
const ChallengeLength = 32
|
||||
|
||||
// CreateChallenge creates a new challenge that should be signed and returned by the authenticator. The spec recommends
|
||||
// using at least 16 bytes with 100 bits of entropy. We use 32 bytes.
|
||||
func CreateChallenge() (challenge URLEncodedBase64, err error) {
|
||||
challenge = make([]byte, ChallengeLength)
|
||||
|
||||
if _, err = rand.Read(challenge); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return challenge, nil
|
||||
}
|
||||
|
||||
type CredentialEntity struct {
|
||||
// A human-palatable name for the entity. Its function depends on what the PublicKeyCredentialEntity represents:
|
||||
//
|
||||
// When inherited by PublicKeyCredentialRpEntity it is a human-palatable identifier for the Relying Party,
|
||||
// intended only for display. For example, "ACME Corporation", "Wonderful Widgets, Inc." or "ОАО Примертех".
|
||||
//
|
||||
// When inherited by PublicKeyCredentialUserEntity, it is a human-palatable identifier for a user account. It is
|
||||
// intended only for display, i.e., aiding the user in determining the difference between user accounts with similar
|
||||
// displayNames. For example, "alexm", "alex.p.mueller@example.com" or "+14255551234".
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func NewCredentialEntity(name string) CredentialEntity {
|
||||
return CredentialEntity{
|
||||
Name: name,
|
||||
}
|
||||
}
|
||||
|
||||
type CredentialParameter struct {
|
||||
Type CredentialType `json:"type"`
|
||||
Algorithm types.COSEAlgorithmIdentifier `json:"alg"`
|
||||
}
|
||||
|
||||
func NewCredentialParameter(ki *types.KeyInfo) CredentialParameter {
|
||||
return CredentialParameter{
|
||||
Type: CredentialTypePublicKeyCredential,
|
||||
Algorithm: ki.Algorithm.CoseIdentifier(),
|
||||
}
|
||||
}
|
||||
|
||||
func ExtractCredentialParameters(p *types.Params) []CredentialParameter {
|
||||
var keys []*types.KeyInfo
|
||||
for _, v := range p.AllowedPublicKeys {
|
||||
if v.Role == types.KeyRole_KEY_ROLE_AUTHENTICATION {
|
||||
keys = append(keys, v)
|
||||
}
|
||||
}
|
||||
var cparams []CredentialParameter
|
||||
for _, ki := range keys {
|
||||
cparams = append(cparams, NewCredentialParameter(ki))
|
||||
}
|
||||
return cparams
|
||||
}
|
||||
|
||||
type RelyingPartyEntity struct {
|
||||
CredentialEntity
|
||||
|
||||
// A unique identifier for the Relying Party entity, which sets the RP ID.
|
||||
ID string `json:"id"`
|
||||
}
|
||||
|
||||
func NewRelayingParty(name string, origin string) RelyingPartyEntity {
|
||||
return RelyingPartyEntity{
|
||||
CredentialEntity: NewCredentialEntity(origin),
|
||||
ID: origin,
|
||||
}
|
||||
}
|
||||
|
||||
type UserEntity struct {
|
||||
CredentialEntity
|
||||
// A human-palatable name for the user account, intended only for display.
|
||||
// For example, "Alex P. Müller" or "田中 倫". The Relying Party SHOULD let
|
||||
// the user choose this, and SHOULD NOT restrict the choice more than necessary.
|
||||
DisplayName string `json:"displayName"`
|
||||
|
||||
// ID is the user handle of the user account entity. To ensure secure operation,
|
||||
// authentication and authorization decisions MUST be made on the basis of this id
|
||||
// member, not the displayName nor name members. See Section 6.1 of
|
||||
// [RFC8266](https://www.w3.org/TR/webauthn/#biblio-rfc8266).
|
||||
ID any `json:"id"`
|
||||
}
|
||||
|
||||
func NewUserEntity(name string, subject string, cid string) UserEntity {
|
||||
return UserEntity{
|
||||
CredentialEntity: NewCredentialEntity(name),
|
||||
DisplayName: subject,
|
||||
ID: cid,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package builder
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
type CredentialDescriptor struct {
|
||||
// The valid credential types.
|
||||
Type CredentialType `json:"type"`
|
||||
|
||||
// CredentialID The ID of a credential to allow/disallow.
|
||||
CredentialID URLEncodedBase64 `json:"id"`
|
||||
|
||||
// The authenticator transports that can be used.
|
||||
Transport []AuthenticatorTransport `json:"transports,omitempty"`
|
||||
|
||||
// The AttestationType from the Credential. Used internally only.
|
||||
AttestationType string `json:"-"`
|
||||
}
|
||||
|
||||
func NewCredentialDescriptor(credentialID string, transports []AuthenticatorTransport, attestationType string) *CredentialDescriptor {
|
||||
return &CredentialDescriptor{
|
||||
CredentialID: URLEncodedBase64(credentialID),
|
||||
Transport: transports,
|
||||
AttestationType: attestationType,
|
||||
Type: CredentialTypePublicKeyCredential,
|
||||
}
|
||||
}
|
||||
|
||||
type AuthenticatorSelection struct {
|
||||
// AuthenticatorAttachment If this member is present, eligible authenticators are filtered to only
|
||||
// authenticators attached with the specified AuthenticatorAttachment enum.
|
||||
AuthenticatorAttachment AuthenticatorAttachment `json:"authenticatorAttachment,omitempty"`
|
||||
|
||||
// RequireResidentKey this member describes the Relying Party's requirements regarding resident
|
||||
// credentials. If the parameter is set to true, the authenticator MUST create a client-side-resident
|
||||
// public key credential source when creating a public key credential.
|
||||
RequireResidentKey *bool `json:"requireResidentKey,omitempty"`
|
||||
|
||||
// ResidentKey this member describes the Relying Party's requirements regarding resident
|
||||
// credentials per Webauthn Level 2.
|
||||
ResidentKey ResidentKeyRequirement `json:"residentKey,omitempty"`
|
||||
|
||||
// UserVerification This member describes the Relying Party's requirements regarding user verification for
|
||||
// the create() operation. Eligible authenticators are filtered to only those capable of satisfying this
|
||||
// requirement.
|
||||
UserVerification UserVerificationRequirement `json:"userVerification,omitempty"`
|
||||
}
|
||||
|
||||
type AuthenticatorData struct {
|
||||
RPIDHash []byte `json:"rpid"`
|
||||
Flags AuthenticatorFlags `json:"flags"`
|
||||
Counter uint32 `json:"sign_count"`
|
||||
AttData AttestedCredentialData `json:"att_data"`
|
||||
ExtData []byte `json:"ext_data"`
|
||||
}
|
||||
|
||||
type AttestationObject struct {
|
||||
// The authenticator data, including the newly created public key. See AuthenticatorData for more info
|
||||
AuthData AuthenticatorData
|
||||
|
||||
// The byteform version of the authenticator data, used in part for signature validation
|
||||
RawAuthData []byte `json:"authData"`
|
||||
|
||||
// The format of the Attestation data.
|
||||
Format string `json:"fmt"`
|
||||
|
||||
// The attestation statement data sent back if attestation is requested.
|
||||
AttStatement map[string]any `json:"attStmt,omitempty"`
|
||||
}
|
||||
|
||||
type URLEncodedBase64 []byte
|
||||
|
||||
func (e URLEncodedBase64) String() string {
|
||||
return base64.RawURLEncoding.EncodeToString(e)
|
||||
}
|
||||
|
||||
// UnmarshalJSON base64 decodes a URL-encoded value, storing the result in the
|
||||
// provided byte slice.
|
||||
func (e *URLEncodedBase64) UnmarshalJSON(data []byte) error {
|
||||
if bytes.Equal(data, []byte("null")) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Trim the leading spaces.
|
||||
data = bytes.Trim(data, "\"")
|
||||
|
||||
// Trim the trailing equal characters.
|
||||
data = bytes.TrimRight(data, "=")
|
||||
|
||||
out := make([]byte, base64.RawURLEncoding.DecodedLen(len(data)))
|
||||
|
||||
n, err := base64.RawURLEncoding.Decode(out, data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
v := reflect.ValueOf(e).Elem()
|
||||
v.SetBytes(out[:n])
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON base64 encodes a non URL-encoded value, storing the result in the
|
||||
// provided byte slice.
|
||||
func (e URLEncodedBase64) MarshalJSON() ([]byte, error) {
|
||||
if e == nil {
|
||||
return []byte("null"), nil
|
||||
}
|
||||
|
||||
return []byte(`"` + base64.RawURLEncoding.EncodeToString(e) + `"`), nil
|
||||
}
|
||||
@@ -2,8 +2,11 @@ package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"cosmossdk.io/log"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
)
|
||||
|
||||
@@ -35,3 +38,38 @@ func (k *Keeper) ExportGenesis(ctx context.Context) *types.GenesisState {
|
||||
Params: params,
|
||||
}
|
||||
}
|
||||
|
||||
// CheckValidatorExists checks if a validator exists
|
||||
func (k Keeper) CheckValidatorExists(ctx sdk.Context, addr string) bool {
|
||||
address, err := sdk.ValAddressFromBech32(addr)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
ok, err := k.StakingKeeper.Validator(ctx, address)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if ok != nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetAverageBlockTime returns the average block time in seconds
|
||||
func (k Keeper) GetAverageBlockTime(ctx sdk.Context) float64 {
|
||||
return float64(ctx.BlockTime().Sub(ctx.BlockTime()).Seconds())
|
||||
}
|
||||
|
||||
// GetParams returns the module parameters.
|
||||
func (k Keeper) GetParams(ctx sdk.Context) *types.Params {
|
||||
p, err := k.Params.Get(ctx)
|
||||
if err != nil {
|
||||
p = types.DefaultParams()
|
||||
}
|
||||
return &p
|
||||
}
|
||||
|
||||
// GetExpirationBlockHeight returns the block height at which the given duration will have passed
|
||||
func (k Keeper) GetExpirationBlockHeight(ctx sdk.Context, duration time.Duration) int64 {
|
||||
return ctx.BlockHeight() + int64(duration.Seconds()/k.GetAverageBlockTime(ctx))
|
||||
}
|
||||
|
||||
+62
-12
@@ -1,32 +1,82 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/ipfs/boxo/files"
|
||||
"github.com/ipfs/boxo/path"
|
||||
"github.com/ipfs/kubo/client/rpc"
|
||||
"github.com/ipfs/kubo/core/coreiface/options"
|
||||
"github.com/onsonr/sonr/internal/vfs"
|
||||
)
|
||||
|
||||
// AddToLocalIPFS adds a file to the local IPFS node
|
||||
func (k Keeper) AddToLocalIPFS(ctx sdk.Context, data files.Node) (string, error) {
|
||||
cid, err := k.ipfsClient.Unixfs().Add(ctx, data)
|
||||
// assembleInitialVault assembles the initial vault
|
||||
func (k Keeper) assembleInitialVault(ctx sdk.Context) (string, int64, error) {
|
||||
cid, err := k.ipfsClient.Unixfs().Add(context.Background(), vfs.AssembleDirectory())
|
||||
if err != nil {
|
||||
return "", err
|
||||
return "", 0, err
|
||||
}
|
||||
return cid.String(), nil
|
||||
return cid.String(), k.GetExpirationBlockHeight(ctx, time.Second*15), nil
|
||||
}
|
||||
|
||||
// GetFromLocalIPFS gets a file from the local IPFS node
|
||||
func (k Keeper) GetFromLocalIPFS(ctx sdk.Context, cid string) (files.Node, error) {
|
||||
// pinInitialVault pins the initial vault to the local IPFS node
|
||||
func (k Keeper) pinInitialVault(_ sdk.Context, cid string, address string) error {
|
||||
// Resolve the path
|
||||
path, err := path.NewPath(cid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 1. Initialize vault.db sqlite database in local IPFS with Mount
|
||||
|
||||
// 2. Insert the InitialWalletAccounts
|
||||
|
||||
// 3. Publish the path to the IPNS
|
||||
_, err = k.ipfsClient.Name().Publish(context.Background(), path, options.Name.Key(address))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 4. Insert the accounts into x/auth
|
||||
|
||||
// 5. Insert the controller into state
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetFromIPFS gets a file from the local IPFS node
|
||||
func (k Keeper) GetFromIPFS(ctx sdk.Context, cid string) (files.Directory, error) {
|
||||
path, err := path.NewPath(cid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return k.ipfsClient.Unixfs().Get(ctx, path)
|
||||
node, err := k.ipfsClient.Unixfs().Get(ctx, path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dir, ok := node.(files.Directory)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("retrieved node is not a directory")
|
||||
}
|
||||
return dir, nil
|
||||
}
|
||||
|
||||
// HasPathInLocalIPFS checks if a file is in the local IPFS node
|
||||
func (k Keeper) HasPathInLocalIPFS(ctx sdk.Context, cid string) (bool, error) {
|
||||
// HasIPFSConnection returns true if the IPFS client is initialized
|
||||
func (k *Keeper) HasIPFSConnection() bool {
|
||||
if k.ipfsClient == nil {
|
||||
ipfsClient, err := rpc.NewLocalApi()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
k.ipfsClient = ipfsClient
|
||||
}
|
||||
return k.ipfsClient != nil
|
||||
}
|
||||
|
||||
// HasPathInIPFS checks if a file is in the local IPFS node
|
||||
func (k Keeper) HasPathInIPFS(ctx sdk.Context, cid string) (bool, error) {
|
||||
path, err := path.NewPath(cid)
|
||||
if err != nil {
|
||||
return false, err
|
||||
@@ -42,8 +92,8 @@ func (k Keeper) HasPathInLocalIPFS(ctx sdk.Context, cid string) (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// PinToLocalIPFS pins a file to the local IPFS node
|
||||
func (k Keeper) PinToLocalIPFS(ctx sdk.Context, cid string, name string) error {
|
||||
// PinToIPFS pins a file to the local IPFS node
|
||||
func (k Keeper) PinToIPFS(ctx sdk.Context, cid string, name string) error {
|
||||
path, err := path.NewPath(cid)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
+72
-9
@@ -6,6 +6,7 @@ import (
|
||||
"cosmossdk.io/log"
|
||||
"cosmossdk.io/orm/model/ormdb"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
@@ -13,6 +14,7 @@ import (
|
||||
"github.com/ipfs/kubo/client/rpc"
|
||||
|
||||
apiv1 "github.com/onsonr/sonr/api/did/v1"
|
||||
middleware "github.com/onsonr/sonr/x/did/middleware"
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
)
|
||||
|
||||
@@ -35,13 +37,23 @@ type Keeper struct {
|
||||
}
|
||||
|
||||
// NewKeeper creates a new poa Keeper instance
|
||||
func NewKeeper(cdc codec.BinaryCodec, storeService storetypes.KVStoreService, accKeeper authkeeper.AccountKeeper, stkKeeper *stakkeeper.Keeper, logger log.Logger, authority string) Keeper {
|
||||
func NewKeeper(
|
||||
cdc codec.BinaryCodec,
|
||||
storeService storetypes.KVStoreService,
|
||||
accKeeper authkeeper.AccountKeeper,
|
||||
stkKeeper *stakkeeper.Keeper,
|
||||
logger log.Logger,
|
||||
authority string,
|
||||
) Keeper {
|
||||
logger = logger.With(log.ModuleKey, "x/"+types.ModuleName)
|
||||
sb := collections.NewSchemaBuilder(storeService)
|
||||
if authority == "" {
|
||||
authority = authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
||||
}
|
||||
db, err := ormdb.NewModuleDB(&types.ORMModuleSchema, ormdb.ModuleDBOptions{KVStoreService: storeService})
|
||||
db, err := ormdb.NewModuleDB(
|
||||
&types.ORMModuleSchema,
|
||||
ormdb.ModuleDBOptions{KVStoreService: storeService},
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -53,10 +65,15 @@ func NewKeeper(cdc codec.BinaryCodec, storeService storetypes.KVStoreService, ac
|
||||
// Initialize IPFS client
|
||||
ipfsClient, _ := rpc.NewLocalApi()
|
||||
k := Keeper{
|
||||
ipfsClient: ipfsClient,
|
||||
cdc: cdc,
|
||||
logger: logger,
|
||||
Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)),
|
||||
ipfsClient: ipfsClient,
|
||||
cdc: cdc,
|
||||
logger: logger,
|
||||
Params: collections.NewItem(
|
||||
sb,
|
||||
types.ParamsKey,
|
||||
"params",
|
||||
codec.CollValue[types.Params](cdc),
|
||||
),
|
||||
authority: authority,
|
||||
OrmDB: store,
|
||||
AccountKeeper: accKeeper,
|
||||
@@ -71,7 +88,53 @@ func NewKeeper(cdc codec.BinaryCodec, storeService storetypes.KVStoreService, ac
|
||||
return k
|
||||
}
|
||||
|
||||
// HasIPFSConnection returns true if the IPFS client is initialized
|
||||
func (k *Keeper) HasIPFSConnection() bool {
|
||||
return k.ipfsClient != nil
|
||||
// IsClaimedServiceOrigin checks if a service origin is unclaimed
|
||||
func (k Keeper) IsUnclaimedServiceOrigin(ctx sdk.Context, origin string) bool {
|
||||
rec, _ := k.OrmDB.ServiceRecordTable().GetByOriginUri(ctx, origin)
|
||||
return rec == nil
|
||||
}
|
||||
|
||||
// IsValidServiceOrigin checks if a service origin is valid
|
||||
func (k Keeper) IsValidServiceOrigin(ctx sdk.Context, origin string, clientInfo *middleware.ClientInfo) bool {
|
||||
if origin != clientInfo.Hostname {
|
||||
return false
|
||||
}
|
||||
rec, err := k.OrmDB.ServiceRecordTable().GetByOriginUri(ctx, origin)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if rec == nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// VerifyMinimumStake checks if a validator has a minimum stake
|
||||
func (k Keeper) VerifyMinimumStake(ctx sdk.Context, addr string) bool {
|
||||
address, err := sdk.AccAddressFromBech32(addr)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
addval, err := sdk.ValAddressFromBech32(addr)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
del, err := k.StakingKeeper.GetDelegation(ctx, address, addval)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if del.Shares.IsZero() {
|
||||
return false
|
||||
}
|
||||
return del.Shares.IsPositive()
|
||||
}
|
||||
|
||||
// VerifyServicePermissions checks if a service has permission
|
||||
func (k Keeper) VerifyServicePermissions(
|
||||
ctx sdk.Context,
|
||||
addr string,
|
||||
service string,
|
||||
permissions string,
|
||||
) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
didv1 "github.com/onsonr/sonr/api/did/v1"
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
)
|
||||
|
||||
func convertServiceRecord(rec *didv1.ServiceRecord) *types.Service {
|
||||
return &types.Service{
|
||||
Origin: rec.OriginUri,
|
||||
}
|
||||
}
|
||||
+35
-22
@@ -2,8 +2,11 @@ package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"google.golang.org/genproto/googleapis/api/httpbody"
|
||||
"google.golang.org/grpc/peer"
|
||||
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
)
|
||||
@@ -19,43 +22,53 @@ func NewQuerier(keeper Keeper) Querier {
|
||||
}
|
||||
|
||||
// Params returns the total set of did parameters.
|
||||
func (k Querier) Params(c context.Context, req *types.QueryRequest) (*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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &types.QueryParamsResponse{Params: &p, IpfsActive: k.HasIPFSConnection()}, nil
|
||||
}
|
||||
|
||||
// Accounts implements types.QueryServer.
|
||||
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.QueryRequest) (*types.QueryCredentialsResponse, error) {
|
||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
return &types.QueryCredentialsResponse{}, nil
|
||||
params := p.ActiveParams(k.HasIPFSConnection())
|
||||
return &types.QueryParamsResponse{Params: ¶ms}, nil
|
||||
}
|
||||
|
||||
// Resolve implements types.QueryServer.
|
||||
func (k Querier) Resolve(goCtx context.Context, req *types.QueryRequest) (*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.QueryRequest) (*types.QueryServiceResponse, error) {
|
||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
return &types.QueryServiceResponse{}, nil
|
||||
func (k Querier) Service(
|
||||
goCtx context.Context,
|
||||
req *types.QueryRequest,
|
||||
) (*types.QueryServiceResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
|
||||
_, ok := peer.FromContext(goCtx)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("failed to get peer from context")
|
||||
}
|
||||
|
||||
rec, err := k.OrmDB.ServiceRecordTable().GetByOriginUri(ctx, req.Origin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &types.QueryServiceResponse{Service: convertServiceRecord(rec)}, nil
|
||||
}
|
||||
|
||||
// Token implements types.QueryServer.
|
||||
func (k Querier) Token(goCtx context.Context, req *types.QueryRequest) (*types.QueryTokenResponse, error) {
|
||||
// HTMX implements types.QueryServer.
|
||||
func (k Querier) HTMX(goCtx context.Context, req *types.QueryRequest) (*httpbody.HttpBody, error) {
|
||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
return &types.QueryTokenResponse{}, nil
|
||||
return &httpbody.HttpBody{
|
||||
ContentType: "text/html",
|
||||
Data: []byte("<html><body>HTMX</body></html>"),
|
||||
}, nil
|
||||
}
|
||||
|
||||
+79
-29
@@ -2,13 +2,14 @@ package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"cosmossdk.io/errors"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
|
||||
"cosmossdk.io/errors"
|
||||
didv1 "github.com/onsonr/sonr/api/did/v1"
|
||||
"github.com/onsonr/sonr/internal/files"
|
||||
"github.com/onsonr/sonr/x/did/builder"
|
||||
"github.com/onsonr/sonr/x/did/middleware"
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
)
|
||||
|
||||
@@ -24,62 +25,111 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer {
|
||||
}
|
||||
|
||||
// UpdateParams updates the x/did module parameters.
|
||||
func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
|
||||
func (ms msgServer) UpdateParams(
|
||||
ctx context.Context,
|
||||
msg *types.MsgUpdateParams,
|
||||
) (*types.MsgUpdateParamsResponse, error) {
|
||||
if ms.k.authority != msg.Authority {
|
||||
return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, msg.Authority)
|
||||
return nil, errors.Wrapf(
|
||||
govtypes.ErrInvalidSigner,
|
||||
"invalid authority; expected %s, got %s",
|
||||
ms.k.authority,
|
||||
msg.Authority,
|
||||
)
|
||||
}
|
||||
|
||||
return nil, ms.k.Params.Set(ctx, msg.Params)
|
||||
}
|
||||
|
||||
// Authorize implements types.MsgServer.
|
||||
func (ms msgServer) Authorize(ctx context.Context, msg *types.MsgAuthorize) (*types.MsgAuthorizeResponse, error) {
|
||||
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)
|
||||
return nil, errors.Wrapf(
|
||||
govtypes.ErrInvalidSigner,
|
||||
"invalid authority; expected %s, got %s",
|
||||
ms.k.authority,
|
||||
msg.Authority,
|
||||
)
|
||||
}
|
||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
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")
|
||||
func (ms msgServer) AllocateVault(
|
||||
goCtx context.Context,
|
||||
msg *types.MsgAllocateVault,
|
||||
) (*types.MsgAllocateVaultResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
clientInfo, err := middleware.ExtractClientInfo(goCtx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &types.MsgAllocateVaultResponse{}, nil
|
||||
|
||||
// 1.Check if the service origin is valid
|
||||
if ms.k.IsValidServiceOrigin(ctx, msg.Origin, clientInfo) {
|
||||
return nil, types.ErrInvalidServiceOrigin
|
||||
}
|
||||
|
||||
cid, expiryBlock, err := ms.k.assembleInitialVault(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
regOpts, err := builder.NewRegistrationOptions(msg.Origin, msg.Subject, cid, ms.k.GetParams(ctx))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Convert to string
|
||||
regOptsJSON, err := json.Marshal(regOpts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &types.MsgAllocateVaultResponse{
|
||||
ExpiryBlock: expiryBlock,
|
||||
Cid: cid,
|
||||
RegistrationOptions: string(regOptsJSON),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// RegisterController implements types.MsgServer.
|
||||
func (ms msgServer) RegisterController(goCtx context.Context, msg *types.MsgRegisterController) (*types.MsgRegisterControllerResponse, 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)
|
||||
svc := didv1.ServiceRecord{
|
||||
Controller: msg.Authority,
|
||||
}
|
||||
ms.k.OrmDB.ServiceRecordTable().Insert(ctx, &svc)
|
||||
func (ms msgServer) RegisterController(
|
||||
goCtx context.Context,
|
||||
msg *types.MsgRegisterController,
|
||||
) (*types.MsgRegisterControllerResponse, error) {
|
||||
_ = sdk.UnwrapSDKContext(goCtx)
|
||||
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.Controller {
|
||||
return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, msg.Controller)
|
||||
func (ms msgServer) RegisterService(
|
||||
goCtx context.Context,
|
||||
msg *types.MsgRegisterService,
|
||||
) (*types.MsgRegisterServiceResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
|
||||
clientInfo, err := middleware.ExtractClientInfo(goCtx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
svc := didv1.ServiceRecord{
|
||||
Controller: msg.Controller,
|
||||
// 1.Check if the service origin is valid
|
||||
if !ms.k.IsValidServiceOrigin(ctx, msg.OriginUri, clientInfo) {
|
||||
return nil, types.ErrInvalidServiceOrigin
|
||||
}
|
||||
ms.k.OrmDB.ServiceRecordTable().Insert(ctx, &svc)
|
||||
return &types.MsgRegisterServiceResponse{}, nil
|
||||
return ms.k.insertService(ctx, msg)
|
||||
}
|
||||
|
||||
// SyncVault implements types.MsgServer.
|
||||
func (ms msgServer) SyncVault(ctx context.Context, msg *types.MsgSyncVault) (*types.MsgSyncVaultResponse, error) {
|
||||
func (ms msgServer) SyncVault(
|
||||
ctx context.Context,
|
||||
msg *types.MsgSyncVault,
|
||||
) (*types.MsgSyncVaultResponse, error) {
|
||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
return &types.MsgSyncVaultResponse{}, nil
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
didv1 "github.com/onsonr/sonr/api/did/v1"
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
)
|
||||
|
||||
// insertService inserts a service record into the database
|
||||
func (k Keeper) insertService(
|
||||
ctx sdk.Context,
|
||||
svc *types.MsgRegisterService,
|
||||
) (*types.MsgRegisterServiceResponse, error) {
|
||||
record := didv1.ServiceRecord{
|
||||
Id: svc.OriginUri,
|
||||
}
|
||||
err := k.OrmDB.ServiceRecordTable().Insert(ctx, &record)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &types.MsgRegisterServiceResponse{
|
||||
Success: true,
|
||||
Did: record.Id,
|
||||
}, nil
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// CheckValidatorExists checks if a validator exists
|
||||
func (k Keeper) CheckValidatorExists(ctx sdk.Context, addr string) bool {
|
||||
address, err := sdk.ValAddressFromBech32(addr)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
ok, err := k.StakingKeeper.Validator(ctx, address)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if ok != nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetAverageBlockTime returns the average block time in seconds
|
||||
func (k Keeper) GetAverageBlockTime(ctx sdk.Context) float64 {
|
||||
return float64(ctx.BlockTime().Sub(ctx.BlockTime()).Seconds())
|
||||
}
|
||||
|
||||
// GetExpirationBlockHeight returns the block height at which the given duration will have passed
|
||||
func (k Keeper) GetExpirationBlockHeight(ctx sdk.Context, duration time.Duration) int64 {
|
||||
return ctx.BlockHeight() + int64(duration.Seconds()/k.GetAverageBlockTime(ctx))
|
||||
}
|
||||
|
||||
// ValidServiceOrigin checks if a service origin is valid
|
||||
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
|
||||
}
|
||||
|
||||
// VerifyMinimumStake checks if a validator has a minimum stake
|
||||
func (k Keeper) VerifyMinimumStake(ctx sdk.Context, addr string) bool {
|
||||
address, err := sdk.AccAddressFromBech32(addr)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
addval, err := sdk.ValAddressFromBech32(addr)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
del, err := k.StakingKeeper.GetDelegation(ctx, address, addval)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if del.Shares.IsZero() {
|
||||
return false
|
||||
}
|
||||
return del.Shares.IsPositive()
|
||||
}
|
||||
|
||||
// VerifyServicePermissions checks if a service has permission
|
||||
func (k Keeper) VerifyServicePermissions(ctx sdk.Context, addr string, service string, permissions string) bool {
|
||||
return false
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/peer"
|
||||
)
|
||||
|
||||
type ClientInfo struct {
|
||||
Authority string
|
||||
ContentType string
|
||||
UserAgent string
|
||||
Hostname string
|
||||
IPAddress string
|
||||
}
|
||||
|
||||
func ExtractClientInfo(ctx context.Context) (*ClientInfo, error) {
|
||||
md, ok := metadata.FromIncomingContext(ctx)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("failed to get metadata from context")
|
||||
}
|
||||
|
||||
info := &ClientInfo{}
|
||||
|
||||
// Extract authority, content-type, and user-agent
|
||||
if authority := md.Get("authority"); len(authority) > 0 {
|
||||
info.Authority = authority[0]
|
||||
}
|
||||
if contentType := md.Get("content-type"); len(contentType) > 0 {
|
||||
info.ContentType = contentType[0]
|
||||
}
|
||||
if userAgent := md.Get("user-agent"); len(userAgent) > 0 {
|
||||
info.UserAgent = userAgent[0]
|
||||
}
|
||||
|
||||
// Extract hostname and IP address
|
||||
p, ok := peer.FromContext(ctx)
|
||||
if ok {
|
||||
if tcpAddr, ok := p.Addr.(*net.TCPAddr); ok {
|
||||
info.IPAddress = tcpAddr.IP.String()
|
||||
|
||||
// Try to get hostname
|
||||
names, err := net.LookupAddr(info.IPAddress)
|
||||
if err == nil && len(names) > 0 {
|
||||
info.Hostname = strings.TrimSuffix(names[0], ".")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return info, nil
|
||||
}
|
||||
@@ -1,445 +0,0 @@
|
||||
// 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, 0xe2, 0x24, 0x4d, 0x42, 0xd2, 0x24,
|
||||
0xd3, 0x74, 0xe8, 0x8c, 0x29, 0xd8, 0x34, 0xe9, 0x4c, 0x6f, 0x56, 0xab, 0x63, 0xb3, 0x95, 0x90,
|
||||
0x34, 0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 0xa8, 0xc7, 0xb5, 0x32, 0xf4, 0x15, 0x79, 0x7e, 0xa5,
|
||||
0x85, 0x4b, 0x64, 0x1a, 0x61, 0x73, 0x65, 0xb0, 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,
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
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"},
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/onsonr/crypto/core/curves"
|
||||
"github.com/onsonr/crypto/signatures/ecdsa"
|
||||
"golang.org/x/crypto/sha3"
|
||||
)
|
||||
|
||||
// VerifySignature verifies the signature of a message
|
||||
func VerifySignature(key []byte, msg []byte, sig []byte) bool {
|
||||
pp, err := buildEcPoint(key)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
sigEd, err := ecdsa.DeserializeSecp256k1Signature(sig)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
hash := sha3.New256()
|
||||
_, err = hash.Write(msg)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
digest := hash.Sum(nil)
|
||||
return curves.VerifyEcdsa(pp, digest[:], sigEd)
|
||||
}
|
||||
|
||||
// BuildEcPoint builds an elliptic curve point from a compressed byte slice
|
||||
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:])
|
||||
ecCurve, err := crv.ToEllipticCurve()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error converting curve: %v", err)
|
||||
}
|
||||
return &curves.EcPoint{X: x, Y: y, Curve: ecCurve}, nil
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
fmt "fmt"
|
||||
|
||||
"github.com/cosmos/btcutil/bech32"
|
||||
"github.com/mr-tron/base58/base58"
|
||||
)
|
||||
|
||||
type ChainCode uint32
|
||||
|
||||
const (
|
||||
ChainCodeBTC ChainCode = 0
|
||||
ChainCodeETH ChainCode = 60
|
||||
ChainCodeIBC ChainCode = 118
|
||||
ChainCodeSNR ChainCode = 703
|
||||
)
|
||||
|
||||
var InitialChainCodes = map[DIDNamespace]ChainCode{
|
||||
DIDNamespace_DID_NAMESPACE_BITCOIN: ChainCodeBTC,
|
||||
DIDNamespace_DID_NAMESPACE_IBC: ChainCodeIBC,
|
||||
DIDNamespace_DID_NAMESPACE_ETHEREUM: ChainCodeETH,
|
||||
DIDNamespace_DID_NAMESPACE_SONR: ChainCodeSNR,
|
||||
}
|
||||
|
||||
func (c ChainCode) FormatAddress(pubKey *PubKey) (string, error) {
|
||||
switch c {
|
||||
case ChainCodeBTC:
|
||||
return bech32.Encode("bc", pubKey.Bytes())
|
||||
|
||||
case ChainCodeETH:
|
||||
return bech32.Encode("eth", pubKey.Bytes())
|
||||
|
||||
case ChainCodeSNR:
|
||||
return bech32.Encode("idx", pubKey.Bytes())
|
||||
|
||||
case ChainCodeIBC:
|
||||
return bech32.Encode("cosmos", pubKey.Bytes())
|
||||
|
||||
}
|
||||
return "", ErrUnsopportedChainCode
|
||||
}
|
||||
|
||||
func (n DIDNamespace) ChainCode() (uint32, error) {
|
||||
switch n {
|
||||
case DIDNamespace_DID_NAMESPACE_BITCOIN:
|
||||
return 0, nil
|
||||
case DIDNamespace_DID_NAMESPACE_ETHEREUM:
|
||||
return 64, nil
|
||||
case DIDNamespace_DID_NAMESPACE_IBC:
|
||||
return 118, nil
|
||||
case DIDNamespace_DID_NAMESPACE_SONR:
|
||||
return 703, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("unsupported chain")
|
||||
}
|
||||
}
|
||||
|
||||
func (n DIDNamespace) DIDMethod() string {
|
||||
switch n {
|
||||
case DIDNamespace_DID_NAMESPACE_IPFS:
|
||||
return "ipfs"
|
||||
case DIDNamespace_DID_NAMESPACE_SONR:
|
||||
return "sonr"
|
||||
case DIDNamespace_DID_NAMESPACE_BITCOIN:
|
||||
return "btcr"
|
||||
case DIDNamespace_DID_NAMESPACE_ETHEREUM:
|
||||
return "ethr"
|
||||
case DIDNamespace_DID_NAMESPACE_IBC:
|
||||
return "ibcr"
|
||||
case DIDNamespace_DID_NAMESPACE_WEBAUTHN:
|
||||
return "webauthn"
|
||||
case DIDNamespace_DID_NAMESPACE_DWN:
|
||||
return "motr"
|
||||
case DIDNamespace_DID_NAMESPACE_SERVICE:
|
||||
return "web"
|
||||
default:
|
||||
return "n/a"
|
||||
}
|
||||
}
|
||||
|
||||
func (n DIDNamespace) FormatDID(subject string) string {
|
||||
return fmt.Sprintf("%s:%s", n.DIDMethod(), subject)
|
||||
}
|
||||
|
||||
type EncodedKey []byte
|
||||
|
||||
func (e KeyEncoding) EncodeRaw(data []byte) (EncodedKey, error) {
|
||||
switch e {
|
||||
case KeyEncoding_KEY_ENCODING_RAW:
|
||||
return data, nil
|
||||
case KeyEncoding_KEY_ENCODING_HEX:
|
||||
return []byte(hex.EncodeToString(data)), nil
|
||||
case KeyEncoding_KEY_ENCODING_MULTIBASE:
|
||||
return []byte(base58.Encode(data)), nil
|
||||
default:
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (e KeyEncoding) DecodeRaw(data EncodedKey) ([]byte, error) {
|
||||
switch e {
|
||||
case KeyEncoding_KEY_ENCODING_RAW:
|
||||
return data, nil
|
||||
case KeyEncoding_KEY_ENCODING_HEX:
|
||||
return hex.DecodeString(string(data))
|
||||
case KeyEncoding_KEY_ENCODING_MULTIBASE:
|
||||
return base58.Decode(string(data))
|
||||
default:
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
|
||||
type COSEAlgorithmIdentifier int
|
||||
|
||||
func (k KeyAlgorithm) CoseIdentifier() COSEAlgorithmIdentifier {
|
||||
switch k {
|
||||
case KeyAlgorithm_KEY_ALGORITHM_ES256:
|
||||
return COSEAlgorithmIdentifier(-7)
|
||||
case KeyAlgorithm_KEY_ALGORITHM_ES384:
|
||||
return COSEAlgorithmIdentifier(-35)
|
||||
case KeyAlgorithm_KEY_ALGORITHM_ES512:
|
||||
return COSEAlgorithmIdentifier(-36)
|
||||
case KeyAlgorithm_KEY_ALGORITHM_EDDSA:
|
||||
return COSEAlgorithmIdentifier(-8)
|
||||
case KeyAlgorithm_KEY_ALGORITHM_ES256K:
|
||||
return COSEAlgorithmIdentifier(-10)
|
||||
default:
|
||||
return COSEAlgorithmIdentifier(0)
|
||||
}
|
||||
}
|
||||
|
||||
func (k KeyCurve) ComputePublicKey(data []byte) (*PubKey, error) {
|
||||
return nil, ErrUnsupportedKeyCurve
|
||||
}
|
||||
@@ -7,10 +7,9 @@ var (
|
||||
ErrInvalidETHAddressFormat = sdkerrors.Register(ModuleName, 200, "invalid ETH address format")
|
||||
ErrInvalidBTCAddressFormat = sdkerrors.Register(ModuleName, 201, "invalid BTC address format")
|
||||
ErrInvalidIDXAddressFormat = sdkerrors.Register(ModuleName, 202, "invalid IDX address format")
|
||||
ErrInvalidEmailFormat = sdkerrors.Register(ModuleName, 203, "invalid email format")
|
||||
ErrInvalidPhoneFormat = sdkerrors.Register(ModuleName, 204, "invalid phone format")
|
||||
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")
|
||||
ErrInvalidServiceOrigin = sdkerrors.Register(ModuleName, 300, "invalid service origin")
|
||||
ErrUnrecognizedService = sdkerrors.Register(ModuleName, 301, "unrecognized service")
|
||||
ErrUnsupportedKeyEncoding = sdkerrors.Register(ModuleName, 400, "unsupported key encoding")
|
||||
ErrUnsopportedChainCode = sdkerrors.Register(ModuleName, 401, "unsupported chain code")
|
||||
ErrUnsupportedKeyCurve = sdkerrors.Register(ModuleName, 402, "unsupported key curve")
|
||||
)
|
||||
|
||||
+155
-5
@@ -1,6 +1,30 @@
|
||||
package types
|
||||
|
||||
import "encoding/json"
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
|
||||
ormv1alpha1 "cosmossdk.io/api/cosmos/orm/v1alpha1"
|
||||
)
|
||||
|
||||
// ParamsKey saves the current module params.
|
||||
var ParamsKey = collections.NewPrefix(0)
|
||||
|
||||
const (
|
||||
ModuleName = "did"
|
||||
|
||||
StoreKey = ModuleName
|
||||
|
||||
QuerierRoute = ModuleName
|
||||
)
|
||||
|
||||
var ORMModuleSchema = ormv1alpha1.ModuleSchemaDescriptor{
|
||||
SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{
|
||||
{Id: 1, ProtoFileName: "did/v1/state.proto"},
|
||||
},
|
||||
Prefix: []byte{0},
|
||||
}
|
||||
|
||||
// this line is used by starport scaffolding # genesis/types/import
|
||||
|
||||
@@ -26,13 +50,139 @@ func (gs GenesisState) Validate() error {
|
||||
// DefaultParams returns default module parameters.
|
||||
func DefaultParams() Params {
|
||||
return Params{
|
||||
WhitelistedAssets: DefaultAssets(),
|
||||
WhitelistedChains: DefaultChains(),
|
||||
AllowedPublicKeys: DefaultKeyInfos(),
|
||||
OpenidConfig: DefaultOpenIDConfig(),
|
||||
WhitelistedAssets: DefaultAssets(),
|
||||
WhitelistedChains: DefaultChains(),
|
||||
AllowedPublicKeys: DefaultKeyInfos(),
|
||||
OpenidConfig: DefaultOpenIDConfig(),
|
||||
LocalhostRegistrationEnabled: true,
|
||||
ConveyancePreference: "direct",
|
||||
AttestationFormats: []string{"packed", "android-key", "fido-u2f", "apple"},
|
||||
}
|
||||
}
|
||||
|
||||
// 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 bls12381.
|
||||
func DefaultKeyInfos() []*KeyInfo {
|
||||
return []*KeyInfo{
|
||||
// Identity Key Info
|
||||
// Sonr Controller Key Info - From MPC
|
||||
{
|
||||
Role: KeyRole_KEY_ROLE_INVOCATION,
|
||||
Curve: KeyCurve_KEY_CURVE_P256,
|
||||
Algorithm: KeyAlgorithm_KEY_ALGORITHM_ECDSA,
|
||||
Encoding: KeyEncoding_KEY_ENCODING_HEX,
|
||||
Type: KeyType_KEY_TYPE_MPC,
|
||||
},
|
||||
|
||||
// Sonr Vault Shared Key Info - From Registration
|
||||
{
|
||||
Role: KeyRole_KEY_ROLE_ASSERTION,
|
||||
Curve: KeyCurve_KEY_CURVE_BLS12381,
|
||||
Algorithm: KeyAlgorithm_KEY_ALGORITHM_UNSPECIFIED,
|
||||
Encoding: KeyEncoding_KEY_ENCODING_MULTIBASE,
|
||||
Type: KeyType_KEY_TYPE_ZK,
|
||||
},
|
||||
|
||||
// Blockchain Key Info
|
||||
// Ethereum Key Info
|
||||
{
|
||||
Role: KeyRole_KEY_ROLE_DELEGATION,
|
||||
Curve: KeyCurve_KEY_CURVE_KECCAK256,
|
||||
Algorithm: KeyAlgorithm_KEY_ALGORITHM_ECDSA,
|
||||
Encoding: KeyEncoding_KEY_ENCODING_HEX,
|
||||
Type: KeyType_KEY_TYPE_BIP32,
|
||||
},
|
||||
// Bitcoin/IBC Key Info
|
||||
{
|
||||
Role: KeyRole_KEY_ROLE_DELEGATION,
|
||||
Curve: KeyCurve_KEY_CURVE_SECP256K1,
|
||||
Algorithm: KeyAlgorithm_KEY_ALGORITHM_ECDSA,
|
||||
Encoding: KeyEncoding_KEY_ENCODING_HEX,
|
||||
Type: KeyType_KEY_TYPE_BIP32,
|
||||
},
|
||||
|
||||
// Authentication Key Info
|
||||
// Browser based WebAuthn
|
||||
{
|
||||
Role: KeyRole_KEY_ROLE_AUTHENTICATION,
|
||||
Curve: KeyCurve_KEY_CURVE_P256,
|
||||
Algorithm: KeyAlgorithm_KEY_ALGORITHM_ES256,
|
||||
Encoding: KeyEncoding_KEY_ENCODING_RAW,
|
||||
Type: KeyType_KEY_TYPE_WEBAUTHN,
|
||||
},
|
||||
// FIDO U2F
|
||||
{
|
||||
Role: KeyRole_KEY_ROLE_AUTHENTICATION,
|
||||
Curve: KeyCurve_KEY_CURVE_P256,
|
||||
Algorithm: KeyAlgorithm_KEY_ALGORITHM_ES256,
|
||||
Encoding: KeyEncoding_KEY_ENCODING_RAW,
|
||||
Type: KeyType_KEY_TYPE_WEBAUTHN,
|
||||
},
|
||||
// Cross-Platform Passkeys
|
||||
{
|
||||
Role: KeyRole_KEY_ROLE_AUTHENTICATION,
|
||||
Curve: KeyCurve_KEY_CURVE_ED25519,
|
||||
Algorithm: KeyAlgorithm_KEY_ALGORITHM_EDDSA,
|
||||
Encoding: KeyEncoding_KEY_ENCODING_RAW,
|
||||
Type: KeyType_KEY_TYPE_WEBAUTHN,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
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"},
|
||||
}
|
||||
}
|
||||
|
||||
func (p Params) ActiveParams(ipfsActive bool) Params {
|
||||
p.IpfsActive = ipfsActive
|
||||
return p
|
||||
}
|
||||
|
||||
// Stringer method for Params.
|
||||
func (p Params) String() string {
|
||||
bz, err := json.Marshal(p)
|
||||
|
||||
+704
-72
@@ -25,6 +25,367 @@ var _ = math.Inf
|
||||
// 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_fda181cae44f7c00, []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_fda181cae44f7c00, []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_ECDSA KeyAlgorithm = 6
|
||||
)
|
||||
|
||||
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_ECDSA",
|
||||
}
|
||||
|
||||
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_ECDSA": 6,
|
||||
}
|
||||
|
||||
func (x KeyAlgorithm) String() string {
|
||||
return proto.EnumName(KeyAlgorithm_name, int32(x))
|
||||
}
|
||||
|
||||
func (KeyAlgorithm) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_fda181cae44f7c00, []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
|
||||
KeyCurve_KEY_CURVE_BLS12381 KeyCurve = 9
|
||||
KeyCurve_KEY_CURVE_KECCAK256 KeyCurve = 10
|
||||
)
|
||||
|
||||
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",
|
||||
9: "KEY_CURVE_BLS12381",
|
||||
10: "KEY_CURVE_KECCAK256",
|
||||
}
|
||||
|
||||
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,
|
||||
"KEY_CURVE_BLS12381": 9,
|
||||
"KEY_CURVE_KECCAK256": 10,
|
||||
}
|
||||
|
||||
func (x KeyCurve) String() string {
|
||||
return proto.EnumName(KeyCurve_name, int32(x))
|
||||
}
|
||||
|
||||
func (KeyCurve) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_fda181cae44f7c00, []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
|
||||
)
|
||||
|
||||
var KeyEncoding_name = map[int32]string{
|
||||
0: "KEY_ENCODING_UNSPECIFIED",
|
||||
1: "KEY_ENCODING_RAW",
|
||||
2: "KEY_ENCODING_HEX",
|
||||
3: "KEY_ENCODING_MULTIBASE",
|
||||
}
|
||||
|
||||
var KeyEncoding_value = map[string]int32{
|
||||
"KEY_ENCODING_UNSPECIFIED": 0,
|
||||
"KEY_ENCODING_RAW": 1,
|
||||
"KEY_ENCODING_HEX": 2,
|
||||
"KEY_ENCODING_MULTIBASE": 3,
|
||||
}
|
||||
|
||||
func (x KeyEncoding) String() string {
|
||||
return proto.EnumName(KeyEncoding_name, int32(x))
|
||||
}
|
||||
|
||||
func (KeyEncoding) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_fda181cae44f7c00, []int{4}
|
||||
}
|
||||
|
||||
// KeyRole defines the kind of key
|
||||
type KeyRole int32
|
||||
|
||||
const (
|
||||
KeyRole_KEY_ROLE_UNSPECIFIED KeyRole = 0
|
||||
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_fda181cae44f7c00, []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
|
||||
KeyType_KEY_TYPE_MPC KeyType = 6
|
||||
KeyType_KEY_TYPE_ZK KeyType = 7
|
||||
KeyType_KEY_TYPE_WEBAUTHN KeyType = 8
|
||||
KeyType_KEY_TYPE_BIP32 KeyType = 9
|
||||
)
|
||||
|
||||
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",
|
||||
6: "KEY_TYPE_MPC",
|
||||
7: "KEY_TYPE_ZK",
|
||||
8: "KEY_TYPE_WEBAUTHN",
|
||||
9: "KEY_TYPE_BIP32",
|
||||
}
|
||||
|
||||
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,
|
||||
"KEY_TYPE_MPC": 6,
|
||||
"KEY_TYPE_ZK": 7,
|
||||
"KEY_TYPE_WEBAUTHN": 8,
|
||||
"KEY_TYPE_BIP32": 9,
|
||||
}
|
||||
|
||||
func (x KeyType) String() string {
|
||||
return proto.EnumName(KeyType_name, int32(x))
|
||||
}
|
||||
|
||||
func (KeyType) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_fda181cae44f7c00, []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_PERMISSIONS_READ PermissionScope = 2
|
||||
PermissionScope_PERMISSION_SCOPE_PERMISSIONS_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_PERMISSIONS_READ",
|
||||
3: "PERMISSION_SCOPE_PERMISSIONS_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_PERMISSIONS_READ": 2,
|
||||
"PERMISSION_SCOPE_PERMISSIONS_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_fda181cae44f7c00, []int{7}
|
||||
}
|
||||
|
||||
// GenesisState defines the module genesis state
|
||||
type GenesisState struct {
|
||||
// Params defines all the parameters of the module.
|
||||
@@ -81,6 +442,14 @@ type Params struct {
|
||||
AllowedPublicKeys []*KeyInfo `protobuf:"bytes,3,rep,name=allowed_public_keys,json=allowedPublicKeys,proto3" json:"allowed_public_keys,omitempty"`
|
||||
// OpenIDConfig defines the base openid configuration across all did services
|
||||
OpenidConfig *OpenIDConfig `protobuf:"bytes,4,opt,name=openid_config,json=openidConfig,proto3" json:"openid_config,omitempty"`
|
||||
// IpfsActive is a flag to enable/disable ipfs
|
||||
IpfsActive bool `protobuf:"varint,5,opt,name=ipfs_active,json=ipfsActive,proto3" json:"ipfs_active,omitempty"`
|
||||
// Localhost Registration Enabled
|
||||
LocalhostRegistrationEnabled bool `protobuf:"varint,6,opt,name=localhost_registration_enabled,json=localhostRegistrationEnabled,proto3" json:"localhost_registration_enabled,omitempty"`
|
||||
// ConveyancePreference defines the conveyance preference
|
||||
ConveyancePreference string `protobuf:"bytes,7,opt,name=conveyance_preference,json=conveyancePreference,proto3" json:"conveyance_preference,omitempty"`
|
||||
// AttestationFormats defines the attestation formats
|
||||
AttestationFormats []string `protobuf:"bytes,8,rep,name=attestation_formats,json=attestationFormats,proto3" json:"attestation_formats,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Params) Reset() { *m = Params{} }
|
||||
@@ -143,6 +512,34 @@ func (m *Params) GetOpenidConfig() *OpenIDConfig {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Params) GetIpfsActive() bool {
|
||||
if m != nil {
|
||||
return m.IpfsActive
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *Params) GetLocalhostRegistrationEnabled() bool {
|
||||
if m != nil {
|
||||
return m.LocalhostRegistrationEnabled
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *Params) GetConveyancePreference() string {
|
||||
if m != nil {
|
||||
return m.ConveyancePreference
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Params) GetAttestationFormats() []string {
|
||||
if m != nil {
|
||||
return m.AttestationFormats
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AssetInfo defines the asset info
|
||||
type AssetInfo struct {
|
||||
// The coin type index for bip44 path
|
||||
@@ -836,6 +1233,14 @@ func (m *ValidatorInfo_IBCChannel) GetPort() string {
|
||||
}
|
||||
|
||||
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)
|
||||
proto.RegisterType((*GenesisState)(nil), "did.v1.GenesisState")
|
||||
proto.RegisterType((*Params)(nil), "did.v1.Params")
|
||||
proto.RegisterType((*AssetInfo)(nil), "did.v1.AssetInfo")
|
||||
@@ -852,78 +1257,132 @@ func init() {
|
||||
func init() { proto.RegisterFile("did/v1/genesis.proto", fileDescriptor_fda181cae44f7c00) }
|
||||
|
||||
var fileDescriptor_fda181cae44f7c00 = []byte{
|
||||
// 1122 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xcb, 0x8e, 0x1b, 0x45,
|
||||
0x14, 0x9d, 0xf6, 0xbb, 0xaf, 0x3d, 0xce, 0x4c, 0x65, 0x66, 0xd2, 0x18, 0xc5, 0x09, 0xe6, 0xa1,
|
||||
0xf0, 0x90, 0x9d, 0x18, 0x82, 0x02, 0x44, 0x40, 0x32, 0x09, 0xd1, 0x28, 0x44, 0x44, 0x1d, 0xc8,
|
||||
0x82, 0x4d, 0xab, 0xdc, 0x5d, 0x63, 0x17, 0xe9, 0xae, 0x6a, 0x55, 0x75, 0x4f, 0x62, 0x3e, 0x81,
|
||||
0x15, 0x4b, 0xd8, 0x85, 0x3f, 0x80, 0x7f, 0x60, 0x91, 0x0d, 0x52, 0x96, 0xac, 0x50, 0x94, 0x59,
|
||||
0xc0, 0x8a, 0x6f, 0x40, 0x75, 0xfb, 0x61, 0x3b, 0x9e, 0x48, 0x6c, 0xac, 0xfb, 0x3a, 0xa7, 0x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0x3e, 0xe9, 0x42, 0x85, 0x07, 0xd8,
|
||||
0x83, 0xed, 0x56, 0x38, 0x02, 0x51, 0x2f, 0x8f, 0x07, 0x79, 0x17, 0x4d, 0xf4, 0x0f, 0x82, 0x72,
|
||||
0xfd, 0xea, 0xea, 0xfa, 0x79, 0x77, 0xb5, 0x95, 0xee, 0x2e, 0x03, 0x1c, 0xd1, 0x90, 0x07, 0x34,
|
||||
0x91, 0x4a, 0x3b, 0x75, 0xd4, 0x6d, 0xb7, 0xe8, 0xee, 0x7e, 0x91, 0x41, 0xf5, 0x96, 0x0a, 0x07,
|
||||
0xcf, 0x2c, 0x68, 0xe6, 0xaa, 0x92, 0xd7, 0xa1, 0xa6, 0x64, 0xc8, 0x70, 0x6f, 0xdd, 0x15, 0xd1,
|
||||
0x5d, 0x19, 0x32, 0x17, 0x93, 0x64, 0x0c, 0x36, 0x0d, 0xa7, 0x52, 0xf1, 0x64, 0x16, 0xe1, 0x7e,
|
||||
0xbb, 0x0b, 0x8d, 0x6f, 0xb3, 0xf9, 0xb5, 0x22, 0xe7, 0x2e, 0xca, 0xc8, 0x08, 0x5a, 0x4c, 0xf8,
|
||||
0x32, 0xe0, 0x62, 0x8a, 0xbd, 0x74, 0xc7, 0xa7, 0x97, 0x20, 0x37, 0xf3, 0x94, 0x5b, 0x16, 0x91,
|
||||
0xb7, 0xa0, 0xee, 0xa7, 0xea, 0xa8, 0x50, 0x69, 0x6b, 0xa9, 0x7a, 0xdf, 0xc4, 0xdd, 0x2c, 0x6d,
|
||||
0x76, 0x8c, 0x62, 0xd6, 0xd7, 0x76, 0x8c, 0x52, 0x62, 0x72, 0xf0, 0x6f, 0x15, 0x3a, 0xcb, 0xa7,
|
||||
0xcf, 0x8c, 0x90, 0x6b, 0x9d, 0x32, 0x95, 0xab, 0x90, 0x7b, 0xe4, 0x32, 0xec, 0xd1, 0x34, 0x99,
|
||||
0x49, 0xc5, 0xbf, 0xa7, 0x09, 0x97, 0xc2, 0x63, 0x22, 0x88, 0x25, 0x17, 0x49, 0xae, 0xcb, 0xee,
|
||||
0x4a, 0xf6, 0x66, 0x9e, 0x24, 0x6f, 0x42, 0x37, 0x91, 0x0f, 0xd8, 0x52, 0x79, 0xa6, 0xd7, 0x26,
|
||||
0x46, 0xcb, 0xb2, 0x77, 0x61, 0x3b, 0xd5, 0x4c, 0x71, 0x71, 0x28, 0x17, 0x95, 0x99, 0x86, 0x5b,
|
||||
0x45, 0xa2, 0x2c, 0x7e, 0x1b, 0xb6, 0xb4, 0x2f, 0x63, 0xa6, 0x3d, 0x9d, 0xc6, 0xb1, 0x54, 0x09,
|
||||
0x0b, 0x50, 0x53, 0xdb, 0x3d, 0x95, 0xc5, 0xef, 0x15, 0x61, 0x72, 0x05, 0x1c, 0xc5, 0x74, 0x2c,
|
||||
0x85, 0x66, 0x78, 0xb2, 0x97, 0x21, 0x0d, 0x84, 0xec, 0x15, 0x79, 0x33, 0x94, 0x97, 0x20, 0x23,
|
||||
0x19, 0xac, 0x20, 0x9b, 0xab, 0xc8, 0x3b, 0x26, 0xbd, 0x40, 0x8e, 0x61, 0x77, 0xaa, 0xa8, 0x48,
|
||||
0xd6, 0x16, 0x6c, 0x21, 0xec, 0x34, 0x26, 0x5f, 0x58, 0xed, 0x22, 0xec, 0x50, 0x5f, 0x79, 0x47,
|
||||
0x34, 0x4c, 0x57, 0x20, 0x36, 0x42, 0x08, 0xf5, 0xd5, 0x7d, 0x4c, 0x2d, 0x10, 0x1f, 0xc2, 0x19,
|
||||
0x9d, 0x4e, 0xbe, 0x63, 0xfe, 0xfa, 0x3a, 0x80, 0xa0, 0xdd, 0x3c, 0xbd, 0xba, 0xd2, 0xe0, 0x8f,
|
||||
0x3a, 0x6c, 0xae, 0x9c, 0x78, 0xe2, 0x40, 0x33, 0x92, 0x82, 0x3f, 0x28, 0x25, 0x2f, 0x5c, 0x72,
|
||||
0x13, 0xba, 0x53, 0x15, 0xfb, 0xa5, 0x22, 0xc5, 0xab, 0xd9, 0x3f, 0xf1, 0xea, 0x0c, 0x0b, 0x81,
|
||||
0xdc, 0x4d, 0x83, 0x2a, 0x3c, 0x6d, 0x68, 0x14, 0xd3, 0xc9, 0x12, 0x4d, 0xf5, 0xff, 0xd1, 0x18,
|
||||
0xd4, 0x82, 0xe6, 0x53, 0x68, 0xb1, 0x47, 0x71, 0x28, 0x15, 0x53, 0xf9, 0xfb, 0x39, 0x78, 0x09,
|
||||
0x41, 0x5e, 0x85, 0xf7, 0xb9, 0xc4, 0x90, 0x2b, 0xd0, 0x3a, 0x64, 0xcc, 0x33, 0x47, 0x09, 0xef,
|
||||
0x44, 0x7b, 0x7c, 0xf6, 0x64, 0xfc, 0x17, 0x8c, 0x21, 0xb4, 0x79, 0x98, 0x19, 0xe4, 0x1a, 0xb4,
|
||||
0xf9, 0xc4, 0x37, 0x5f, 0x0e, 0x21, 0x58, 0x88, 0x6f, 0x5b, 0x7b, 0x7c, 0xfe, 0x64, 0xf0, 0xc1,
|
||||
0xf5, 0xfd, 0xfd, 0xac, 0xce, 0x05, 0x3e, 0xf1, 0x73, 0xbb, 0xf7, 0x09, 0xb4, 0xca, 0xf3, 0xbb,
|
||||
0x05, 0x55, 0xf3, 0x10, 0x66, 0xc3, 0x36, 0x26, 0x39, 0x0b, 0xc0, 0xb5, 0x17, 0x2b, 0x1e, 0x51,
|
||||
0x35, 0xc7, 0x0b, 0xd5, 0x72, 0x6d, 0xae, 0xef, 0x66, 0x81, 0xde, 0x07, 0xd0, 0x59, 0xee, 0xa9,
|
||||
0x7c, 0xfa, 0xac, 0xa5, 0xa7, 0x2f, 0x27, 0xad, 0x94, 0xa4, 0xbd, 0xdf, 0x2c, 0x68, 0xe6, 0xad,
|
||||
0x98, 0x05, 0x26, 0x54, 0x33, 0x2f, 0x60, 0x42, 0x46, 0x39, 0xce, 0x36, 0x91, 0x1b, 0x26, 0x40,
|
||||
0x5e, 0x05, 0xdb, 0x8c, 0x46, 0xd1, 0x84, 0x65, 0x1a, 0xdb, 0xae, 0x99, 0x95, 0x6b, 0x7c, 0xf2,
|
||||
0x06, 0x74, 0xb9, 0xe0, 0x89, 0x37, 0xa5, 0xda, 0x0b, 0x79, 0xc4, 0xb3, 0x2b, 0x5c, 0x77, 0x3b,
|
||||
0x26, 0x7a, 0x8b, 0xea, 0x2f, 0x4d, 0x8c, 0xbc, 0x06, 0x1d, 0xae, 0x3d, 0xcd, 0xa3, 0x34, 0xa4,
|
||||
0x93, 0x30, 0x7b, 0x9c, 0x5a, 0x6e, 0x9b, 0xeb, 0x7b, 0x45, 0xc8, 0x94, 0x18, 0x8e, 0x28, 0x0d,
|
||||
0x13, 0x1e, 0x87, 0x73, 0x14, 0xc1, 0x72, 0xdb, 0x53, 0xaa, 0xef, 0xe4, 0xa1, 0xde, 0x45, 0x80,
|
||||
0xc5, 0x00, 0xd7, 0xbe, 0x06, 0x04, 0x6a, 0xe6, 0x14, 0xe7, 0x4d, 0xa2, 0x7d, 0xfd, 0xea, 0x93,
|
||||
0xe7, 0x7d, 0xeb, 0xe9, 0xf3, 0xbe, 0xf5, 0xec, 0x79, 0xdf, 0xfa, 0xf1, 0xb8, 0xbf, 0xf1, 0xf4,
|
||||
0xb8, 0xbf, 0xf1, 0xe7, 0x71, 0x7f, 0xe3, 0xdb, 0xc1, 0x94, 0x27, 0xb3, 0x74, 0x32, 0xf4, 0x65,
|
||||
0x34, 0x92, 0x42, 0x4b, 0xa1, 0x46, 0xf8, 0xf3, 0x68, 0x64, 0xbe, 0xa2, 0x78, 0x69, 0x26, 0x0d,
|
||||
0xfc, 0xb7, 0xf2, 0xfe, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x10, 0x30, 0xf0, 0x0e, 0x09,
|
||||
0x00, 0x00,
|
||||
// 1995 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x58, 0xbd, 0x73, 0x1b, 0xc7,
|
||||
0x15, 0x27, 0x88, 0xef, 0x07, 0x12, 0x5a, 0x2e, 0x3f, 0x04, 0x51, 0x12, 0x49, 0x51, 0xb2, 0xcd,
|
||||
0xd0, 0x19, 0x52, 0x84, 0x44, 0x8f, 0x9c, 0x78, 0x92, 0x1c, 0x0e, 0x47, 0xea, 0x86, 0xf8, 0x9a,
|
||||
0xbd, 0x23, 0x69, 0xb9, 0xb9, 0x39, 0x02, 0x4b, 0x70, 0x23, 0xe0, 0x0e, 0x73, 0x7b, 0xa0, 0xc5,
|
||||
0x74, 0x69, 0x5d, 0xa5, 0x4c, 0x3a, 0x77, 0x69, 0x52, 0x24, 0xff, 0x83, 0x0b, 0x37, 0x99, 0x71,
|
||||
0x99, 0x34, 0x19, 0x8f, 0x54, 0x24, 0x55, 0xfa, 0x74, 0x99, 0xdd, 0xbb, 0x03, 0x70, 0x04, 0xa4,
|
||||
0x71, 0x83, 0xd9, 0xfd, 0xfd, 0x7e, 0xef, 0xed, 0x7b, 0xfb, 0xde, 0xee, 0x1e, 0x09, 0x2b, 0x1d,
|
||||
0xd6, 0xd9, 0xbf, 0x3e, 0xd8, 0xef, 0x52, 0x87, 0x72, 0xc6, 0xf7, 0x06, 0x9e, 0xeb, 0xbb, 0x38,
|
||||
0xd3, 0x61, 0x9d, 0xbd, 0xeb, 0x83, 0xf5, 0x25, 0xbb, 0xcf, 0x1c, 0x77, 0x5f, 0xfe, 0x06, 0xd4,
|
||||
0xfa, 0x4a, 0xd7, 0xed, 0xba, 0x72, 0xb8, 0x2f, 0x46, 0x01, 0xba, 0xfd, 0x05, 0x2c, 0x1c, 0x07,
|
||||
0x1e, 0x0c, 0xdf, 0xf6, 0x29, 0xfe, 0x39, 0x64, 0x06, 0xb6, 0x67, 0xf7, 0x79, 0x29, 0xb1, 0x95,
|
||||
0xd8, 0x29, 0x94, 0x8b, 0x7b, 0x81, 0xc7, 0xbd, 0x96, 0x44, 0x2b, 0xa9, 0xef, 0xff, 0xb5, 0x39,
|
||||
0x47, 0x42, 0x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, 0x94, 0x32, 0xd2, 0xe6, 0xc1, 0x48, 0x45, 0x26, 0x44, 0x5a, 0xa0, 0xc1, 0xcf, 0x60, 0xb5,
|
||||
0xed, 0x3a, 0xd7, 0xf4, 0xc6, 0x76, 0xda, 0xd4, 0x1a, 0x78, 0xf4, 0x92, 0x7a, 0xd4, 0x69, 0xd3,
|
||||
0x52, 0x76, 0x2b, 0xb1, 0x93, 0x27, 0x2b, 0x63, 0xb2, 0x35, 0xe2, 0xf0, 0x3e, 0x2c, 0xdb, 0xbe,
|
||||
0x4f, 0xb9, 0x1f, 0xac, 0x77, 0xe9, 0x7a, 0x7d, 0xdb, 0xe7, 0xa5, 0xdc, 0x56, 0x72, 0x27, 0x4f,
|
||||
0xf0, 0x04, 0x75, 0x14, 0x30, 0xbf, 0xb8, 0xfb, 0xc7, 0x6f, 0x37, 0xe7, 0xfe, 0xf3, 0xed, 0x66,
|
||||
0xe2, 0x9b, 0x7f, 0xff, 0x75, 0x17, 0x44, 0xa7, 0x85, 0x05, 0xff, 0x2e, 0x01, 0xf9, 0x51, 0x11,
|
||||
0xf1, 0x0a, 0xa4, 0x99, 0xd3, 0xa1, 0x6f, 0x64, 0xaf, 0x24, 0x49, 0x30, 0xc1, 0x08, 0x92, 0x57,
|
||||
0xde, 0xa0, 0x34, 0x2f, 0x03, 0x12, 0x43, 0xbc, 0x06, 0x19, 0x7e, 0xd3, 0xbf, 0x70, 0x7b, 0xa5,
|
||||
0xa4, 0x04, 0xc3, 0x19, 0x7e, 0x0a, 0x20, 0xfb, 0xc4, 0xf2, 0x6f, 0x06, 0x54, 0xee, 0x75, 0xf1,
|
||||
0x56, 0xaf, 0x98, 0x37, 0x03, 0x4a, 0xf2, 0x76, 0x34, 0xc4, 0x18, 0x52, 0x8e, 0xdd, 0x0f, 0xb6,
|
||||
0x37, 0x4f, 0xe4, 0x58, 0x78, 0xef, 0x53, 0xff, 0xca, 0x0d, 0x36, 0x30, 0x4f, 0xc2, 0x19, 0xbe,
|
||||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b1,
|
||||
0x85, 0x8c, 0xf3, 0x21, 0xf5, 0xc2, 0x2a, 0x84, 0x33, 0x7c, 0x08, 0x6b, 0xf6, 0xd0, 0xbf, 0x72,
|
||||
0x3d, 0xf6, 0xbb, 0xe8, 0xa8, 0x74, 0x06, 0x2e, 0x73, 0xfc, 0xb0, 0x2e, 0xab, 0x31, 0x56, 0x0b,
|
||||
0x49, 0xfc, 0x11, 0x14, 0x7d, 0xf7, 0x35, 0x9d, 0x90, 0x07, 0xf5, 0x5a, 0x94, 0xe8, 0x48, 0xf6,
|
||||
0x29, 0x2c, 0x0d, 0x39, 0xf5, 0x98, 0x73, 0xe9, 0x8e, 0x95, 0x41, 0x0d, 0x51, 0x44, 0x8c, 0xc4,
|
||||
0x3f, 0x03, 0xc4, 0xdb, 0xee, 0x80, 0x72, 0x8b, 0x0f, 0x07, 0x03, 0xd7, 0xf3, 0x69, 0x47, 0xd6,
|
||||
0x34, 0x4f, 0xee, 0x04, 0xb8, 0x11, 0xc1, 0xf8, 0x05, 0x94, 0x3c, 0xca, 0x07, 0xae, 0xc3, 0xa9,
|
||||
0xec, 0xec, 0x49, 0x93, 0x8c, 0x34, 0x59, 0x8b, 0x78, 0xb1, 0x29, 0xef, 0xb1, 0xec, 0xbb, 0x9d,
|
||||
0x98, 0x65, 0x36, 0x6e, 0x59, 0x17, 0xf4, 0xd8, 0xb2, 0x0c, 0xab, 0x5d, 0xcf, 0x76, 0xfc, 0xa9,
|
||||
0x05, 0x83, 0x43, 0xbe, 0x2c, 0xc9, 0x5b, 0xab, 0x3d, 0x85, 0x15, 0xbb, 0xed, 0x59, 0xd7, 0x76,
|
||||
0x6f, 0x18, 0x33, 0xc9, 0x87, 0xf7, 0x42, 0xdb, 0x3b, 0x93, 0xd4, 0xd8, 0xe2, 0x33, 0xb8, 0xcb,
|
||||
0x87, 0x17, 0xbf, 0xa5, 0xed, 0xe9, 0x75, 0x40, 0x1a, 0xad, 0x86, 0x74, 0x7c, 0xa5, 0xed, 0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x72, 0xba, 0xfe,
|
||||
0xb7, 0x04, 0x64, 0xc3, 0x54, 0xc4, 0x02, 0x17, 0x36, 0xa7, 0x56, 0x87, 0x3a, 0x6e, 0x3f, 0xb4,
|
||||
0xcb, 0x0b, 0xa4, 0x2a, 0x00, 0x7c, 0x1f, 0xf2, 0x62, 0x6b, 0x3c, 0xdb, 0xa7, 0x41, 0x8d, 0xf3,
|
||||
0x44, 0xec, 0x15, 0x11, 0x73, 0xfc, 0x04, 0x8a, 0xcc, 0x61, 0xbe, 0xd5, 0xb5, 0xb9, 0xd5, 0x63,
|
||||
0x7d, 0x16, 0x1c, 0xe1, 0x34, 0x59, 0x10, 0xe8, 0xb1, 0xcd, 0x6b, 0x02, 0xc3, 0x8f, 0x60, 0x81,
|
||||
0x71, 0x8b, 0xb3, 0xfe, 0xb0, 0x27, 0x9e, 0x47, 0x59, 0xa1, 0x1c, 0x29, 0x30, 0x6e, 0x44, 0x90,
|
||||
0x90, 0x08, 0x1f, 0xfd, 0x61, 0xcf, 0x67, 0x83, 0xde, 0x8d, 0x2c, 0x42, 0x82, 0x14, 0xba, 0x36,
|
||||
0xaf, 0x87, 0xd0, 0xfa, 0x53, 0x80, 0xf1, 0x06, 0x4e, 0xbd, 0x06, 0x18, 0x52, 0xa2, 0x8b, 0xc3,
|
||||
0x24, 0xe5, 0x78, 0xf7, 0x2f, 0xd1, 0x33, 0x28, 0x1f, 0xa5, 0x75, 0x58, 0x53, 0x0c, 0x43, 0x33,
|
||||
0x2d, 0xf3, 0x55, 0x4b, 0xb3, 0x4e, 0x1b, 0x46, 0x4b, 0x53, 0xf5, 0x23, 0x5d, 0xab, 0xa2, 0x39,
|
||||
0xbc, 0x0a, 0x4b, 0x13, 0x5c, 0x43, 0x31, 0xf5, 0x33, 0x0d, 0x25, 0xf0, 0x1a, 0xe0, 0x09, 0xf8,
|
||||
0x9c, 0x28, 0xad, 0x96, 0x56, 0x45, 0xf3, 0xb7, 0x70, 0xc3, 0x54, 0x4e, 0x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 0x13, 0xdf, 0x5b, 0x51, 0xdd, 0x48, 0xb3, 0x76,
|
||||
0x7b, 0xdb, 0xef, 0xc3, 0xdd, 0x11, 0x23, 0x7a, 0x55, 0x6b, 0x98, 0xba, 0xaa, 0x98, 0x7a, 0xb3,
|
||||
0x11, 0x1c, 0x9b, 0x31, 0x69, 0x18, 0x1a, 0x91, 0xf8, 0xa8, 0x71, 0x24, 0x5e, 0xd5, 0x6a, 0xda,
|
||||
0x71, 0x60, 0x90, 0x8c, 0x11, 0x7a, 0xe3, 0xac, 0x19, 0x7a, 0x4a, 0xed, 0xfe, 0x33, 0x08, 0x46,
|
||||
0xde, 0x3a, 0x61, 0x30, 0x33, 0xee, 0x9c, 0xb0, 0x62, 0x92, 0x69, 0xaa, 0xa6, 0x66, 0xa2, 0x44,
|
||||
0x54, 0x31, 0x89, 0x69, 0xb5, 0x9a, 0xde, 0x32, 0x75, 0x15, 0xcd, 0x63, 0x04, 0x0b, 0x23, 0x98,
|
||||
0x18, 0x0a, 0x4a, 0x46, 0xc1, 0x06, 0xf7, 0xcf, 0xab, 0x7a, 0x5d, 0x33, 0x89, 0xae, 0xa2, 0x14,
|
||||
0x5e, 0x82, 0xc5, 0x11, 0xfe, 0xb2, 0xae, 0x88, 0x83, 0x3a, 0x69, 0x5c, 0x6f, 0xa9, 0x28, 0x83,
|
||||
0xef, 0x40, 0x61, 0x84, 0x7c, 0x75, 0x82, 0xb2, 0xb1, 0x65, 0x47, 0xc7, 0x38, 0x17, 0x8b, 0xb0,
|
||||
0xa2, 0xb7, 0x9e, 0x95, 0x51, 0x7e, 0xf7, 0xcf, 0x29, 0xb8, 0xd3, 0xa2, 0x5e, 0x9f, 0x71, 0xce,
|
||||
0x5c, 0xc7, 0x10, 0xdf, 0x54, 0x78, 0x0b, 0x1e, 0xb4, 0x34, 0x52, 0xd7, 0x0d, 0x43, 0x6f, 0x36,
|
||||
0x2c, 0x43, 0x6d, 0x4e, 0xe5, 0xba, 0x09, 0xf7, 0xa7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, 0xe6, 0xfe, 0xf1, 0x6e, 0x63, 0xee, 0xab, 0xed, 0x2e,
|
||||
0xf3, 0xaf, 0x86, 0x17, 0x7b, 0x6d, 0xb7, 0xbf, 0xef, 0x3a, 0xdc, 0x75, 0xbc, 0x7d, 0xf9, 0xf3,
|
||||
0x66, 0x5f, 0xfc, 0x0d, 0x2b, 0x3f, 0x59, 0x2f, 0x32, 0xf2, 0x1f, 0x1f, 0xcf, 0xfe, 0x1f, 0x00,
|
||||
0x00, 0xff, 0xff, 0xf7, 0xde, 0xdb, 0x8f, 0x41, 0x11, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *Params) Equal(that interface{}) bool {
|
||||
@@ -972,6 +1431,23 @@ func (this *Params) Equal(that interface{}) bool {
|
||||
if !this.OpenidConfig.Equal(that1.OpenidConfig) {
|
||||
return false
|
||||
}
|
||||
if this.IpfsActive != that1.IpfsActive {
|
||||
return false
|
||||
}
|
||||
if this.LocalhostRegistrationEnabled != that1.LocalhostRegistrationEnabled {
|
||||
return false
|
||||
}
|
||||
if this.ConveyancePreference != that1.ConveyancePreference {
|
||||
return false
|
||||
}
|
||||
if len(this.AttestationFormats) != len(that1.AttestationFormats) {
|
||||
return false
|
||||
}
|
||||
for i := range this.AttestationFormats {
|
||||
if this.AttestationFormats[i] != that1.AttestationFormats[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
||||
@@ -1027,6 +1503,42 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.AttestationFormats) > 0 {
|
||||
for iNdEx := len(m.AttestationFormats) - 1; iNdEx >= 0; iNdEx-- {
|
||||
i -= len(m.AttestationFormats[iNdEx])
|
||||
copy(dAtA[i:], m.AttestationFormats[iNdEx])
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.AttestationFormats[iNdEx])))
|
||||
i--
|
||||
dAtA[i] = 0x42
|
||||
}
|
||||
}
|
||||
if len(m.ConveyancePreference) > 0 {
|
||||
i -= len(m.ConveyancePreference)
|
||||
copy(dAtA[i:], m.ConveyancePreference)
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.ConveyancePreference)))
|
||||
i--
|
||||
dAtA[i] = 0x3a
|
||||
}
|
||||
if m.LocalhostRegistrationEnabled {
|
||||
i--
|
||||
if m.LocalhostRegistrationEnabled {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x30
|
||||
}
|
||||
if m.IpfsActive {
|
||||
i--
|
||||
if m.IpfsActive {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x28
|
||||
}
|
||||
if m.OpenidConfig != nil {
|
||||
{
|
||||
size, err := m.OpenidConfig.MarshalToSizedBuffer(dAtA[:i])
|
||||
@@ -1688,6 +2200,22 @@ func (m *Params) Size() (n int) {
|
||||
l = m.OpenidConfig.Size()
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
if m.IpfsActive {
|
||||
n += 2
|
||||
}
|
||||
if m.LocalhostRegistrationEnabled {
|
||||
n += 2
|
||||
}
|
||||
l = len(m.ConveyancePreference)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
if len(m.AttestationFormats) > 0 {
|
||||
for _, s := range m.AttestationFormats {
|
||||
l = len(s)
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
@@ -2213,6 +2741,110 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 5:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field IpfsActive", wireType)
|
||||
}
|
||||
var v int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
v |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
m.IpfsActive = bool(v != 0)
|
||||
case 6:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field LocalhostRegistrationEnabled", wireType)
|
||||
}
|
||||
var v int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
v |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
m.LocalhostRegistrationEnabled = bool(v != 0)
|
||||
case 7:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ConveyancePreference", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
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 ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ConveyancePreference = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 8:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AttestationFormats", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
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 ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.AttestationFormats = append(m.AttestationFormats, string(dAtA[iNdEx:postIndex]))
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenesis(dAtA[iNdEx:])
|
||||
|
||||
@@ -87,3 +87,51 @@ func (k *KeyInfo) EncodePublicKey(data []byte) (string, error) {
|
||||
}
|
||||
return "", ErrUnsupportedKeyEncoding
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
|
||||
var WalletKeyInfo = &KeyInfo{
|
||||
Role: KeyRole_KEY_ROLE_DELEGATION,
|
||||
Curve: KeyCurve_KEY_CURVE_SECP256K1,
|
||||
Algorithm: KeyAlgorithm_KEY_ALGORITHM_ECDSA,
|
||||
Encoding: KeyEncoding_KEY_ENCODING_HEX,
|
||||
Type: KeyType_KEY_TYPE_BIP32,
|
||||
}
|
||||
|
||||
var EthKeyInfo = &KeyInfo{
|
||||
Role: KeyRole_KEY_ROLE_DELEGATION,
|
||||
Curve: KeyCurve_KEY_CURVE_KECCAK256,
|
||||
Algorithm: KeyAlgorithm_KEY_ALGORITHM_ECDSA,
|
||||
Encoding: KeyEncoding_KEY_ENCODING_HEX,
|
||||
Type: KeyType_KEY_TYPE_BIP32,
|
||||
}
|
||||
|
||||
var SonrKeyInfo = &KeyInfo{
|
||||
Role: KeyRole_KEY_ROLE_INVOCATION,
|
||||
Curve: KeyCurve_KEY_CURVE_P256,
|
||||
Algorithm: KeyAlgorithm_KEY_ALGORITHM_ECDSA,
|
||||
Encoding: KeyEncoding_KEY_ENCODING_HEX,
|
||||
Type: KeyType_KEY_TYPE_MPC,
|
||||
}
|
||||
|
||||
var ChainCodeKeyInfos = map[ChainCode]*KeyInfo{
|
||||
ChainCodeBTC: WalletKeyInfo,
|
||||
ChainCodeETH: EthKeyInfo,
|
||||
ChainCodeSNR: SonrKeyInfo,
|
||||
ChainCodeIBC: WalletKeyInfo,
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"cosmossdk.io/collections"
|
||||
|
||||
ormv1alpha1 "cosmossdk.io/api/cosmos/orm/v1alpha1"
|
||||
)
|
||||
|
||||
// ParamsKey saves the current module params.
|
||||
var ParamsKey = collections.NewPrefix(0)
|
||||
|
||||
const (
|
||||
ModuleName = "did"
|
||||
|
||||
StoreKey = ModuleName
|
||||
|
||||
QuerierRoute = ModuleName
|
||||
)
|
||||
|
||||
var ORMModuleSchema = ormv1alpha1.ModuleSchemaDescriptor{
|
||||
SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{
|
||||
{Id: 1, ProtoFileName: "did/v1/state.proto"},
|
||||
},
|
||||
Prefix: []byte{0},
|
||||
}
|
||||
+667
-383
File diff suppressed because it is too large
Load Diff
+35
-35
@@ -48,41 +48,6 @@ func (msg *MsgUpdateParams) Validate() error {
|
||||
return msg.Params.Validate()
|
||||
}
|
||||
|
||||
//
|
||||
// [RegisterController]
|
||||
//
|
||||
|
||||
// NewMsgRegisterController creates a new instance of MsgRegisterController
|
||||
func NewMsgRegisterController(
|
||||
sender sdk.Address,
|
||||
) (*MsgRegisterController, error) {
|
||||
return &MsgRegisterController{
|
||||
Authority: sender.String(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Route returns the name of the module
|
||||
func (msg MsgRegisterController) Route() string { return ModuleName }
|
||||
|
||||
// Type returns the the action
|
||||
func (msg MsgRegisterController) Type() string { return "register_controller" }
|
||||
|
||||
// GetSignBytes implements the LegacyMsg interface.
|
||||
func (msg MsgRegisterController) GetSignBytes() []byte {
|
||||
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
|
||||
}
|
||||
|
||||
// GetSigners returns the expected signers for a MsgUpdateParams message.
|
||||
func (msg *MsgRegisterController) GetSigners() []sdk.AccAddress {
|
||||
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
|
||||
return []sdk.AccAddress{addr}
|
||||
}
|
||||
|
||||
// ValidateBasic does a sanity check on the provided data.
|
||||
func (msg *MsgRegisterController) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//
|
||||
// [RegisterService]
|
||||
//
|
||||
@@ -152,3 +117,38 @@ func (msg *MsgAllocateVault) GetSigners() []sdk.AccAddress {
|
||||
func (msg *MsgAllocateVault) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//
|
||||
// [RegisterController]
|
||||
//
|
||||
|
||||
// NewMsgRegisterController creates a new instance of MsgRegisterController
|
||||
func NewMsgRegisterController(
|
||||
sender sdk.Address,
|
||||
) (*MsgRegisterController, error) {
|
||||
return &MsgRegisterController{
|
||||
Authority: sender.String(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Route returns the name of the module
|
||||
func (msg MsgRegisterController) Route() string { return ModuleName }
|
||||
|
||||
// Type returns the the action
|
||||
func (msg MsgRegisterController) Type() string { return "register_controller" }
|
||||
|
||||
// GetSignBytes implements the LegacyMsg interface.
|
||||
func (msg MsgRegisterController) GetSignBytes() []byte {
|
||||
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
|
||||
}
|
||||
|
||||
// GetSigners returns the expected signers for a MsgUpdateParams message.
|
||||
func (msg *MsgRegisterController) GetSigners() []sdk.AccAddress {
|
||||
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
|
||||
return []sdk.AccAddress{addr}
|
||||
}
|
||||
|
||||
// ValidateBasic does a sanity check on the provided data.
|
||||
func (msg *MsgRegisterController) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
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
|
||||
}
|
||||
+77
-3
@@ -1,13 +1,29 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
"math/big"
|
||||
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
"github.com/onsonr/crypto/core/curves"
|
||||
"github.com/onsonr/crypto/signatures/ecdsa"
|
||||
"golang.org/x/crypto/sha3"
|
||||
)
|
||||
|
||||
// NewEthPublicKey returns a new ethereum public key
|
||||
func NewPublicKey(data []byte, keyInfo *KeyInfo) (*PubKey, error) {
|
||||
encKey, err := keyInfo.Encoding.EncodeRaw(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &PubKey{
|
||||
Role: keyInfo.Role,
|
||||
Raw: encKey,
|
||||
Role: keyInfo.Role,
|
||||
Encoding: keyInfo.Encoding,
|
||||
Algorithm: keyInfo.Algorithm,
|
||||
Curve: keyInfo.Curve,
|
||||
KeyType: keyInfo.Type,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -18,12 +34,39 @@ func (k *PubKey) Address() cryptotypes.Address {
|
||||
|
||||
// Bytes returns the raw bytes of the public key
|
||||
func (k *PubKey) Bytes() []byte {
|
||||
return k.GetRaw()
|
||||
bz, _ := k.GetEncoding().DecodeRaw(k.GetRaw())
|
||||
return bz
|
||||
}
|
||||
|
||||
// Clone returns a copy of the public key
|
||||
func (k *PubKey) Clone() cryptotypes.PubKey {
|
||||
return &PubKey{
|
||||
Raw: k.GetRaw(),
|
||||
Role: k.GetRole(),
|
||||
Encoding: k.GetEncoding(),
|
||||
Algorithm: k.GetAlgorithm(),
|
||||
Curve: k.GetCurve(),
|
||||
KeyType: k.GetKeyType(),
|
||||
}
|
||||
}
|
||||
|
||||
// VerifySignature verifies a signature over the given message
|
||||
func (k *PubKey) VerifySignature(msg []byte, sig []byte) bool {
|
||||
return false
|
||||
pp, err := buildEcPoint(k.Bytes())
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
sigEd, err := ecdsa.DeserializeSecp256k1Signature(sig)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
hash := sha3.New256()
|
||||
_, err = hash.Write(msg)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
digest := hash.Sum(nil)
|
||||
return curves.VerifyEcdsa(pp, digest[:], sigEd)
|
||||
}
|
||||
|
||||
// Equals returns true if two public keys are equal
|
||||
@@ -38,3 +81,34 @@ func (k *PubKey) Equals(k2 cryptotypes.PubKey) bool {
|
||||
func (k *PubKey) Type() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// VerifySignature verifies the signature of a message
|
||||
func VerifySignature(key []byte, msg []byte, sig []byte) bool {
|
||||
pp, err := buildEcPoint(key)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
sigEd, err := ecdsa.DeserializeSecp256k1Signature(sig)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
hash := sha3.New256()
|
||||
_, err = hash.Write(msg)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
digest := hash.Sum(nil)
|
||||
return curves.VerifyEcdsa(pp, digest[:], sigEd)
|
||||
}
|
||||
|
||||
// BuildEcPoint builds an elliptic curve point from a compressed byte slice
|
||||
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:])
|
||||
ecCurve, err := crv.ToEllipticCurve()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error converting curve: %v", err)
|
||||
}
|
||||
return &curves.EcPoint{X: x, Y: y, Curve: ecCurve}, nil
|
||||
}
|
||||
|
||||
+968
-682
File diff suppressed because it is too large
Load Diff
@@ -69,172 +69,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal
|
||||
|
||||
}
|
||||
|
||||
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 QueryRequest
|
||||
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)
|
||||
}
|
||||
|
||||
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 QueryRequest
|
||||
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)
|
||||
}
|
||||
|
||||
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 QueryRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["origin"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "origin")
|
||||
}
|
||||
|
||||
protoReq.Origin, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
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 QueryRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["origin"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "origin")
|
||||
}
|
||||
|
||||
protoReq.Origin, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_Resolve_0 = &utilities.DoubleArray{Encoding: map[string]int{"did": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
)
|
||||
@@ -379,42 +213,6 @@ func local_request_Query_Service_0(ctx context.Context, marshaler runtime.Marsha
|
||||
|
||||
}
|
||||
|
||||
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.
|
||||
@@ -444,52 +242,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Accounts_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_Accounts_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_Accounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Credentials_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_Credentials_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_Credentials_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()
|
||||
@@ -536,29 +288,6 @@ 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
|
||||
}
|
||||
|
||||
@@ -620,46 +349,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Accounts_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_Accounts_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_Accounts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Credentials_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_Credentials_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_Credentials_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()
|
||||
@@ -700,53 +389,21 @@ 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
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"did", "params"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
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, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"service", "origin", "subject", "credentials"}, "", 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_Service_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"service", "origin"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_Token_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"token"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Query_Params_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Accounts_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Credentials_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Resolve_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Service_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Token_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
||||
@@ -22,8 +22,8 @@ var (
|
||||
StringToPermissionScope = map[string]PermissionScope{
|
||||
"PERMISSION_SCOPE_UNSPECIFIED": PermissionScope_PERMISSION_SCOPE_UNSPECIFIED,
|
||||
"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_IDENTIFIERS_EMAIL": PermissionScope_PERMISSION_SCOPE_PERMISSIONS_READ,
|
||||
"PERMISSION_SCOPE_IDENTIFIERS_PHONE": PermissionScope_PERMISSION_SCOPE_PERMISSIONS_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,
|
||||
@@ -7,6 +7,7 @@ func (m *MsgRegisterService) ExtractServiceRecord() (*didv1.ServiceRecord, error
|
||||
Controller: m.Controller,
|
||||
OriginUri: m.OriginUri,
|
||||
Description: m.Description,
|
||||
Permissions: convertPermissions(m.GetScopes()),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -16,3 +17,12 @@ func convertPermissions(permissions *Permissions) *didv1.Permissions {
|
||||
}
|
||||
return &didv1.Permissions{}
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
+374
-263
@@ -23,31 +23,154 @@ var _ = math.Inf
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// Assertion represents strongly created credentials (e.g., Passkeys, SSH, GPG, Native Secure Enclaave)
|
||||
type Assertion struct {
|
||||
// Authentication represents strongly created credentials (e.g., Passkeys, SSH, GPG, Native Secure Enclaave)
|
||||
type Authentication struct {
|
||||
// The unique identifier of the attestation
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
// The controller of the attestation
|
||||
Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"`
|
||||
// Key type (e.g., "passkey", "ssh", "gpg", "native-secure-enclave")
|
||||
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"`
|
||||
Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"`
|
||||
// The subject of the attestation
|
||||
Subject string `protobuf:"bytes,7,opt,name=subject,proto3" json:"subject,omitempty"`
|
||||
Subject string `protobuf:"bytes,5,opt,name=subject,proto3" json:"subject,omitempty"`
|
||||
// The value of the linked identifier
|
||||
CredentialId []byte `protobuf:"bytes,6,opt,name=credential_id,json=credentialId,proto3" json:"credential_id,omitempty"`
|
||||
// The credential label
|
||||
CredentialLabel string `protobuf:"bytes,7,opt,name=credential_label,json=credentialLabel,proto3" json:"credential_label,omitempty"`
|
||||
// The display label of the attestation
|
||||
CredentialTransport []string `protobuf:"bytes,8,rep,name=credential_transport,json=credentialTransport,proto3" json:"credential_transport,omitempty"`
|
||||
// The attestationtype of the attestation
|
||||
AttestationType string `protobuf:"bytes,9,opt,name=attestation_type,json=attestationType,proto3" json:"attestation_type,omitempty"`
|
||||
// Metadata is optional additional information about the assertion
|
||||
Metadata *Metadata `protobuf:"bytes,8,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
Metadata *Metadata `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Authentication) Reset() { *m = Authentication{} }
|
||||
func (m *Authentication) String() string { return proto.CompactTextString(m) }
|
||||
func (*Authentication) ProtoMessage() {}
|
||||
func (*Authentication) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f44bb702879c34b4, []int{0}
|
||||
}
|
||||
func (m *Authentication) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *Authentication) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_Authentication.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *Authentication) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Authentication.Merge(m, src)
|
||||
}
|
||||
func (m *Authentication) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *Authentication) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Authentication.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Authentication proto.InternalMessageInfo
|
||||
|
||||
func (m *Authentication) GetId() string {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Authentication) GetController() string {
|
||||
if m != nil {
|
||||
return m.Controller
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Authentication) GetPublicKey() *PubKey {
|
||||
if m != nil {
|
||||
return m.PublicKey
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Authentication) GetOrigin() string {
|
||||
if m != nil {
|
||||
return m.Origin
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Authentication) GetSubject() string {
|
||||
if m != nil {
|
||||
return m.Subject
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Authentication) GetCredentialId() []byte {
|
||||
if m != nil {
|
||||
return m.CredentialId
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Authentication) GetCredentialLabel() string {
|
||||
if m != nil {
|
||||
return m.CredentialLabel
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Authentication) GetCredentialTransport() []string {
|
||||
if m != nil {
|
||||
return m.CredentialTransport
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Authentication) GetAttestationType() string {
|
||||
if m != nil {
|
||||
return m.AttestationType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Authentication) GetMetadata() *Metadata {
|
||||
if m != nil {
|
||||
return m.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Assertion represents linked identifiers (e.g., Crypto Accounts, Github, Email, Phone)
|
||||
type Assertion struct {
|
||||
// The unique identifier of the attestation
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
// The type of the linked identifier (e.g., "crypto", "github", "email", "phone")
|
||||
Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"`
|
||||
// The value of the linked identifier
|
||||
PublicKey *PubKey `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
|
||||
// The origin of the attestation
|
||||
Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"`
|
||||
// The subject of the attestation
|
||||
Subject string `protobuf:"bytes,5,opt,name=subject,proto3" json:"subject,omitempty"`
|
||||
// The controller of the attestation
|
||||
Metadata *Metadata `protobuf:"bytes,6,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Assertion) Reset() { *m = Assertion{} }
|
||||
func (m *Assertion) String() string { return proto.CompactTextString(m) }
|
||||
func (*Assertion) ProtoMessage() {}
|
||||
func (*Assertion) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f44bb702879c34b4, []int{0}
|
||||
return fileDescriptor_f44bb702879c34b4, []int{1}
|
||||
}
|
||||
func (m *Assertion) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -97,20 +220,6 @@ func (m *Assertion) GetPublicKey() *PubKey {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Assertion) GetCredentialId() []byte {
|
||||
if m != nil {
|
||||
return m.CredentialId
|
||||
}
|
||||
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
|
||||
@@ -132,97 +241,6 @@ func (m *Assertion) GetMetadata() *Metadata {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Attestation represents linked identifiers (e.g., Crypto Accounts, Github, Email, Phone)
|
||||
type Attestation struct {
|
||||
// The unique identifier of the attestation
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
// The type of the linked identifier (e.g., "crypto", "github", "email", "phone")
|
||||
Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"`
|
||||
// The value of the linked identifier
|
||||
PublicKey *PubKey `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
|
||||
// The origin of the attestation
|
||||
Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"`
|
||||
// The subject of the attestation
|
||||
Subject string `protobuf:"bytes,5,opt,name=subject,proto3" json:"subject,omitempty"`
|
||||
// The controller of the attestation
|
||||
Metadata *Metadata `protobuf:"bytes,6,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Attestation) Reset() { *m = Attestation{} }
|
||||
func (m *Attestation) String() string { return proto.CompactTextString(m) }
|
||||
func (*Attestation) ProtoMessage() {}
|
||||
func (*Attestation) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_f44bb702879c34b4, []int{1}
|
||||
}
|
||||
func (m *Attestation) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *Attestation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_Attestation.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *Attestation) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Attestation.Merge(m, src)
|
||||
}
|
||||
func (m *Attestation) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *Attestation) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Attestation.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Attestation proto.InternalMessageInfo
|
||||
|
||||
func (m *Attestation) GetId() string {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Attestation) GetController() string {
|
||||
if m != nil {
|
||||
return m.Controller
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Attestation) GetPublicKey() *PubKey {
|
||||
if m != nil {
|
||||
return m.PublicKey
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Attestation) GetOrigin() string {
|
||||
if m != nil {
|
||||
return m.Origin
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Attestation) GetSubject() string {
|
||||
if m != nil {
|
||||
return m.Subject
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Attestation) GetMetadata() *Metadata {
|
||||
if m != nil {
|
||||
return m.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Controller represents a Sonr DWN Vault
|
||||
type Controller struct {
|
||||
// The unique identifier of the controller
|
||||
@@ -515,8 +533,8 @@ func (m *ServiceRecord) GetMetadata() *Metadata {
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Authentication)(nil), "did.v1.Authentication")
|
||||
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((*ServiceRecord)(nil), "did.v1.ServiceRecord")
|
||||
@@ -526,60 +544,63 @@ func init() {
|
||||
func init() { proto.RegisterFile("did/v1/state.proto", fileDescriptor_f44bb702879c34b4) }
|
||||
|
||||
var fileDescriptor_f44bb702879c34b4 = []byte{
|
||||
// 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, 0xf6, 0xb2, 0xa7, 0xd5, 0x0a, 0xa4, 0xfd, 0x00,
|
||||
0x7b, 0xde, 0xc3, 0x6a, 0x3c, 0x1e, 0x32, 0x84, 0x45, 0x08, 0x0e, 0x7b, 0x41, 0xf8, 0xff, 0xfe,
|
||||
0x8e, 0xdf, 0xfb, 0x3d, 0x3f, 0x0f, 0x20, 0xc2, 0x48, 0x77, 0xba, 0xdf, 0x95, 0xca, 0x57, 0xb4,
|
||||
0x33, 0x11, 0x5c, 0x71, 0x54, 0x22, 0x8c, 0x74, 0xa6, 0xfb, 0x5b, 0x9b, 0x01, 0x97, 0x63, 0x2e,
|
||||
0xbb, 0x5c, 0x8c, 0x13, 0x0b, 0x17, 0xe3, 0xd4, 0xb0, 0xb5, 0x6e, 0x36, 0x8d, 0x68, 0x44, 0x25,
|
||||
0x93, 0x46, 0x5d, 0x33, 0xea, 0x98, 0x13, 0x1a, 0x1a, 0xb1, 0xf5, 0xc6, 0x86, 0xca, 0xa1, 0x94,
|
||||
0x54, 0x28, 0xc6, 0x23, 0x54, 0x07, 0x9b, 0x11, 0x6c, 0x35, 0xad, 0x76, 0xa5, 0x6f, 0x33, 0x82,
|
||||
0x3c, 0x80, 0x80, 0x47, 0x4a, 0xf0, 0x30, 0xa4, 0x02, 0xdb, 0x5a, 0xcf, 0x29, 0xe8, 0x73, 0x80,
|
||||
0x49, 0x3c, 0x0c, 0x59, 0x30, 0xf8, 0x93, 0xce, 0xb0, 0xd3, 0xb4, 0xda, 0xee, 0x41, 0xbd, 0x93,
|
||||
0xa6, 0xd7, 0xf9, 0x29, 0x1e, 0x9e, 0xd2, 0x59, 0xbf, 0x92, 0x3a, 0x4e, 0xe9, 0x0c, 0xed, 0x42,
|
||||
0x2d, 0x10, 0x94, 0xd0, 0x48, 0x31, 0x3f, 0x1c, 0x30, 0x82, 0x0b, 0x4d, 0xab, 0x5d, 0xed, 0x57,
|
||||
0xe7, 0xe2, 0x09, 0x41, 0x9f, 0x42, 0x23, 0x67, 0x0a, 0xfd, 0x21, 0x0d, 0x71, 0x51, 0x9f, 0xbc,
|
||||
0x32, 0xd7, 0x7f, 0x48, 0x64, 0xf4, 0x01, 0x94, 0xb8, 0x60, 0x23, 0x16, 0xe1, 0x92, 0x36, 0x98,
|
||||
0x15, 0xc2, 0xb0, 0x2c, 0xe3, 0xe1, 0x1f, 0x34, 0x50, 0x78, 0x59, 0x07, 0xb2, 0x25, 0xda, 0x83,
|
||||
0xf2, 0x98, 0x2a, 0x9f, 0xf8, 0xca, 0xc7, 0x65, 0x9d, 0x6e, 0x23, 0x4b, 0xf7, 0x47, 0xa3, 0xf7,
|
||||
0x6f, 0x1c, 0xbd, 0xdf, 0x5f, 0xff, 0xfb, 0xec, 0x6f, 0xe7, 0x0c, 0x0a, 0x09, 0x16, 0xb4, 0x0e,
|
||||
0x75, 0xf3, 0x33, 0x7b, 0xe9, 0x39, 0x0d, 0x0b, 0x5b, 0x68, 0x13, 0x56, 0xe7, 0x40, 0xb2, 0x80,
|
||||
0x8d, 0x2d, 0xb4, 0x03, 0xdb, 0xb9, 0xc0, 0x62, 0x49, 0x0d, 0x07, 0x5b, 0xd8, 0x6a, 0xfd, 0x65,
|
||||
0x83, 0x7b, 0xa8, 0x14, 0x4d, 0xda, 0xfb, 0x1e, 0x1a, 0x30, 0x07, 0x56, 0xb8, 0x0f, 0x58, 0xf1,
|
||||
0x7e, 0x60, 0xa5, 0x07, 0x81, 0x7d, 0xab, 0x81, 0x7d, 0xf5, 0x24, 0x60, 0xd8, 0x6e, 0xfd, 0x6f,
|
||||
0x01, 0x1c, 0xcd, 0x8b, 0x5b, 0x84, 0x81, 0x61, 0xd9, 0x27, 0x44, 0x50, 0x29, 0x0d, 0x89, 0x6c,
|
||||
0xa9, 0x23, 0x21, 0xf3, 0x25, 0x95, 0xd8, 0x69, 0x3a, 0x3a, 0x92, 0x2e, 0x17, 0x00, 0x15, 0x1e,
|
||||
0x02, 0xb4, 0x0d, 0x95, 0xa9, 0x1f, 0x87, 0x6a, 0x10, 0x30, 0x62, 0x50, 0x94, 0xb5,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25, 0xfd, 0xa9, 0xfb, 0xe2, 0x6d, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0x39, 0xd5, 0x9b, 0xc7, 0x4c, 0x07, 0x00, 0x00,
|
||||
// 833 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x95, 0x41, 0x6f, 0x23, 0x35,
|
||||
0x14, 0xc7, 0x3b, 0x33, 0x6d, 0x9a, 0xbc, 0xb4, 0x69, 0xd6, 0xed, 0x52, 0xd3, 0x8a, 0x21, 0x9b,
|
||||
0x3d, 0x10, 0x44, 0x49, 0xd4, 0x22, 0x04, 0xaa, 0xe0, 0x50, 0xca, 0x1e, 0x56, 0x0b, 0x12, 0x1a,
|
||||
0x16, 0x09, 0xed, 0x25, 0x38, 0x63, 0x2b, 0x35, 0x4c, 0xec, 0x91, 0xed, 0x89, 0x36, 0x1f, 0x81,
|
||||
0x0b, 0xe2, 0x13, 0xf0, 0x79, 0x38, 0x70, 0x58, 0x89, 0x0b, 0x27, 0x40, 0xad, 0xc4, 0x07, 0xe0,
|
||||
0x13, 0xa0, 0xb1, 0x3d, 0xcd, 0x34, 0x45, 0xaa, 0xe8, 0x89, 0x4b, 0x55, 0xff, 0xdf, 0xdf, 0xce,
|
||||
0x7b, 0xbf, 0xe7, 0xe7, 0x01, 0x44, 0x39, 0x1d, 0xcd, 0x8f, 0x47, 0xda, 0x10, 0xc3, 0x86, 0xb9,
|
||||
0x92, 0x46, 0xa2, 0x06, 0xe5, 0x74, 0x38, 0x3f, 0x3e, 0xd8, 0x4f, 0xa5, 0x9e, 0x49, 0x3d, 0x92,
|
||||
0x6a, 0x56, 0x5a, 0xa4, 0x9a, 0x39, 0xc3, 0xc1, 0x9e, 0xdf, 0x34, 0x65, 0x82, 0x69, 0xae, 0xbd,
|
||||
0xba, 0xeb, 0xd5, 0x99, 0xa4, 0x2c, 0xf3, 0x62, 0xff, 0x8f, 0x08, 0x3a, 0x67, 0x85, 0xb9, 0x60,
|
||||
0xc2, 0xf0, 0x94, 0x18, 0x2e, 0x05, 0xea, 0x40, 0xc8, 0x29, 0x0e, 0x7a, 0xc1, 0xa0, 0x95, 0x84,
|
||||
0x9c, 0xa2, 0x18, 0x20, 0x95, 0xc2, 0x28, 0x99, 0x65, 0x4c, 0xe1, 0xd0, 0xea, 0x35, 0x05, 0xbd,
|
||||
0x0b, 0x90, 0x17, 0x93, 0x8c, 0xa7, 0xe3, 0xef, 0xd8, 0x02, 0x47, 0xbd, 0x60, 0xd0, 0x3e, 0xe9,
|
||||
0x0c, 0x5d, 0x8e, 0xc3, 0x2f, 0x8a, 0xc9, 0x33, 0xb6, 0x48, 0x5a, 0xce, 0xf1, 0x8c, 0x2d, 0xd0,
|
||||
0x6b, 0xd0, 0x90, 0x8a, 0x4f, 0xb9, 0xc0, 0xeb, 0xf6, 0x28, 0xbf, 0x42, 0x18, 0x36, 0x75, 0x31,
|
||||
0xf9, 0x96, 0xa5, 0x06, 0x6f, 0xd8, 0x40, 0xb5, 0x44, 0x8f, 0x61, 0x3b, 0x55, 0x8c, 0x96, 0x29,
|
||||
0x92, 0x6c, 0xcc, 0x29, 0x6e, 0xf4, 0x82, 0xc1, 0x56, 0xb2, 0xb5, 0x14, 0x9f, 0x52, 0xf4, 0x36,
|
||||
0x74, 0x6b, 0xa6, 0x8c, 0x4c, 0x58, 0x86, 0x37, 0xed, 0x39, 0x3b, 0x4b, 0xfd, 0xb3, 0x52, 0x46,
|
||||
0xc7, 0xb0, 0x57, 0xb3, 0x1a, 0x45, 0x84, 0xce, 0xa5, 0x32, 0xb8, 0xd9, 0x8b, 0x06, 0xad, 0x64,
|
||||
0x77, 0x19, 0x7b, 0x5e, 0x85, 0xca, 0xd3, 0x89, 0x31, 0xac, 0xec, 0x02, 0x97, 0x62, 0x6c, 0x16,
|
||||
0x39, 0xc3, 0x2d, 0x77, 0x7a, 0x4d, 0x7f, 0xbe, 0xc8, 0x19, 0x3a, 0x82, 0xe6, 0x8c, 0x19, 0x42,
|
||||
0x89, 0x21, 0x18, 0x2c, 0x8c, 0x6e, 0x05, 0xe3, 0x73, 0xaf, 0x27, 0xd7, 0x8e, 0xd3, 0x6f, 0xfe,
|
||||
0xfe, 0xe9, 0xd7, 0x1f, 0xa2, 0x17, 0xb0, 0x5e, 0x42, 0x47, 0x7b, 0xd0, 0xf1, 0x45, 0x1f, 0x39,
|
||||
0x2a, 0xdd, 0x00, 0x07, 0x68, 0x1f, 0x1e, 0x2c, 0x71, 0x57, 0x81, 0x10, 0x07, 0xe8, 0x11, 0x1c,
|
||||
0xd6, 0x02, 0xab, 0xe5, 0x77, 0x23, 0x1c, 0xe0, 0xa0, 0xff, 0x7d, 0x08, 0xad, 0x33, 0xad, 0x99,
|
||||
0xfa, 0x7f, 0x36, 0xb7, 0x8e, 0xab, 0x71, 0x27, 0xae, 0x8f, 0x2d, 0xae, 0x0f, 0xee, 0x85, 0x0b,
|
||||
0x87, 0xfd, 0x5f, 0x02, 0x80, 0xf3, 0x65, 0x71, 0xab, 0x30, 0x30, 0x6c, 0x12, 0x4a, 0x15, 0xd3,
|
||||
0xda, 0x93, 0xa8, 0x96, 0x36, 0x92, 0x71, 0xa2, 0x99, 0xc6, 0x91, 0xbd, 0x25, 0xd5, 0x72, 0x05,
|
||||
0xd0, 0xfa, 0x5d, 0x80, 0x0e, 0xa1, 0x35, 0x27, 0x45, 0x66, 0xc6, 0x29, 0xa7, 0x1e, 0x45, 0xd3,
|
||||
0x0a, 0xe7, 0x9c, 0x9e, 0x0e, 0x6d, 0x75, 0x03, 0x5f, 0xdd, 0xf6, 0x75, 0x36, 0xb6, 0xac, 0x9d,
|
||||
0xda, 0x4e, 0x5b, 0x4e, 0xd4, 0xff, 0x3d, 0x04, 0xf8, 0x94, 0x65, 0x6c, 0x7a, 0xbf, 0xc1, 0x7d,
|
||||
0x13, 0xda, 0xe9, 0x05, 0xe1, 0x62, 0xcc, 0x05, 0x65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 0x51, 0xad, 0x9e, 0x54, 0xee, 0x27, 0xc2, 0xa8, 0x45, 0xd2, 0xd5, 0x2b,
|
||||
0x32, 0x7a, 0x1f, 0xda, 0x39, 0x53, 0x33, 0xae, 0x35, 0x97, 0x42, 0xdb, 0x36, 0xb4, 0x4f, 0x76,
|
||||
0xaf, 0x6f, 0xc0, 0x32, 0x94, 0xd4, 0x7d, 0x37, 0x66, 0xba, 0x79, 0xd7, 0x4c, 0x1f, 0x9c, 0xc3,
|
||||
0xc3, 0x7f, 0xcd, 0x07, 0x75, 0x21, 0x2a, 0xef, 0x9d, 0x83, 0x5d, 0xfe, 0x8b, 0xf6, 0x60, 0x63,
|
||||
0x4e, 0xb2, 0xa2, 0xc2, 0xec, 0x16, 0xa7, 0xe1, 0x87, 0xc1, 0xca, 0xc3, 0xd0, 0xad, 0x23, 0xb5,
|
||||
0x97, 0xe0, 0x10, 0x1e, 0xde, 0x7a, 0x14, 0x6c, 0xb0, 0x9c, 0xa4, 0x8d, 0x4f, 0x3e, 0xfa, 0xf9,
|
||||
0x32, 0x0e, 0x5e, 0x5d, 0xc6, 0xc1, 0x9f, 0x97, 0x71, 0xf0, 0xe3, 0x55, 0xbc, 0xf6, 0xea, 0x2a,
|
||||
0x5e, 0xfb, 0xed, 0x2a, 0x5e, 0x7b, 0xd1, 0x9f, 0x72, 0x73, 0x51, 0x4c, 0x86, 0xa9, 0x9c, 0x8d,
|
||||
0xa4, 0xd0, 0x52, 0xa8, 0x91, 0xfd, 0xf3, 0x72, 0x54, 0x7e, 0x4e, 0xcb, 0x9e, 0xeb, 0x49, 0xc3,
|
||||
0x7e, 0x4b, 0xdf, 0xfb, 0x27, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x9d, 0xfa, 0x62, 0xad, 0x07, 0x00,
|
||||
0x00,
|
||||
}
|
||||
|
||||
func (m *Assertion) Marshal() (dAtA []byte, err error) {
|
||||
func (m *Authentication) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
@@ -589,12 +610,12 @@ func (m *Assertion) Marshal() (dAtA []byte, err error) {
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *Assertion) MarshalTo(dAtA []byte) (int, error) {
|
||||
func (m *Authentication) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Assertion) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
func (m *Authentication) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
@@ -609,34 +630,50 @@ func (m *Assertion) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i = encodeVarintState(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x42
|
||||
dAtA[i] = 0x52
|
||||
}
|
||||
if len(m.Subject) > 0 {
|
||||
i -= len(m.Subject)
|
||||
copy(dAtA[i:], m.Subject)
|
||||
i = encodeVarintState(dAtA, i, uint64(len(m.Subject)))
|
||||
if len(m.AttestationType) > 0 {
|
||||
i -= len(m.AttestationType)
|
||||
copy(dAtA[i:], m.AttestationType)
|
||||
i = encodeVarintState(dAtA, i, uint64(len(m.AttestationType)))
|
||||
i--
|
||||
dAtA[i] = 0x3a
|
||||
dAtA[i] = 0x4a
|
||||
}
|
||||
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.CredentialTransport) > 0 {
|
||||
for iNdEx := len(m.CredentialTransport) - 1; iNdEx >= 0; iNdEx-- {
|
||||
i -= len(m.CredentialTransport[iNdEx])
|
||||
copy(dAtA[i:], m.CredentialTransport[iNdEx])
|
||||
i = encodeVarintState(dAtA, i, uint64(len(m.CredentialTransport[iNdEx])))
|
||||
i--
|
||||
dAtA[i] = 0x42
|
||||
}
|
||||
}
|
||||
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
|
||||
dAtA[i] = 0x3a
|
||||
}
|
||||
if len(m.CredentialId) > 0 {
|
||||
i -= len(m.CredentialId)
|
||||
copy(dAtA[i:], m.CredentialId)
|
||||
i = encodeVarintState(dAtA, i, uint64(len(m.CredentialId)))
|
||||
i--
|
||||
dAtA[i] = 0x32
|
||||
}
|
||||
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] = 0x2a
|
||||
}
|
||||
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] = 0x22
|
||||
}
|
||||
if m.PublicKey != nil {
|
||||
@@ -668,7 +705,7 @@ func (m *Assertion) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *Attestation) Marshal() (dAtA []byte, err error) {
|
||||
func (m *Assertion) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
@@ -678,12 +715,12 @@ func (m *Attestation) Marshal() (dAtA []byte, err error) {
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *Attestation) MarshalTo(dAtA []byte) (int, error) {
|
||||
func (m *Assertion) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Attestation) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
func (m *Assertion) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
@@ -997,7 +1034,7 @@ func encodeVarintState(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *Assertion) Size() (n int) {
|
||||
func (m *Authentication) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
@@ -1015,6 +1052,14 @@ func (m *Assertion) Size() (n int) {
|
||||
l = m.PublicKey.Size()
|
||||
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))
|
||||
}
|
||||
l = len(m.CredentialId)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovState(uint64(l))
|
||||
@@ -1023,11 +1068,13 @@ func (m *Assertion) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovState(uint64(l))
|
||||
}
|
||||
l = len(m.Origin)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovState(uint64(l))
|
||||
if len(m.CredentialTransport) > 0 {
|
||||
for _, s := range m.CredentialTransport {
|
||||
l = len(s)
|
||||
n += 1 + l + sovState(uint64(l))
|
||||
}
|
||||
}
|
||||
l = len(m.Subject)
|
||||
l = len(m.AttestationType)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovState(uint64(l))
|
||||
}
|
||||
@@ -1038,7 +1085,7 @@ func (m *Assertion) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *Attestation) Size() (n int) {
|
||||
func (m *Assertion) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
@@ -1190,7 +1237,7 @@ func sovState(x uint64) (n int) {
|
||||
func sozState(x uint64) (n int) {
|
||||
return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *Assertion) Unmarshal(dAtA []byte) error {
|
||||
func (m *Authentication) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
@@ -1213,10 +1260,10 @@ func (m *Assertion) Unmarshal(dAtA []byte) error {
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: Assertion: wiretype end group for non-group")
|
||||
return fmt.Errorf("proto: Authentication: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Assertion: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
return fmt.Errorf("proto: Authentication: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
@@ -1320,6 +1367,70 @@ func (m *Assertion) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
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 5:
|
||||
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 6:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field CredentialId", wireType)
|
||||
}
|
||||
@@ -1353,7 +1464,7 @@ func (m *Assertion) Unmarshal(dAtA []byte) error {
|
||||
m.CredentialId = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 5:
|
||||
case 7:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field CredentialLabel", wireType)
|
||||
}
|
||||
@@ -1385,71 +1496,71 @@ func (m *Assertion) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
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 CredentialTransport", 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.CredentialTransport = append(m.CredentialTransport, string(dAtA[iNdEx:postIndex]))
|
||||
iNdEx = postIndex
|
||||
case 9:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AttestationType", 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.AttestationType = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 10:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
|
||||
}
|
||||
@@ -1506,7 +1617,7 @@ func (m *Assertion) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Attestation) Unmarshal(dAtA []byte) error {
|
||||
func (m *Assertion) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
@@ -1529,10 +1640,10 @@ func (m *Attestation) Unmarshal(dAtA []byte) error {
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: Attestation: wiretype end group for non-group")
|
||||
return fmt.Errorf("proto: Assertion: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Attestation: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
return fmt.Errorf("proto: Assertion: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
|
||||
+133
-89
@@ -142,8 +142,8 @@ type MsgAllocateVault struct {
|
||||
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
|
||||
// subject is a unique human-defined identifier to associate with the vault.
|
||||
Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"`
|
||||
// token is the macron token to authenticate the operation.
|
||||
Token *Token `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"`
|
||||
// origin is the origin of the request in wildcard form.
|
||||
Origin string `protobuf:"bytes,3,opt,name=origin,proto3" json:"origin,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgAllocateVault) Reset() { *m = MsgAllocateVault{} }
|
||||
@@ -193,11 +193,11 @@ func (m *MsgAllocateVault) GetSubject() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgAllocateVault) GetToken() *Token {
|
||||
func (m *MsgAllocateVault) GetOrigin() string {
|
||||
if m != nil {
|
||||
return m.Token
|
||||
return m.Origin
|
||||
}
|
||||
return nil
|
||||
return ""
|
||||
}
|
||||
|
||||
// MsgAllocateVaultResponse is the response type for the AllocateVault RPC.
|
||||
@@ -206,6 +206,8 @@ type MsgAllocateVaultResponse struct {
|
||||
Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"`
|
||||
// ExpiryBlock is the block number at which the vault will expire.
|
||||
ExpiryBlock int64 `protobuf:"varint,2,opt,name=expiry_block,json=expiryBlock,proto3" json:"expiry_block,omitempty"`
|
||||
// RegistrationOptions is a json string of the PublicKeyCredentialCreationOptions for WebAuthn
|
||||
RegistrationOptions string `protobuf:"bytes,3,opt,name=registration_options,json=registrationOptions,proto3" json:"registration_options,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgAllocateVaultResponse) Reset() { *m = MsgAllocateVaultResponse{} }
|
||||
@@ -255,6 +257,13 @@ func (m *MsgAllocateVaultResponse) GetExpiryBlock() int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *MsgAllocateVaultResponse) GetRegistrationOptions() string {
|
||||
if m != nil {
|
||||
return m.RegistrationOptions
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// MsgProveWitness is the message type for the ProveWitness RPC.
|
||||
type MsgProveWitness struct {
|
||||
// authority is the address of the governance account.
|
||||
@@ -937,68 +946,69 @@ func init() {
|
||||
func init() { proto.RegisterFile("did/v1/tx.proto", fileDescriptor_d73284df019ff211) }
|
||||
|
||||
var fileDescriptor_d73284df019ff211 = []byte{
|
||||
// 974 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4d, 0x6f, 0x1b, 0x45,
|
||||
0x18, 0xce, 0xda, 0xb1, 0x13, 0xbf, 0xf9, 0x32, 0x53, 0xb7, 0x71, 0x57, 0xc4, 0x0d, 0x8b, 0x90,
|
||||
0xa2, 0x52, 0xec, 0x36, 0x95, 0x50, 0x15, 0x90, 0x50, 0x12, 0x55, 0xaa, 0x84, 0xac, 0x96, 0x0d,
|
||||
0x01, 0xa9, 0x12, 0x8a, 0x36, 0xb3, 0xa3, 0xed, 0x10, 0x7b, 0x67, 0x35, 0x33, 0x36, 0x31, 0x07,
|
||||
0x04, 0xfc, 0x02, 0xae, 0xfc, 0x07, 0x0e, 0x3d, 0xf4, 0x27, 0x70, 0xe8, 0xb1, 0x42, 0x1c, 0x38,
|
||||
0x21, 0x94, 0x1c, 0x2a, 0xf1, 0x2b, 0xd0, 0xec, 0xcc, 0x7e, 0xd8, 0xb1, 0x13, 0xc7, 0x5c, 0x12,
|
||||
0xbf, 0x1f, 0xf3, 0xce, 0xf3, 0x3e, 0xcf, 0x3b, 0xb3, 0x03, 0x6b, 0x3e, 0xf5, 0x5b, 0xfd, 0x07,
|
||||
0x2d, 0x79, 0xda, 0x8c, 0x38, 0x93, 0x0c, 0x95, 0x7d, 0xea, 0x37, 0xfb, 0x0f, 0xec, 0x75, 0xcc,
|
||||
0x44, 0x97, 0x89, 0x56, 0x57, 0x04, 0x2a, 0xde, 0x15, 0x81, 0x4e, 0xb0, 0x6f, 0xeb, 0xc0, 0x51,
|
||||
0x6c, 0xb5, 0xb4, 0x61, 0x42, 0xb7, 0x4c, 0x31, 0xcc, 0x42, 0x21, 0xbd, 0x50, 0x26, 0xfe, 0x9a,
|
||||
0xf1, 0x07, 0x24, 0x24, 0x82, 0x26, 0xde, 0x1b, 0xc6, 0xdb, 0x65, 0x3e, 0xe9, 0xa4, 0xa9, 0x01,
|
||||
0x0b, 0x98, 0x2e, 0xad, 0x7e, 0x69, 0xaf, 0xf3, 0x9b, 0x05, 0x6b, 0x6d, 0x11, 0x1c, 0x46, 0xbe,
|
||||
0x27, 0xc9, 0x33, 0x8f, 0x7b, 0x5d, 0x81, 0x3e, 0x86, 0x8a, 0xd7, 0x93, 0x2f, 0x18, 0xa7, 0x72,
|
||||
0x50, 0xb7, 0x36, 0xad, 0xad, 0xca, 0x5e, 0xfd, 0x8f, 0x57, 0x1f, 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0e, 0x4c, 0xb3, 0xa9, 0xad, 0x78, 0xf8, 0x4e,
|
||||
0x97, 0x8f, 0xfb, 0x5d, 0x76, 0x13, 0x33, 0xe3, 0x61, 0xfe, 0x5a, 0x3c, 0xac, 0x8f, 0xa0, 0x4e,
|
||||
0x69, 0x88, 0x19, 0xc7, 0x58, 0xed, 0xa4, 0xb0, 0x2f, 0xba, 0x89, 0x79, 0x19, 0x3e, 0xe7, 0x07,
|
||||
0x58, 0x6e, 0x8b, 0xe0, 0x60, 0x10, 0x62, 0xad, 0xf7, 0x23, 0x00, 0xcc, 0x42, 0xc9, 0x59, 0xa7,
|
||||
0x43, 0xf8, 0x95, 0x24, 0xe4, 0x72, 0xa7, 0xd3, 0x75, 0x4d, 0xf5, 0x93, 0x5b, 0xe5, 0xdc, 0x87,
|
||||
0x5a, 0x7e, 0xff, 0xab, 0xbb, 0x71, 0xfe, 0xb5, 0xe0, 0x66, 0x5b, 0x04, 0x2e, 0x09, 0xa8, 0x90,
|
||||
0x84, 0xef, 0x67, 0x08, 0x66, 0xd5, 0xcf, 0x0c, 0x50, 0x21, 0x1b, 0xa0, 0x5b, 0x50, 0x66, 0x9c,
|
||||
0x06, 0x54, 0x37, 0x53, 0x71, 0x8d, 0x85, 0x76, 0x60, 0x55, 0x2d, 0x23, 0xa1, 0xa4, 0xd8, 0x93,
|
||||
0x94, 0x29, 0xf1, 0x8a, 0x5b, 0x4b, 0xdb, 0x28, 0x69, 0x76, 0x9f, 0x13, 0x5f, 0x45, 0xbd, 0x8e,
|
||||
0x3b, 0x92, 0x99, 0xf1, 0x53, 0xba, 0x86, 0xde, 0x3f, 0x15, 0x60, 0x63, 0x6c, 0xb3, 0x53, 0xc8,
|
||||
0x3e, 0x2c, 0x65, 0xe1, 0x1a, 0x52, 0x3e, 0x85, 0x45, 0x0f, 0x63, 0xd6, 0x0b, 0xa5, 0x9a, 0x5a,
|
||||
0xd5, 0xe0, 0xc3, 0x04, 0xed, 0xa5, 0x60, 0x9a, 0xbb, 0x66, 0xd5, 0xe3, 0x50, 0xf2, 0x81, 0x9b,
|
||||
0x16, 0xb1, 0x3f, 0x81, 0x95, 0xa1, 0x90, 0xa2, 0xfc, 0x84, 0x0c, 0x92, 0x33, 0x7b, 0x42, 0x06,
|
||||
0xa8, 0x06, 0xa5, 0xbe, 0xd7, 0xe9, 0x11, 0x23, 0x83, 0x36, 0x76, 0x0a, 0x8f, 0x2c, 0xc5, 0x81,
|
||||
0x9a, 0xd1, 0x5d, 0x4d, 0xca, 0xf7, 0x64, 0x66, 0x9d, 0x67, 0x27, 0x64, 0x1b, 0x16, 0x3c, 0x1d,
|
||||
0xd4, 0x03, 0x71, 0xc9, 0xb2, 0x24, 0x31, 0x37, 0x43, 0xf3, 0x43, 0x33, 0x34, 0xd3, 0x1c, 0x1c,
|
||||
0xc6, 0xc7, 0x24, 0xa5, 0x60, 0x0a, 0xf5, 0xd3, 0x6d, 0x0a, 0x93, 0xb7, 0x71, 0x7e, 0x2f, 0x02,
|
||||
0xca, 0x29, 0x7a, 0x40, 0x78, 0x9f, 0x62, 0xf2, 0x3f, 0x2e, 0x81, 0x0d, 0x00, 0xdd, 0xe6, 0x51,
|
||||
0x8f, 0x53, 0x23, 0x65, 0x45, 0x7b, 0x0e, 0x39, 0x45, 0x1f, 0x42, 0x59, 0x60, 0x16, 0x11, 0x61,
|
||||
0x2e, 0x89, 0x1b, 0xe9, 0x07, 0x8e, 0xf0, 0x2e, 0x15, 0x82, 0xb2, 0x50, 0xb8, 0x26, 0x05, 0x6d,
|
||||
0xc2, 0x92, 0x4f, 0x04, 0xe6, 0x34, 0x32, 0x27, 0x4d, 0x15, 0xcb, 0xbb, 0xd0, 0x37, 0xf0, 0x8e,
|
||||
0xd0, 0x90, 0x8f, 0x48, 0xe8, 0x47, 0x8c, 0xaa, 0x81, 0x2d, 0xc5, 0x03, 0x7b, 0x7f, 0xcc, 0xc0,
|
||||
0x9a, 0xf6, 0x9a, 0xe6, 0xff, 0xe3, 0x64, 0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f5, 0xcb, 0x79, 0x63, 0xee, 0xcd, 0x79, 0x63, 0xee, 0xaf, 0xf3, 0xc6,
|
||||
0xdc, 0x73, 0x27, 0xa0, 0xf2, 0x45, 0xef, 0xb8, 0x89, 0x59, 0xb7, 0xc5, 0x42, 0xc1, 0x42, 0xde,
|
||||
0x8a, 0xff, 0x9c, 0xb6, 0xd4, 0x13, 0x58, 0x0e, 0x22, 0x22, 0x8e, 0xcb, 0xf1, 0x4b, 0xf7, 0xe1,
|
||||
0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdb, 0xbe, 0xf6, 0x61, 0x91, 0x0b, 0x00, 0x00,
|
||||
// 992 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xcf, 0xda, 0x89, 0x13, 0xbf, 0xfc, 0x33, 0x13, 0x97, 0xb8, 0x2b, 0xe2, 0x9a, 0x45, 0x48,
|
||||
0x51, 0x29, 0x76, 0x93, 0x4a, 0xa8, 0x0a, 0x48, 0x28, 0x89, 0x2a, 0x55, 0x42, 0x56, 0xca, 0x86,
|
||||
0x80, 0x54, 0x09, 0x59, 0x9b, 0xdd, 0xd1, 0x76, 0xc8, 0x7a, 0x67, 0x35, 0x33, 0x36, 0x31, 0x07,
|
||||
0x04, 0x3d, 0x73, 0xe0, 0x83, 0x70, 0xe8, 0xa1, 0x1f, 0x81, 0x43, 0x8f, 0x15, 0xe2, 0xc0, 0x09,
|
||||
0xa1, 0xe4, 0x50, 0x89, 0x4f, 0x81, 0x66, 0x67, 0xf6, 0x8f, 0x1d, 0x3b, 0x75, 0xcc, 0xc5, 0xde,
|
||||
0x79, 0xef, 0xcd, 0x7b, 0xbf, 0xf7, 0x7e, 0xbf, 0x99, 0x5d, 0x58, 0xf7, 0x88, 0xd7, 0xea, 0xef,
|
||||
0xb4, 0xc4, 0x79, 0x33, 0x62, 0x54, 0x50, 0x54, 0xf2, 0x88, 0xd7, 0xec, 0xef, 0x98, 0x9b, 0x2e,
|
||||
0xe5, 0x5d, 0xca, 0x5b, 0x5d, 0xee, 0x4b, 0x7f, 0x97, 0xfb, 0x2a, 0xc0, 0xbc, 0xad, 0x1c, 0x9d,
|
||||
0x78, 0xd5, 0x52, 0x0b, 0xed, 0xaa, 0xea, 0x64, 0x3e, 0x0e, 0x31, 0x27, 0x89, 0x75, 0x43, 0x5b,
|
||||
0xbb, 0xd4, 0xc3, 0x41, 0x1a, 0xea, 0x53, 0x9f, 0xaa, 0x14, 0xf2, 0x49, 0x59, 0xad, 0xdf, 0x0c,
|
||||
0x58, 0x6f, 0x73, 0xff, 0x24, 0xf2, 0x1c, 0x81, 0x9f, 0x38, 0xcc, 0xe9, 0x72, 0xf4, 0x09, 0x94,
|
||||
0x9d, 0x9e, 0x78, 0x46, 0x19, 0x11, 0x83, 0x9a, 0xd1, 0x30, 0xb6, 0xcb, 0x07, 0xb5, 0x3f, 0x5e,
|
||||
0x7e, 0x5c, 0xd5, 0x95, 0xf7, 0x3d, 0x8f, 0x61, 0xce, 0x8f, 0x05, 0x23, 0xa1, 0x6f, 0x67, 0xa1,
|
||||
0xe8, 0x1e, 0x94, 0xa2, 0x38, 0x43, 0xad, 0xd0, 0x30, 0xb6, 0x97, 0x77, 0xd7, 0x9a, 0xaa, 0xb3,
|
||||
0xa6, 0xca, 0x7b, 0x30, 0xff, 0xea, 0xef, 0x3b, 0x73, 0xb6, 0x8e, 0x41, 0x1f, 0xc0, 0x82, 0xa0,
|
||||
0x67, 0x38, 0xac, 0x15, 0xe3, 0xe0, 0xd5, 0x24, 0xf8, 0x2b, 0x69, 0xb4, 0x95, 0x6f, 0x6f, 0xed,
|
||||
0xf9, 0x9b, 0x17, 0x77, 0xb3, 0x12, 0xd6, 0x6d, 0xd8, 0x1c, 0x41, 0x6b, 0x63, 0x1e, 0xd1, 0x90,
|
||||
0x63, 0xeb, 0x17, 0x03, 0x2a, 0x6d, 0xee, 0xef, 0x07, 0x01, 0x75, 0x1d, 0x81, 0xbf, 0x76, 0x7a,
|
||||
0x81, 0x98, 0xb9, 0x95, 0x1a, 0x2c, 0xf2, 0xde, 0xe9, 0x77, 0xd8, 0x15, 0x71, 0x2f, 0x65, 0x3b,
|
||||
0x59, 0xa2, 0x77, 0xa1, 0x44, 0x19, 0xf1, 0x89, 0xc2, 0x5d, 0xb6, 0xf5, 0xea, 0x0a, 0xd2, 0xe7,
|
||||
0x06, 0xd4, 0x46, 0xe1, 0x24, 0x58, 0x51, 0x05, 0x8a, 0x2e, 0xf1, 0x14, 0x20, 0x5b, 0x3e, 0xa2,
|
||||
0xf7, 0x61, 0x05, 0x9f, 0x47, 0x84, 0x0d, 0x3a, 0xa7, 0x01, 0x75, 0xcf, 0xe2, 0xaa, 0x45, 0x7b,
|
||||
0x59, 0xd9, 0x0e, 0xa4, 0x09, 0xed, 0x40, 0x95, 0x61, 0x9f, 0x70, 0xc1, 0x1c, 0x41, 0x68, 0xd8,
|
||||
0xa1, 0x91, 0xfc, 0xe3, 0x1a, 0xc7, 0x46, 0xde, 0x77, 0xa4, 0x5c, 0xd6, 0x4b, 0xc5, 0xee, 0x13,
|
||||
0x46, 0xfb, 0xf8, 0x1b, 0x22, 0x42, 0xcc, 0x67, 0x67, 0xd7, 0x84, 0xa5, 0x88, 0xd1, 0x08, 0x33,
|
||||
0x31, 0xd0, 0x33, 0x49, 0xd7, 0x72, 0x5c, 0xdf, 0xab, 0xf4, 0x31, 0x9a, 0x15, 0x3b, 0x59, 0x66,
|
||||
0x2c, 0xcf, 0xdf, 0x80, 0xe5, 0xa3, 0x98, 0xe5, 0x3c, 0xea, 0x74, 0x72, 0x31, 0x31, 0xae, 0x2b,
|
||||
0x2b, 0x49, 0xec, 0x4b, 0x76, 0xb2, 0xbc, 0x0e, 0x9f, 0xf5, 0x23, 0xac, 0xb4, 0xb9, 0x7f, 0x3c,
|
||||
0x08, 0x5d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|
||||
0x8b, 0x8e, 0x72, 0x2a, 0x41, 0x5c, 0xb3, 0x2d, 0x09, 0xcc, 0x69, 0x68, 0x7e, 0x48, 0x43, 0x33,
|
||||
0xe9, 0xe0, 0x24, 0x3e, 0x26, 0xe9, 0x08, 0xa6, 0x60, 0x3f, 0x2d, 0x53, 0x98, 0x5c, 0xc6, 0xfa,
|
||||
0xbd, 0x08, 0x28, 0xc7, 0xe8, 0x31, 0x66, 0x7d, 0xe2, 0xe2, 0xff, 0x71, 0x09, 0x6c, 0x01, 0xa8,
|
||||
0x36, 0x3b, 0x3d, 0x46, 0x34, 0x95, 0x65, 0x65, 0x39, 0x61, 0x04, 0x7d, 0x04, 0x25, 0xee, 0xd2,
|
||||
0x08, 0x73, 0x7d, 0x49, 0x6c, 0xa4, 0xef, 0x41, 0xcc, 0xba, 0x84, 0x73, 0x79, 0x35, 0xdb, 0x3a,
|
||||
0x04, 0x35, 0x60, 0xd9, 0xc3, 0xdc, 0x65, 0x24, 0xd2, 0x27, 0x4d, 0x26, 0xcb, 0x9b, 0xd0, 0xb7,
|
||||
0xf0, 0x0e, 0x57, 0x90, 0x3b, 0x38, 0xf4, 0x22, 0x4a, 0xa4, 0x60, 0x17, 0x62, 0xc1, 0xde, 0x1f,
|
||||
0x23, 0x58, 0xdd, 0x5e, 0x53, 0xff, 0x3f, 0x4a, 0xb6, 0x28, 0xb5, 0x56, 0xf8, 0x88, 0x19, 0xdd,
|
||||
0x83, 0xa5, 0x2e, 0x16, 0x8e, 0xe7, 0x08, 0xa7, 0x56, 0x8a, 0xf1, 0x56, 0xd2, 0xac, 0xda, 0x6e,
|
||||
0xa7, 0x11, 0xd9, 0xc0, 0x17, 0x27, 0x0f, 0xdc, 0x3c, 0x84, 0x5b, 0x63, 0xab, 0xdf, 0xe4, 0x40,
|
||||
0x5c, 0xbd, 0x44, 0x1f, 0x83, 0x79, 0xb5, 0xcd, 0x29, 0x34, 0x52, 0x81, 0xa2, 0x97, 0x5d, 0x7c,
|
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0b, 0xa0, 0x0b, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@@ -1374,15 +1384,10 @@ func (m *MsgAllocateVault) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Token != nil {
|
||||
{
|
||||
size, err := m.Token.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
if len(m.Origin) > 0 {
|
||||
i -= len(m.Origin)
|
||||
copy(dAtA[i:], m.Origin)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Origin)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
@@ -1423,6 +1428,13 @@ func (m *MsgAllocateVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.RegistrationOptions) > 0 {
|
||||
i -= len(m.RegistrationOptions)
|
||||
copy(dAtA[i:], m.RegistrationOptions)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.RegistrationOptions)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if m.ExpiryBlock != 0 {
|
||||
i = encodeVarintTx(dAtA, i, uint64(m.ExpiryBlock))
|
||||
i--
|
||||
@@ -2038,8 +2050,8 @@ func (m *MsgAllocateVault) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
if m.Token != nil {
|
||||
l = m.Token.Size()
|
||||
l = len(m.Origin)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
return n
|
||||
@@ -2058,6 +2070,10 @@ func (m *MsgAllocateVaultResponse) Size() (n int) {
|
||||
if m.ExpiryBlock != 0 {
|
||||
n += 1 + sovTx(uint64(m.ExpiryBlock))
|
||||
}
|
||||
l = len(m.RegistrationOptions)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
@@ -2590,9 +2606,9 @@ func (m *MsgAllocateVault) Unmarshal(dAtA []byte) error {
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType)
|
||||
}
|
||||
var msglen int
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
@@ -2602,27 +2618,23 @@ func (m *MsgAllocateVault) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Token == nil {
|
||||
m.Token = &Token{}
|
||||
}
|
||||
if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
m.Origin = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
@@ -2725,6 +2737,38 @@ func (m *MsgAllocateVaultResponse) Unmarshal(dAtA []byte) error {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RegistrationOptions", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
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 ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.RegistrationOptions = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
|
||||
Reference in New Issue
Block a user