Skip to main content

Module sea

Module sea 

Source
Expand description

SEA (Security, Encryption, Authorization) module Based on Gun.js sea/ directory Provides encryption, authentication, and authorization capabilities

Re-exports§

pub use secret::secret_sync;
pub use user::accept_grant;
pub use user::verify_trust;

Modules§

certify
SEA.certify — capability certificates for delegated authorization
decrypt
AES-GCM decryption Reverse of encrypt.rs
encrypt
AES-GCM encryption Based on Gun.js sea/encrypt.js Uses ECDH-derived key + SHA-256 + AES-256-GCM Matches Gun.js aeskey.js semantics: SHA-256(key_string + salt_bytes)
pair
Key pair generation — Gun.js sea/pair.js equivalent.
secret
ECDH shared secret derivation Based on Gun.js sea/secret.js Derives a shared secret from ECDH key exchange
session
Session storage backends for SEA recall().
sign
Digital signatures — Gun.js sea/sign.js equivalent.
user
User authentication and session management Provides create/auth/leave/recall using BEAM’s graph persistence
verify
Signature verification — Gun.js sea/verify.js equivalent.
work
Proof of Work and content hashing — Gun.js sea/work.js equivalent.

Structs§

Identity
Identity metadata for an authenticated user. Mirrors Gun.js user.is semantics.
KeyPair
Key pair for signing and encryption
SessionState
Session state behind Arc<RwLock> for shared invalidation across clones
User
Authenticated user with shared session state Clones share the same underlying session — leave() invalidates all holders.
WorkOptions
Options for SEA.work()

Enums§

SeaError
SEA module error types

Traits§

SessionStorage
Session storage trait for recall() persistence — async by default

Functions§

certify
Build and sign a capability certificate authorizing certificants.
decrypt
Decrypt data using AES-GCM
decrypt_symmetric
Decrypt data using a raw 32-byte AES-256 key.
encrypt
Encrypt data using AES-GCM
encrypt_symmetric
Encrypt data using a raw 32-byte AES-256 key.
generate_pair
Generate a new key pair for signing and encryption
is_pubkey_certified
Check if a pubkey appears in certificate’s certificants list.
secret
Derive shared secret from ECDH key exchange
sign
Sign data with a key pair
sign_value
Sign JSON data and wrap as a BEAM Value::Text for user-space puts. The returned value is a JSON-serialized {“m”: message, “s”: signature} string. Call this before db.put(value) when writing authenticated user data.
verify
Verify a signature (async wrapper for backwards compat)
verify_async
Verify a signature asynchronously (non-blocking wrapper via spawn_blocking) Preferred for new code that must not block the async executor.
verify_certificate
Verify a signed certificate against authority pubkey (sync).
verify_sync
Verify a signature synchronously (for use from message.rs)
work
Compute proof-of-work or content hash