From 993fa2adcdee4fa60c2c1f78a4793e3c2a842071 Mon Sep 17 00:00:00 2001 From: despiegk Date: Fri, 8 Aug 2025 08:53:49 +0200 Subject: [PATCH] ... --- specs/models_threefold/aiinstruct.md | 7 ++++++ specs/models_threefold/core | 1 + specs/models_threefold/main/secretbox.v | 31 ++++++++++++++++++++++++ specs/models_threefold/main/signature.v | 32 +++++++++++++++++++++++++ specs/models_threefold/main/user.v | 29 ++++++++++++++++++++++ specs/models_threefold/main/user_kvs.v | 22 +++++++++++++++++ 6 files changed, 122 insertions(+) create mode 100644 specs/models_threefold/aiinstruct.md create mode 120000 specs/models_threefold/core create mode 100644 specs/models_threefold/main/secretbox.v create mode 100644 specs/models_threefold/main/signature.v create mode 100644 specs/models_threefold/main/user.v create mode 100644 specs/models_threefold/main/user_kvs.v diff --git a/specs/models_threefold/aiinstruct.md b/specs/models_threefold/aiinstruct.md new file mode 100644 index 0000000..4075370 --- /dev/null +++ b/specs/models_threefold/aiinstruct.md @@ -0,0 +1,7 @@ +make SQL script to populate DB + +only models with base class are put in tables + +the data itself is in data field + +the fields marked with @index go as separate fields in tables \ No newline at end of file diff --git a/specs/models_threefold/core b/specs/models_threefold/core new file mode 120000 index 0000000..6f98b7c --- /dev/null +++ b/specs/models_threefold/core @@ -0,0 +1 @@ +../models_heroledger/core \ No newline at end of file diff --git a/specs/models_threefold/main/secretbox.v b/specs/models_threefold/main/secretbox.v new file mode 100644 index 0000000..9f23887 --- /dev/null +++ b/specs/models_threefold/main/secretbox.v @@ -0,0 +1,31 @@ +module main + +pub struct SecretBox { +pub mut: + notary_id u32 // person who is allowed to decrypt this info + value string //the actual incrypted value + version u16 //version of the schema used to encrypt this value + timestamp u64 + cat SecretBoxCategory //category of the secret box, e.g. profile +} + +pub enum SecretBoxCategory { + profile +} + +pub struct Notary { + core.Base +pub mut: + userid u32 // Reference to the user entity @[index] + status NotaryStatus // Current user status + myceliumaddress string // Mycelium address of the notary + pubkey string // Public key for cryptographic operations @[index] +} + +pub enum NotaryStatus { + active + inactive + suspended + archived + error +} diff --git a/specs/models_threefold/main/signature.v b/specs/models_threefold/main/signature.v new file mode 100644 index 0000000..7eb627b --- /dev/null +++ b/specs/models_threefold/main/signature.v @@ -0,0 +1,32 @@ +module circle + +import freeflowuniverse.herolib.hero.models.core + +// Wallet represents a wallet associated with a circle for financial operations +pub struct Signature { + core.Base +pub mut: + signature_id u32 // Reference to the user who created the signature @[index] + user_id u32 // Reference to the user who created the signature @[index] + value string // The actual signature value + objectid u32 // Reference to the user who created the signature @[index] + objecttype ObjectType // Type of object being signed (e.g., + status SignatureStatus + timestamp u64 +} + +pub enum SignatureStatus { + active + inactive + pending + revoked +} + +pub enum ObjectType { + account + dnsrecord + membership + user + transaction + kyc +} \ No newline at end of file diff --git a/specs/models_threefold/main/user.v b/specs/models_threefold/main/user.v new file mode 100644 index 0000000..1dcd811 --- /dev/null +++ b/specs/models_threefold/main/user.v @@ -0,0 +1,29 @@ +module circle + +import freeflowuniverse.herolib.hero.models.core + +//is a user in the system, most of info is in models_heroledger + + +pub struct User { + core.Base +pub mut: + username string // Unique username for the user @[index] + pubkey string // Public key for cryptographic operations @[index] + status UserStatus // Current user status + kyc KYCStatus // Know Your Customer status + } + + +pub enum UserStatus { + active + inactive + suspended + archived +} + +pub enum KYCStatus { + pending + approved + rejected +} \ No newline at end of file diff --git a/specs/models_threefold/main/user_kvs.v b/specs/models_threefold/main/user_kvs.v new file mode 100644 index 0000000..7c072ed --- /dev/null +++ b/specs/models_threefold/main/user_kvs.v @@ -0,0 +1,22 @@ +module circle + +import freeflowuniverse.herolib.hero.models.core + +//a per user db +pub struct UserKVS { + core.Base +pub mut: + userid u32 // Reference to the user entity @[index] + name string // Name of the key-value store + } + +pub struct UserKVSItem { + core.Base +pub mut: + userkvs_id u32 // Reference to the user entity @[index] + key string + value string // Value associated with the key + secretbox []SecretBox // Optional secret boxes for sensitive data + timestamp u64 // Timestamp when the item was created or last updated + } +