| Total Complexity | 3 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class Test_EncryptionKey extends DataObject implements TestOnly |
||
| 15 | { |
||
| 16 | private static $table_name = 'EncryptionKey'; |
||
|
|
|||
| 17 | |||
| 18 | private static $db = [ |
||
| 19 | // A 256 bit key (32 bytes = 32*8) |
||
| 20 | // 32 bytes = 64 chars in hex (eg using bin2hex) |
||
| 21 | "EncryptionKey" => 'Varchar', |
||
| 22 | |||
| 23 | // X25519 Keypair (2x 32 bytes keys) |
||
| 24 | "SecretKey" => 'Varchar', |
||
| 25 | "PublicKey" => 'Varchar', |
||
| 26 | ]; |
||
| 27 | |||
| 28 | private static $has_one = [ |
||
| 29 | "Member" => File::class, |
||
| 30 | ]; |
||
| 31 | |||
| 32 | public static function getForMember($ID) |
||
| 33 | { |
||
| 34 | $rec = self::get()->filter('MemberID', $ID)->first(); |
||
| 35 | return $rec->EncryptionKey ?? null; |
||
| 36 | } |
||
| 37 | |||
| 38 | public static function getKeyPair($ID) |
||
| 48 | } |
||
| 49 | } |
||
| 50 |