-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathVerifiedDeviceSupport.sol
55 lines (42 loc) · 1.75 KB
/
VerifiedDeviceSupport.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
pragma solidity ^0.4.16;
import "../features/OwnerSupport.sol";
/// @title supports for signing messages by the device.
contract VerifiedDeviceSupport {
/// interface-id for supportInterface-check
bytes4 public constant ID = 0xa3951baf;
/// returns the public address of the
function devicePubKey(bytes32 id) public constant returns (bytes32);
/// sets the public address of the
function setDevicePubKey(bytes32 id, bytes32 _address) public;
}
/// @title supports for signing messages by the device with one signature per device.
contract VerifiedDeviceSupportPerDeviceImpl is VerifiedDeviceSupport, OwnerSupport {
/// the address
mapping(bytes32 =>bytes32) deviceVerificationAddress;
function devicePubKey(bytes32 _id) public constant returns (bytes32) {
return deviceVerificationAddress[_id];
}
/// set the device address
/// @param _id device id
/// @param _address address
function setDevicePubKey(bytes32 _id, bytes32 _address) public{
require(deviceOwner(_id)==msg.sender);
deviceVerificationAddress[_id] = _address;
}
}
/// @title the Implementation for a whitelist for all devices in this contract.
contract VerifiedDeviceSupportPerContractImpl is OwnerSupport,VerifiedDeviceSupport {
/// the address
bytes32 public deviceVerificationAddress;
/// returns the public address of the
function devicePubKey(bytes32 /*id*/) public constant returns (bytes32) {
return deviceVerificationAddress;
}
/// set the device address
/// @param _id device id
/// @param _address address
function setDevicePubKey(bytes32 _id, bytes32 _address) public{
require (deviceOwner(_id)==msg.sender) ;
deviceVerificationAddress = _address;
}
}