pub async fn fake_unique_element(
    keystore: &KeystoreSender,
    agent_key: AgentPubKey,
    visibility: EntryVisibility,
) -> anyhow::Result<(SignedHeaderHashed, EntryHashed)> {
    let content: SerializedBytes =
        UnsafeBytes::from(nanoid::nanoid!().as_bytes().to_owned()).into();
    let entry = EntryHashed::from_content_sync(Entry::App(content.try_into().unwrap()));
    let app_entry_type = AppEntryTypeFixturator::new(visibility).next().unwrap();
    let header_1 = Header::Create(Create {
        author: agent_key,
        timestamp: timestamp::now(),
        header_seq: 0,
        prev_header: fake_header_hash(1),

        entry_type: EntryType::App(app_entry_type),
        entry_hash: entry.as_hash().to_owned(),
    });

    Ok((
        SignedHeaderHashed::new(&keystore, HeaderHashed::from_content_sync(header_1)).await?,
        entry,
    ))
}
/// Create a fake SignedHeaderHashed and EntryHashed pair with random content
Create a fake SignedHeaderHashed and EntryHashed pair with random content
Create a fake SignedHeaderHashed and EntryHashed pair with random content
pub async fn fake_unique_element(
    keystore: &KeystoreSender,
    agent_key: AgentPubKey,
    visibility: EntryVisibility,
) -> anyhow::Result<(SignedHeaderHashed, EntryHashed)> {
    let content: SerializedBytes =
        UnsafeBytes::from(nanoid::nanoid!().as_bytes().to_owned()).into();
    let entry = EntryHashed::from_content_sync(Entry::App(content.try_into().unwrap()));
    let app_entry_type = AppEntryTypeFixturator::new(visibility).next().unwrap();
    let header_1 = Header::Create(Create {
        author: agent_key,
        timestamp: timestamp::now(),
        header_seq: 0,
        prev_header: fake_header_hash(1),
        entry_type: EntryType::App(app_entry_type),
        entry_hash: entry.as_hash().to_owned(),
    });
    Ok((
        SignedHeaderHashed::new(&keystore, HeaderHashed::from_content_sync(header_1)).await?,
        entry,
    ))
}
pub async fn fake_unique_element ( keystore : & KeystoreSender , agent_key : AgentPubKey , visibility : EntryVisibility , ) -> anyhow :: Result < ( SignedHeaderHashed , EntryHashed ) > { let content : SerializedBytes = UnsafeBytes :: from ( nanoid :: nanoid ! ( ) . as_bytes ( ) . to_owned ( ) ) . into ( ) ; let entry = EntryHashed :: from_content_sync ( Entry :: App ( content . try_into ( ) . unwrap ( ) ) ) ; let app_entry_type = AppEntryTypeFixturator :: new ( visibility ) . next ( ) . unwrap ( ) ; let header_1 = Header :: Create ( Create { author : agent_key , timestamp : timestamp :: now ( ) , header_seq : 0 , prev_header : fake_header_hash ( 1 ) , entry_type : EntryType :: App ( app_entry_type ) , entry_hash : entry . as_hash ( ) . to_owned ( ) , } ) ; Ok ( ( SignedHeaderHashed :: new ( & keystore , HeaderHashed :: from_content_sync ( header_1 ) ) . await ? , entry , ) ) }
Create a fake SignedHeaderHashed and EntryHashed pair with random content
Create a fake SignedHeaderHashed and EntryHashed pair with random content
keystore
&KeystoreSender
agent_key
AgentPubKey
visibility
EntryVisibility
keystore
&KeystoreSender
agent_key
AgentPubKey
visibility
EntryVisibility