// creates schema , credential definition and revocation registry
creates schema , credential definition and revocation registry
creates schema credential definition and revocation registry
pub fn create_initial_ledger_state(&mut self, pool: &Pool, revoc_registry_config: &str)
    {
        let revoc_reg_config_value: Value = serde_json::from_str(revoc_registry_config).unwrap();
        self.issuance_type = String::from(revoc_reg_config_value.as_object().unwrap().get("issuance_type").unwrap().as_str().unwrap());
        // Issuer creates Schema
        let (schema_id, schema_json) = anoncreds::issuer_create_schema(&self.issuer_did,
                                                                       GVT_SCHEMA_NAME,
                                                                       SCHEMA_VERSION,
                                                                       GVT_SCHEMA_ATTRIBUTES).unwrap();
        // !!IMPORTANT!!
        // It is important Post and Get Schema from Ledger and parse it to get the correct Schema JSON and correspondent it seq_no in Ledger
        // After that we can create CredentialDefinition for received Schema(not for result of indy_issuer_create_schema)
        let _schema_response = pool.submit_schema(&self.issuer_did, self.issuer_wallet_handle, &schema_json);
        ::std::thread::sleep(::std::time::Duration::from_secs(1));
        // Issuer gets Schema from Ledger
        let (_, schema_json) = pool.get_schema(Some(&self.issuer_did), &schema_id);
        self.schema_id = schema_id;
        // Issuer creates CredentialDefinition
        let (cred_def_id, cred_def_json) = anoncreds::issuer_create_credential_definition(self.issuer_wallet_handle,
                                                                                          &self.issuer_did,
                                                                                          &schema_json,
                                                                                          TAG_1,
                                                                                          None,
                                                                                          Some(&anoncreds::revocation_cred_def_config())).unwrap();
        // Issuer post CredentialDefinition to Ledger
        pool.submit_cred_def(&self.issuer_did, self.issuer_wallet_handle, &cred_def_json);
        self.cred_def_id = cred_def_id;
        // Issuer creates RevocationRegistry
        let tails_writer_handle = blob_storage::open_writer("default", &self.tails_writer_config).unwrap();
        let (rev_reg_id, rev_reg_def_json, rev_reg_entry_json) =
            anoncreds::issuer_create_and_store_revoc_reg(self.issuer_wallet_handle,
                                                         &self.issuer_did,
                                                         None,
                                                         TAG_1,
                                                         &self.cred_def_id,
                                                         revoc_registry_config,
                                                         tails_writer_handle).unwrap();
        // Issuer posts RevocationRegistryDefinition to Ledger
        pool.submit_revoc_reg_def(&self.issuer_did, self.issuer_wallet_handle, &rev_reg_def_json);
        self.rev_reg_id = rev_reg_id;
        // Issuer posts RevocationRegistryEntry to Ledger
        pool.submit_revoc_reg_entry(&self.issuer_did, self.issuer_wallet_handle, &self.rev_reg_id, &rev_reg_entry_json);
    }
pub fn create_initial_ledger_state ( & mut self , pool : & Pool , revoc_registry_config : & str ) { let revoc_reg_config_value : Value = serde_json :: from_str ( revoc_registry_config ) . unwrap ( ) ; self . issuance_type = String :: from ( revoc_reg_config_value . as_object ( ) . unwrap ( ) . get ( " " ) . unwrap ( ) . as_str ( ) . unwrap ( ) ) ; // Issuer creates Schema let ( schema_id , schema_json ) = anoncreds :: issuer_create_schema ( & self . issuer_did , GVT_SCHEMA_NAME , SCHEMA_VERSION , GVT_SCHEMA_ATTRIBUTES ) . unwrap ( ) ; // !!IMPORTANT!! // It is important Post and Get Schema from Ledger and parse it to get the correct Schema JSON and correspondent it seq_no in Ledger // After that we can create CredentialDefinition for received Schema(not for result of indy_issuer_create_schema) let _schema_response = pool . submit_schema ( & self . issuer_did , self . issuer_wallet_handle , & schema_json ) ; :: std :: thread :: sleep ( :: std :: time :: Duration :: from_secs ( 1 ) ) ; // Issuer gets Schema from Ledger let ( _ , schema_json ) = pool . get_schema ( Some ( & self . issuer_did ) , & schema_id ) ; self . schema_id = schema_id ; // Issuer creates CredentialDefinition let ( cred_def_id , cred_def_json ) = anoncreds :: issuer_create_credential_definition ( self . issuer_wallet_handle , & self . issuer_did , & schema_json , TAG_1 , None , Some ( & anoncreds :: revocation_cred_def_config ( ) ) ) . unwrap ( ) ; // Issuer post CredentialDefinition to Ledger pool . submit_cred_def ( & self . issuer_did , self . issuer_wallet_handle , & cred_def_json ) ; self . cred_def_id = cred_def_id ; // Issuer creates RevocationRegistry let tails_writer_handle = blob_storage :: open_writer ( " " , & self . tails_writer_config ) . unwrap ( ) ; let ( rev_reg_id , rev_reg_def_json , rev_reg_entry_json ) = anoncreds :: issuer_create_and_store_revoc_reg ( self . issuer_wallet_handle , & self . issuer_did , None , TAG_1 , & self . cred_def_id , revoc_registry_config , tails_writer_handle ) . unwrap ( ) ; // Issuer posts RevocationRegistryDefinition to Ledger pool . submit_revoc_reg_def ( & self . issuer_did , self . issuer_wallet_handle , & rev_reg_def_json ) ; self . rev_reg_id = rev_reg_id ; // Issuer posts RevocationRegistryEntry to Ledger pool . submit_revoc_reg_entry ( & self . issuer_did , self . issuer_wallet_handle , & self . rev_reg_id , & rev_reg_entry_json ) ; }
creates schema , credential definition and revocation registry
creates schema credential definition and revocation registry
&mut self
pool
&Pool
revoc_registry_config
&str