Show / Hide Table of Contents

Class Psk1Protector

Provides access to a private network of peers that uses a PreSharedKey.

Inheritance
Object
Psk1Protector
Implements
INetworkProtector
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: PeerTalk.SecureCommunication
Assembly: PeerTalk.dll
Syntax
public class Psk1Protector : INetworkProtector
Remarks

The Swarm calls the network protector whenever a connection is being established with another peer.

Properties

| Improve this Doc View Source

Key

The key of the private network.

Declaration
public PreSharedKey Key { set; }
Property Value
Type Description
PreSharedKey

Only peers with this key can be communicated with.

Methods

| Improve this Doc View Source

ProtectAsync(PeerConnection, CancellationToken)

Creates a protected stream for the connection.

Declaration
public Task<Stream> ProtectAsync(PeerConnection connection, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
PeerConnection connection

A connection between two peers.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Stream>

A task that represents the asynchronous operation. The task's result is the protected stream.

Remarks

ProtectAsync is called after the transport level has established the connection.

An exception is thrown if the remote peer is not a member of the private network.

Implements

INetworkProtector

See Also

https://github.com/libp2p/specs/blob/master/pnet/Private-Networks-PSK-V1.md
  • Improve this Doc
  • View Source
Back to top Generated by DocFX