Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icp support #58

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions proto/icp/core.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
syntax = "proto3";

import "icp/get_public_key.proto";
import "icp/sign_txn.proto";

import "error.proto";

package icp;

message Query {
oneof request {
GetPublicKeysRequest get_public_keys = 1;
GetPublicKeysRequest get_user_verified_public_key = 2;
SignTxnRequest sign_txn = 3;
}
}

message Result {
oneof response {
GetPublicKeysResponse get_public_keys = 1;
GetPublicKeysResponse get_user_verified_public_key = 2;
SignTxnResponse sign_txn = 3;
error.CommonError common_error = 4;
}
}
67 changes: 67 additions & 0 deletions proto/icp/get_public_key.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
syntax = "proto3";

import "error.proto";

package icp;
/**
* Example of successful get_public_keys generation
*
* Host Device
* GetPublicKeysIntiateRequest =>
* <= GetPublicKeysResultResponse (1-10 public keys)
* GetPublicKeysFetchNextRequest =>
* <= GetPublicKeysResultResponse (11-20 public keys)
* GetPublicKeysFetchNextRequest =>
* <= GetPublicKeysResultResponse (21-30 public keys)
*/

/**
* Example of successful get_public_key generation
*
* Host Device
* GetPublicKeysIntiateRequest =>
* <= GetPublicKeysResultResponse (1 public key to be
* sent after user confirmation)
*/

enum GetPublicKeysStatus {
GET_PUBLIC_KEYS_STATUS_INIT = 0;
GET_PUBLIC_KEYS_STATUS_CONFIRM = 1;
GET_PUBLIC_KEYS_STATUS_SEED_GENERATED = 2;
GET_PUBLIC_KEYS_STATUS_VERIFY = 3;
}

message GetPublicKeysDerivationPath {
repeated uint32 path = 1;
}

message GetPublicKeysIntiateRequest {
bytes wallet_id = 1;

/*
* address: m/44'/144'/0'/0/i
*/
repeated GetPublicKeysDerivationPath derivation_paths = 2;
}

message GetPublicKeysFetchNextRequest {
}

message GetPublicKeysResultResponse {
repeated bytes public_keys = 1;
}

message GetPublicKeysRequest {
oneof request {
GetPublicKeysIntiateRequest initiate = 1;
GetPublicKeysFetchNextRequest fetch_next = 2;
}
}

message GetPublicKeysResponse {
oneof response {
GetPublicKeysResultResponse result = 1;

error.CommonError common_error = 2;
}
}
73 changes: 73 additions & 0 deletions proto/icp/sign_txn.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
syntax = "proto3";

import "common.proto";
import "error.proto";

package icp;

/**
* Example:
*
* Host Device
*
* SignTxnInitiateRequest =>
* <= SignTxnConfirmationResponse
* SignTxnData =>
* <= SignTxnDataAccepted
* ....
* SignTxnData =>
* <= SignTxnDataAccepted
*
* **** Device has all transaction information ****
*
* SignTxnSignatureRequest =>
* <= SignTxnSignatureResponse
*/
enum SignTxnStatus {
SIGN_TXN_STATUS_INIT = 0;
SIGN_TXN_STATUS_CONFIRM = 1;
SIGN_TXN_STATUS_VERIFY = 2;
SIGN_TXN_STATUS_SEED_GENERATED = 3;
}

message SignTxnInitiateRequest {
bytes wallet_id = 1;
repeated uint32 derivation_path = 2;
uint32 transaction_size = 3;
}

message SignTxnConfirmationResponse {
}

message SignTxnData {
common.ChunkPayload chunk_payload = 1;
}

message SignTxnDataAccepted {
common.ChunkAck chunk_ack = 1;
}

message SignTxnSignatureResponse {
bytes signature = 1;
}

message SignTxnSignatureRequest {
}

message SignTxnRequest {
oneof request {
SignTxnInitiateRequest initiate = 1;
SignTxnData txn_data = 2;
SignTxnSignatureRequest signature = 3;
}
}

message SignTxnResponse {
oneof response {
SignTxnConfirmationResponse confirmation = 1;
SignTxnDataAccepted data_accepted = 2;
SignTxnSignatureResponse signature = 4;

error.CommonError common_error = 5;
}
}