-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from pnetwork-association/feat/add-pam
Feat/add pam
- Loading branch information
Showing
19 changed files
with
834 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,39 @@ | ||
#pragma once | ||
|
||
#include "operation.hpp" | ||
#include "metadata.hpp" | ||
#include "operation.hpp" | ||
#include <eosio/crypto.hpp> | ||
#include <eosio/singleton.hpp> | ||
|
||
namespace eosio { | ||
using bytes = std::vector<uint8_t>; | ||
namespace pam { | ||
bool is_authorized(const operation& _operation, const metadata& _metadata, const checksum256& out_event_id) { | ||
// TODO: not implemented | ||
return true; | ||
} | ||
using bytes = std::vector<uint8_t>; | ||
namespace pam { | ||
TABLE mappings { | ||
bytes chain_id; | ||
bytes emitter; | ||
bytes topic_zero; | ||
|
||
uint64_t primary_key() const { | ||
eosio::check(chain_id.size() == 32, "Chain ID must be 32 bytes long."); | ||
return (static_cast<uint64_t>(chain_id[24]) << 56) | | ||
(static_cast<uint64_t>(chain_id[25]) << 48) | | ||
(static_cast<uint64_t>(chain_id[26]) << 40) | | ||
(static_cast<uint64_t>(chain_id[27]) << 32) | | ||
(static_cast<uint64_t>(chain_id[28]) << 24) | | ||
(static_cast<uint64_t>(chain_id[29]) << 16) | | ||
(static_cast<uint64_t>(chain_id[30]) << 8) | | ||
(static_cast<uint64_t>(chain_id[31])); | ||
} | ||
}; | ||
|
||
TABLE tee { | ||
public_key key; | ||
}; | ||
|
||
using tee_pubkey = singleton<"tee"_n, tee>; | ||
typedef eosio::multi_index<"mappings"_n, mappings> mappings_table; | ||
|
||
bool context_checks(const operation& operation, const metadata& metadata); | ||
void check_authorization(name adapter, const operation& operation, const metadata& metadata, checksum256 event_id); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.