From 0030ec479a2a3152e22abe104ab0ee25dd36ebd5 Mon Sep 17 00:00:00 2001 From: jelemux Date: Thu, 18 Feb 2021 17:33:04 +0100 Subject: add uid --- Cargo.toml | 5 +++++ src/view/main.rs | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b126f10..6e1a6ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,11 @@ version = "0.4.19" default-features = false features = ["wasmbind", "js-sys"] +[dependencies.uuid] +version = "0.8" +default-features = false +features = ["wasm-bindgen", "v4"] + [dependencies.web-sys] version = "0.3.47" features = ["FileReaderSync"] \ No newline at end of file diff --git a/src/view/main.rs b/src/view/main.rs index df8f326..360a527 100644 --- a/src/view/main.rs +++ b/src/view/main.rs @@ -1,3 +1,4 @@ +use uuid::Uuid; use crate::model::property_groups::address::*; use crate::model::property_groups::name::*; use crate::model::property_groups::organizational::*; @@ -389,11 +390,14 @@ impl Component for MainView { } } - let rev = Local::now(); + let uid = format!("urn:uuid:{}", Uuid::new_v4()); + + let rev = Local::now().to_string(); match builder .with_version("4.0".to_string()) - .with_rev(format!("{}", rev)) + .with_rev(rev) + .with_uid(uid) .build() { Ok(vcard) => { -- cgit v1.2.3