Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Having the possibility to add new protocols #6

Closed
sbiaudet opened this issue Oct 25, 2020 · 1 comment
Closed

Having the possibility to add new protocols #6

sbiaudet opened this issue Oct 25, 2020 · 1 comment

Comments

@sbiaudet
Copy link

I need to add new protocol in multi address.

In the projet go-threads they have a new protocol "thread" with this properties.

const (
	// Name is the protocol slug.
	Name = "thread"
	// Code is the protocol code.
	Code = 406
	// Version is the current protocol version.
	Version = "0.0.1"
	// Protocol is the threads protocol tag.
	Protocol protocol.ID = "/" + Name + "/" + Version
)

I've created a new class "Thread" derived from MultiaddressProtocol but I can't add it to Multibase. Methods are private.

namespace Textile.Threads.Core.Protocols
{
    public class Thread : MultiaddressProtocol
    {
        static Thread()
        {
            
        }
        public Thread() : base("thread", 406, -1)
        {
           
        }

        public override void Decode(string value) => Value = Multibase.Decode(value, out MultibaseEncoding _);
        public override void Decode(byte[] bytes) => Value = bytes;
        public override byte[] ToBytes() => (byte[])Value; 
        public override string ToString() => Multibase.Encode(MultibaseEncoding.Base32Lower, (byte[])Value);
    }
}
@rvagg
Copy link
Member

rvagg commented May 9, 2023

closing due to inactivity, archiving repo

@rvagg rvagg closed this as completed May 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants