diff --git a/Cargo.lock b/Cargo.lock index fe3e6b0..d33e83d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -634,7 +634,7 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "cota-aggregator" -version = "0.9.0" +version = "0.9.1" dependencies = [ "chrono", "ckb-jsonrpc-types", diff --git a/Cargo.toml b/Cargo.toml index 56bd279..5eb663d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cota-aggregator" -version = "0.9.0" +version = "0.9.1" edition = "2018" [dependencies] diff --git a/README.md b/README.md index 282ea0b..dcf5a38 100644 --- a/README.md +++ b/README.md @@ -1105,8 +1105,8 @@ echo '{ "jsonrpc":"2.0", "method":"get_joyid_info", "params":{ - "lock_script":"0x4a000000100000003000000031000000726c205927bf90b3c1c8def979333e5a04f8f82e158e2a35dee85a6750d38cf1011500000001ae75e66699b47d6c178d5d282aee95f33c09057e", - "address": "ckt1q3excgzey7lepv7per00j7fn8edqf78c9c2cu234mm595e6s6wx0zqdwwhnxdxd504kp0r2a9q4wa90n8sys2lse0p2jy" + "lock_script":"0x4b000000100000003000000031000000d23761b364210735c19c60561d213fb3beae2fd6172743719eff6920e020baac011600000000012bddb76a4d23141063cc59c6560b2117e1fff38c", + "address": "ckt1qrfrwcdnvssswdwpn3s9v8fp87emat306ctjwsm3nmlkjg8qyza2cqgqqy4amdm2f533gyrre3vuv4styyt7rlln3sxvqp4s" } }' \ | tr -d '\n' \ @@ -1122,7 +1122,6 @@ avatar - The joyid metadata avatar name - The joyid metadata name description - The joyid metadata description extension - The joyid metadata extension -joyid - The joyid metadata joyid pub_key - The joyid metadata public key credential_id - The joyid metadata WebAuthn credential_id alg - The joyid metadata WebAuthn algorithm @@ -1138,24 +1137,27 @@ sub_keys - The joyid metadata sub public keys "result":{ "alg":"01", "avatar":"https://i.loli.net/2021/04/29/IigbpOWP8fw9qDn.png", - "block_number":6836259, + "block_number":7948294, "cota_cell_id":"0000000000000b6b", "credential_id":"459d12c09a65e58e22a9d8d6fa843c3d", "description":"Web3 Developer", "extension":"", + "front_end":"https:://app.joy.id", "name":"Dylan", "pub_key":"650e48cf029c8a04788c02d7d88bad7b62918714137d0cd486b5b3aff53d0c2baecabd8d23107933f85fdf13cd814a0ba3d1848329b0504d7134a88962e9bde3", "sub_keys":[ { "alg":"01", "credential_id":"459d12c09a65e58e22a9d8d6fa843c3d", + "front_end":"", "pub_key":"650e48cf029c8a04788c02d7d88bad7b62918714137d0cd486b5b3aff53d0c2baecabd8d23107933f85fdf13cd814a0ba3d1848329b0504d7134a88962e9bde3" }, { "alg":"01", "credential_id":"369d12c09a65e58e22a9d8d6fa843c3d", + "front_end":"", "pub_key":"290e48cf029c8a04788c02d7d88bad7b62918714137d0cd486b5b3aff53d0c2baecabd8d23107933f85fdf13cd814a0ba3d1848329b0504d7134a88962e9bde3" - } + }, ] }, "id":2 diff --git a/migrations/2022-09-27-152430_joyid_meta_extension/up.sql b/migrations/2022-09-27-152430_joyid_meta_extension/up.sql index 23b9364..649ea0e 100644 --- a/migrations/2022-09-27-152430_joyid_meta_extension/up.sql +++ b/migrations/2022-09-27-152430_joyid_meta_extension/up.sql @@ -11,6 +11,7 @@ CREATE TABLE IF NOT EXISTS joy_id_infos ( credential_id varchar(1500) NOT NULL, alg char(2) NOT NULL, cota_cell_id char(16) NOT NULL, + front_end varchar(255) NOT NULL, created_at datetime(6) NOT NULL, updated_at datetime(6) NOT NULL, PRIMARY KEY (id), @@ -26,6 +27,7 @@ CREATE TABLE IF NOT EXISTS sub_key_infos ( pub_key char(128) NOT NULL, credential_id varchar(1500) NOT NULL, alg char(2) NOT NULL, + front_end varchar(255) NOT NULL, created_at datetime(6) NOT NULL, updated_at datetime(6) NOT NULL, PRIMARY KEY (id), diff --git a/src/models/joyid.rs b/src/models/joyid.rs index 13e52fc..6c595eb 100644 --- a/src/models/joyid.rs +++ b/src/models/joyid.rs @@ -1,11 +1,12 @@ use crate::schema::joy_id_infos::dsl::joy_id_infos; use crate::schema::joy_id_infos::{ - alg, avatar, cota_cell_id, credential_id, description, extension, lock_hash, name, pub_key, + alg, avatar, cota_cell_id, credential_id, description, extension, front_end, lock_hash, name, + pub_key, }; use crate::schema::sub_key_infos::dsl::sub_key_infos; use crate::schema::sub_key_infos::{ - alg as sub_alg, credential_id as sub_credential_id, lock_hash as sub_lock_hash, - pub_key as sub_pub_key, + alg as sub_alg, credential_id as sub_credential_id, front_end as sub_front_end, + lock_hash as sub_lock_hash, pub_key as sub_pub_key, }; use crate::utils::error::Error; use diesel::*; @@ -24,6 +25,7 @@ pub struct JoyIDInfo { pub credential_id: String, pub alg: String, pub cota_cell_id: String, + pub front_end: String, pub sub_keys: Vec, } @@ -37,6 +39,7 @@ pub struct JoyIDInfoDb { pub credential_id: String, pub alg: String, pub cota_cell_id: String, + pub front_end: String, } #[derive(Serialize, Deserialize, Queryable, Debug, Clone, Eq, PartialEq)] @@ -44,6 +47,7 @@ pub struct SubKeyDb { pub pub_key: String, pub credential_id: String, pub alg: String, + pub front_end: String, } pub fn get_joyid_info_by_lock_hash(lock_hash_: [u8; 32]) -> Result, Error> { @@ -59,6 +63,7 @@ pub fn get_joyid_info_by_lock_hash(lock_hash_: [u8; 32]) -> Result Result = sub_key_infos - .select((sub_pub_key, sub_credential_id, sub_alg)) + .select((sub_pub_key, sub_credential_id, sub_alg, sub_front_end)) .filter(sub_lock_hash.eq(lock_hash_hex)) .load::(conn) .map_or_else( @@ -90,6 +95,7 @@ pub fn get_joyid_info_by_lock_hash(lock_hash_: [u8; 32]) -> Result Char, credential_id -> Varchar, alg -> Char, + front_end -> Varchar, created_at -> Datetime, updated_at -> Datetime, }