Skip to content
Snippets Groups Projects
quantumlayer.go 1.52 KiB
Newer Older
  • Learn to ignore specific revisions
  • // This package aims at emulating a quantum link and is extendable to different models
    // One can use most of the sourc code of emu-prng and reuse it.
    // To add a different quantum module one should only modify the GenerateRandomNumbers function
    
    package quantumlayer
    
    type QuantumLayerBulkKey struct {
    	BulkKeyId     int64   // the unique ID of this bulk of keys
    	BulkKeyLength int     // the length, counted in bytes, of bulkKey
    	BulkKey       *[]byte // the bulk key
    }
    
    type QuantumLayer interface {
    
    	Configure(...string)                          // configure the interface, e.g., used IP/Port config if emulated
    	PowerOn(enableKeyGeneration bool)             // switch on the quantum layer element
    	PowerOff()                                    // switch off the quantum layer element
    	GetStatus() (poweredOn bool)                  // returns true if quantum layer element is powered on
    	AddPeer()                                     // Adds a Quantum Layer Peer to the peer list
    	RemovePeer()                                  // Remmoves a Quantum Layer Peer to the peer list
    	GetLocalQLPort()                              // Returns the information about the local quantum layer IP and port
    	GetKeyBulkPeer() (QuantumLayerBulkKey, error) // retrieve the bulk key received from peer
    	GenerateRandomNumbers() []byte                // generate a number of random numbers
    
    }
    
    type NumberLayer interface {
    	GetBatch() []byte // allows to retrieve the current available batch of numbers
    	GetBulk() (QuantumLayerBulkKey, error)
    	receiveNumbers(chan []byte)
    }