Files
sonr/proto/did/v1/state.proto
Prad NukalaandGitHub 13e6c3e84d Master (#1262)
* clear

* feat: Add everything

* fix: Commenht
2025-10-03 14:45:52 -04:00

372 lines
8.5 KiB
Protocol Buffer

syntax = "proto3";
package did.v1;
import "cosmos/orm/v1/orm.proto";
import "did/v1/genesis.proto";
import "did/v1/types.proto";
option go_package = "github.com/sonr-io/sonr/x/did/types";
// Authentication is the authentication method to be used by the DID.
message Authentication {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: {fields: "did"}
index: {
id: 1
fields: "controller,subject"
unique: true
}
};
// The unique identifier of the assertion
string did = 1;
// The authentication of the DID
string controller = 2;
// Origin of the authentication
string subject = 3;
// string is the verification method
string public_key_base64 = 4;
// AssertionKind is the assertion type
string did_kind = 5;
// CreationBlock is the block number of the creation of the authentication
int64 creation_block = 6;
}
// Assertion is the assertion method to be used by the DID.
message Assertion {
option (cosmos.orm.v1.table) = {
id: 2
primary_key: {fields: "did"}
index: {
id: 1
fields: "controller,subject"
unique: true
}
};
// The unique identifier of the assertion
string did = 1;
// The authentication of the DID
string controller = 2;
// Origin of the authentication
string subject = 3;
// string is the verification method
string public_key_base64 = 4;
// DIDKind is the DID type
string did_kind = 5;
// CreationBlock is the block number of the creation of the authentication
int64 creation_block = 6;
}
// Controller is the controller method to be used by the DID.
message Controller {
option (cosmos.orm.v1.table) = {
id: 3
primary_key: {fields: "did"}
index: {
id: 1
fields: "address"
unique: true
}
index: {
id: 2
fields: "subject"
unique: true
}
index: {
id: 3
fields: "public_key_base64"
unique: true
}
};
// The unique identifier of the assertion
string did = 1;
// The authentication of the DID
string address = 2;
// Origin of the authentication
string subject = 3;
// string is the verification method
string public_key_base64 = 4;
// DIDKind is the DID type
string did_kind = 5;
// CreationBlock is the block number of the creation of the authentication
int64 creation_block = 6;
}
// Delegation is usually an external blockchain account that is used to sign
// transactions on behalf of the DID
message Delegation {
option (cosmos.orm.v1.table) = {
id: 4
primary_key: {fields: "did"}
index: {
id: 1
fields: "controller,subject"
unique: true
}
};
// The unique identifier of the assertion
string did = 1;
// The authentication of the DID
string controller = 2;
// Origin of the authentication
string subject = 3;
// string is the verification method
string public_key_base64 = 4;
// DIDKind is the DID type
string did_kind = 5;
// CreationBlock is the block number of the creation of the authentication
int64 creation_block = 6;
}
// Invocation is usually a smart contract that is used to sign transactions on
// behalf of the DID
message Invocation {
option (cosmos.orm.v1.table) = {
id: 5
primary_key: {fields: "did"}
index: {
id: 1
fields: "controller,subject"
unique: true
}
};
// The unique identifier of the assertion
string did = 1;
// The authentication of the DID
string controller = 2;
// Origin of the authentication
string subject = 3;
// string is the verification method
string public_key_base64 = 4;
// DIDKind is the DID type
string did_kind = 5;
// CreationBlock is the block number of the creation of the authentication
int64 creation_block = 6;
}
// DIDDocument represents a W3C compliant DID Document
message DIDDocument {
option (cosmos.orm.v1.table) = {
id: 6
primary_key: {fields: "id"}
index: {
id: 1
fields: "primary_controller"
unique: false
}
};
// id is the DID that is the subject of this DID Document (REQUIRED)
string id = 1;
// primary_controller identifies the primary entity that controls the DID
// document (OPTIONAL)
string primary_controller = 2;
// alsoKnownAs expresses other identifiers for the DID subject (OPTIONAL)
repeated string also_known_as = 3;
// verificationMethod expresses verification methods (OPTIONAL)
repeated VerificationMethod verification_method = 4;
// authentication expresses authentication verification relationships
// (OPTIONAL)
repeated VerificationMethodReference authentication = 5;
// assertionMethod expresses assertion verification relationships (OPTIONAL)
repeated VerificationMethodReference assertion_method = 6;
// keyAgreement expresses key agreement verification relationships (OPTIONAL)
repeated VerificationMethodReference key_agreement = 7;
// capabilityInvocation expresses capability invocation verification
// relationships (OPTIONAL)
repeated VerificationMethodReference capability_invocation = 8;
// capabilityDelegation expresses capability delegation verification
// relationships (OPTIONAL)
repeated VerificationMethodReference capability_delegation = 9;
// service expresses service endpoints (OPTIONAL)
repeated Service service = 10;
// Block height when the DID document was created
int64 created_at = 11;
// Block height when the DID document was last updated
int64 updated_at = 12;
// Whether the DID document is deactivated
bool deactivated = 13;
// Version number for the DID document
uint64 version = 14;
}
// DIDDocumentMetadata contains metadata about the DID document
message DIDDocumentMetadata {
option (cosmos.orm.v1.table) = {
id: 7
primary_key: {fields: "did"}
};
// did is the DID this metadata belongs to
string did = 1;
// created is when the DID was created
int64 created = 2;
// updated is when the DID was last updated
int64 updated = 3;
// deactivated is when the DID was deactivated (if applicable)
int64 deactivated = 4;
// version_id is the version identifier
string version_id = 5;
// next_update is when the next update is scheduled (if applicable)
int64 next_update = 6;
// next_version_id is the next version identifier (if applicable)
string next_version_id = 7;
// equivalentId lists equivalent DIDs
repeated string equivalent_id = 8;
// canonicalId is the canonical DID
string canonical_id = 9;
}
// VerifiableCredential represents a W3C Verifiable Credential
message VerifiableCredential {
option (cosmos.orm.v1.table) = {
id: 8
primary_key: {fields: "id"}
index: {
id: 1
fields: "issuer"
unique: false
}
index: {
id: 2
fields: "subject"
unique: false
}
index: {
id: 3
fields: "issuer,subject"
unique: true
}
};
// id is the credential identifier
string id = 1;
// context is the JSON-LD contexts
repeated string context = 2;
// credential_kinds is the credential types
repeated string credential_kinds = 3;
// issuer is the DID of the credential issuer
string issuer = 4;
// issuanceDate is when the credential was issued
string issuance_date = 5;
// expirationDate is when the credential expires (optional)
string expiration_date = 6;
// credentialSubject contains the claims about the subject as JSON
bytes credential_subject = 7;
// proof contains the cryptographic proof
repeated CredentialProof proof = 8;
// credentialStatus contains information about credential revocation
// (optional)
CredentialStatus credential_status = 9;
// subject is the DID of the credential subject (for indexing)
string subject = 10;
// Block height when issued
int64 issued_at = 11;
// Block height when expires (0 if no expiration)
int64 expires_at = 12;
// Whether the credential is revoked
bool revoked = 13;
}
// DIDController represents additional controllers for a DID document
message DIDController {
option (cosmos.orm.v1.table) = {
id: 9
primary_key: {
fields: "id"
auto_increment: true
}
index: {
id: 1
fields: "did"
unique: true
}
index: {
id: 2
fields: "controller_did"
unique: true
}
index: {
id: 3
fields: "did,controller_did"
unique: true
}
};
// id is the auto-incrementing primary key
uint64 id = 1;
// did is the DID this controller belongs to
string did = 2;
// controller_did is the controller DID
string controller_did = 3;
// added_at is when this controller was added
int64 added_at = 4;
}