Web 7.0: DID Method Open Multiple Inheritance Model 0.2

using System;
using System.Collections.Generic;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using DIDID = System.String;
namespace DIDMethodOpenInheritanceModel1
{
public class DIDDocument
{
DIDID id { get; set; }
//
// Other properties of a DID Document would go here, such as public keys,
// authentication methods, service endpoints, etc.
//
}
public interface DIDDocumentCollection
{
Dictionary<DIDID, DIDDocument> DidDocuments { get; set; }
public bool RegIdWIthPublicKey(DIDID didobjectid, byte[] publicKey);
public DIDDocument GetDIDDocument(DIDID didobjectid);
public bool AddKey(DIDID didobjectid, byte[] newPublicKey, byte[] sender);
public bool RemoveKey(DIDID didobjectid, byte[] oldPublicKey, byte[] sender);
}
public class DIDMethod
{
DIDDocumentCollection? DidDocumentRegistry = null;
//
// Other properties of a DID Method would go here - needed to support
// the core functionality of a DID Method
// DID registry specific properties of a particular DID Method go
// in one of the polymorphic classes (see below)
public DIDMethod(DIDDocumentCollection diddocumentregistry)
{
DidDocumentRegistry = diddocumentregistry;
Console.WriteLine("DIDMethod (core) constructor called. Registry opened.");
}
}
// DIDMethod Base Classes for key-based, DNS-based, fully decentralized DIDDocunentCollections
public class KeyBasedDIDMethod : DIDMethod
{
public KeyBasedDIDMethod(DIDDocumentCollection diddocumentregistry) : base(diddocumentregistry)
{
Console.WriteLine("KeyBasedDIDMethod constructor called. Registry opened.");
}
}
public class DNSBasedDIDMethod : DIDMethod
{
public DNSBasedDIDMethod(DIDDocumentCollection diddocumentregistry) : base(diddocumentregistry)
{
Console.WriteLine("DNSBasedDIDMethod constructor called. Registry opened.");
}
}
public class FullyDecentralizedDIDMethod : DIDMethod
{
public FullyDecentralizedDIDMethod(DIDDocumentCollection diddocumentregistry) : base(diddocumentregistry)
{
Console.WriteLine("FullyDecentralizedDIDMethod constructor called. Registry opened.");
}
}
public class MegaDIDMethod : DIDMethod, IDIDKeyRotation, IDIDRevocationList, IDIDEventHistoryLog, IDIDCelStuff
{
public MegaDIDMethod(DIDDocumentCollection diddocumentregistry) : base(diddocumentregistry)
{
Console.WriteLine("MegaDIDMethod constructor called. Registry opened.");
}
public bool DummyDIDCellFunction(string dobjectid)
{
throw new NotImplementedException();
}
public bool DummyRevokeDIDDocumentFunction(string didobjectid)
{
throw new NotImplementedException();
}
public bool DummyRotateKeysFunction(string didobjectid, string eventDescription)
{
throw new NotImplementedException();
}
public bool DummyUpdateEventHistoryLogFunction(string didobjectid, string eventDescription)
{
throw new NotImplementedException();
}
}
internal class Program
{
static void Main(string[] args)
{
DIDID did = "did:example:123456789abcdefghi";
Console.WriteLine($"DID: {did}");
Console.WriteLine("\nCreating DID Document Registry...");
DIDMethod klm = new KeyBasedDIDMethod(new DummyDIDDocumentCollection()) as DIDMethod;
Console.WriteLine("\nCreating DID Document Registry...");
DIDMethod def = new DNSBasedDIDMethod(new DummyDIDDocumentCollection()) as DIDMethod;
Console.WriteLine("\nCreating DID Document Registry...");
DIDMethod fgh = new FullyDecentralizedDIDMethod(new DummyDIDDocumentCollection()) as DIDMethod;
Console.WriteLine("\nCreating DID Document Registry...");
DIDMethod mega = new MegaDIDMethod(new DummyDIDDocumentCollection()) as DIDMethod;
Console.WriteLine("\nHello World!");
Console.ReadLine();
}
}
}

Sample Output

Leave a comment

Filed under Uncategorized

Leave a comment