Exemple #1
0
 def __init__(self, Command, OwnerID, CreatorID, PacketID, Payload, RemoteID, KeyID=None, Date=None, Signature=None, ):
     """
     Init all fields and sign the packet.
     """
     # Legal Commands are in commands.py
     self.Command = strng.to_text(Command)
     # who owns this data and pays bills - http://cate.com/id1.xml
     self.OwnerID = strng.to_bin(OwnerID)
     # signer - http://cate.com/id1.xml - might be an authorized scrubber
     self.CreatorID = strng.to_bin(CreatorID)
     # string of the above 4 "Number"s with "-" separator to uniquely identify a packet
     # on the local machine.  Can be used for filenames, and to prevent duplicates.
     self.PacketID = strng.to_text(PacketID)
     # create a string to remember current world time
     self.Date = strng.to_text(Date or utime.sec1970_to_datetime_utc().strftime("%Y/%m/%d %I:%M:%S %p"))
     # datetime.datetime.now().strftime("%Y/%m/%d %I:%M:%S %p")
     # main body of binary data
     self.Payload = strng.to_bin(Payload)
     # want full IDURL for other party so troublemaker could not
     # use his packets to mess up other nodes by sending it to them
     self.RemoteID = strng.to_bin(RemoteID)
     # which private key to use to generate signature
     self.KeyID = strng.to_text(KeyID or my_id.getGlobalID(key_alias='master'))
     if Signature:
         self.Signature = Signature
     else:
         # signature on Hash is always by CreatorID
         self.Signature = None
         # must be signed to be valid
         self.Sign()
     # stores list of related objects packet_in() or packet_out()
     self.Packets = []
Exemple #2
0
 def __init__(self, Command, OwnerID, CreatorID, PacketID, Payload, RemoteID,):
     """
     Init all fields and sign the packet .
     """
     # Legal Commands are in commands.py
     self.Command = Command
     # who owns this data and pays bills - http://cate.com/id1.xml
     self.OwnerID = OwnerID
     # signer - http://cate.com/id1.xml - might be an authorized scrubber
     self.CreatorID = CreatorID
     # string of the above 4 "Number"s with "-" separator to uniquely identify a packet
     # on the local machine.  Can be used for filenames, and to prevent duplicates.
     self.PacketID = PacketID
     # create a string to remember current world time
     self.Date = utime.sec1970_to_datetime_utc().strftime("%Y/%m/%d %I:%M:%S %p")
     # datetime.datetime.now().strftime("%Y/%m/%d %I:%M:%S %p")
     # main body of binary data
     self.Payload = Payload
     # want full IDURL for other party so troublemaker could not
     # use his packets to mess up other nodes by sending it to them
     self.RemoteID = RemoteID
     # signature on Hash is always by CreatorID
     self.Signature = None
     # must be signed to be valid
     self.Sign()
Exemple #3
0
 def __init__(self, Command, OwnerID, CreatorID, PacketID, Payload, RemoteID,):
     """
     Init all fields and sign the packet .
     """
     # Legal Commands are in commands.py
     self.Command = Command
     # who owns this data and pays bills - http://cate.com/id1.xml
     self.OwnerID = OwnerID
     # signer - http://cate.com/id1.xml - might be an authorized scrubber
     self.CreatorID = CreatorID
     # string of the above 4 "Number"s with "-" separator to uniquely identify a packet
     # on the local machine.  Can be used for filenames, and to prevent duplicates.
     self.PacketID = PacketID
     # create a string to remember current world time
     self.Date = utime.sec1970_to_datetime_utc().strftime("%Y/%m/%d %I:%M:%S %p")
     # datetime.datetime.now().strftime("%Y/%m/%d %I:%M:%S %p")
     # main body of binary data
     self.Payload = Payload
     # want full IDURL for other party so troublemaker could not
     # use his packets to mess up other nodes by sending it to them
     self.RemoteID = RemoteID
     # signature on Hash is always by CreatorID
     self.Signature = None
     # must be signed to be valid
     self.Sign()
Exemple #4
0
 def doWriteCoins(self, *args, **kwargs):
     """
     Action method.
     """
     for coin in args[0]:
         if not coins_db.exist(coin):
             coins_db.insert(coin)
         if coin['tm'] > utime.datetime_to_sec1970(self.download_offset):
             self.download_offset = utime.sec1970_to_datetime_utc(coin['tm'])
 def doWriteCoins(self, arg):
     """
     Action method.
     """
     for coin in arg:
         if not coins_db.exist(coin):
             coins_db.insert(coin)
         if coin["tm"] > utime.datetime_to_sec1970(self.download_offset):
             self.download_offset = utime.sec1970_to_datetime_utc(coin["tm"])