veriglob library
Veriglob decentralized identity protocol - Dart implementation.
This library provides core functionality for:
- DID (Decentralized Identifier) creation and resolution
- Verifiable Credential issuance and verification
- Verifiable Presentation creation and verification
- Encrypted wallet storage
- Credential revocation management
Classes
- Base58
- Base58 encoding/decoding using the Bitcoin alphabet. Used for multibase encoding in DIDs.
- ClaimDemand
- A single claim demand in a verification request.
- CredentialInfo
- Information about a credential for display in the presentation sheet.
- CredentialPresentationSheet
- A bottom sheet widget for presenting credentials after scanning a verification request.
- CredentialStatus
- Credential status for revocation checking.
- CredentialSubject
- Interface for all credential subjects.
- DIDDocument
- W3C DID Document model.
- DIDKey
- Represents a did:key identifier with its associated document.
- Ed25519KeyPair
- Ed25519 key pair for signing operations.
- EducationSubject
- Educational credential subject.
- EmploymentSubject
- Employment credential subject.
- EncryptedData
- AES-256-GCM encryption result containing all components needed for decryption.
- IdentitySubject
- KYC/identity verification credential subject.
- KeyPair
- Wallet key pair storage.
- MembershipSubject
- Organization membership credential subject.
- Resolver
- Resolves DIDs to their public keys.
- RevocationEntry
- Entry in the revocation registry.
- RevocationRegistry
- Revocation registry for managing credential status.
- StoredCredential
- Represents a stored verifiable credential in the wallet.
- VCClaims
- Verifiable Credential claims (token payload).
- VerifiableCredential
- Verifiable Credential payload.
- VerifiablePresentation
- Verifiable Presentation containing one or more VCs.
- VerificationMethod
- Verification method within a DID Document.
- VerificationQrDisplay
- A widget that displays a QR code for a verification request.
- VerificationRequest
- A verification request that can be encoded as a QR code.
- VerificationResponse
- Response from a holder after scanning a verification request.
- VerificationScanner
- A widget that scans QR codes for verification requests.
- VPClaims
- Verifiable Presentation claims (token payload).
- Wallet
- Wallet for storing keys and credentials.
- WalletData
- Wallet data structure.
Enums
- ClaimType
- Types of claims that can be requested for verification.
- RevocationStatus
- Revocation status of a credential.
- StoredCredentialStatus
- Status of a stored credential in the wallet.
- StoredCredentialType
- Type category for stored credentials.
Constants
- credentialTypeEducation → const String
- credentialTypeEmployment → const String
- credentialTypeIdentity → const String
- Credential type constants.
- credentialTypeMembership → const String
Functions
-
createDIDKey(
Uint8List publicKey) → DIDKey - Creates a did:key from an Ed25519 public key.
-
createPresentation(
String holderDid, Uint8List holderPrivateKey, List< String> credentials, String audience, String nonce) → String - Creates a signed Verifiable Presentation.
-
decryptAesGcm(
Uint8List ciphertext, Uint8List key, Uint8List nonce) → Uint8List - Decrypts data using AES-256-GCM.
-
deriveKeysFromMnemonic(
String mnemonic) → Ed25519KeyPair - Derives Ed25519 keys from a BIP39 mnemonic phrase.
-
encryptAesGcm(
Uint8List plaintext, Uint8List key, [Uint8List? nonce]) → Uint8List - Encrypts data using AES-256-GCM.
-
generateCredentialId(
) → String - Generates a unique credential ID.
-
generateEd25519KeyPair(
) → Ed25519KeyPair - Generates a new Ed25519 key pair using secure random.
-
generateEd25519KeyPairFromSeed(
Uint8List seed) → Ed25519KeyPair - Generates an Ed25519 key pair from a 32-byte seed.
-
generateNonce(
) → String - Generates a random nonce for challenge-response.
-
generateRandomBytes(
int length) → Uint8List - Generates a random byte array of the specified length.
-
generateSalt(
[int size = saltSize]) → Uint8List - Generates a random salt of the specified size.
-
generateUrnUuid(
) → String - Generates a URN-formatted UUID (urn:uuid:...).
-
generateUuid(
) → String - Generates a UUID v4 string.
-
issueVC(
String issuerDid, String subjectDid, Uint8List privateKey, CredentialSubject subject, {String? credentialId}) → String - Issues a Verifiable Credential as a signed token.
-
pbkdf2Derive(
String password, Uint8List salt, {int iterations = pbkdf2Iterations, int keyLength = keySize}) → Uint8List - Derives a key using PBKDF2-HMAC-SHA256.
-
resolveDID(
String did) → Uint8List - Convenience function that creates a resolver and resolves a DID.
-
signEd25519(
Uint8List message, Uint8List privateKey) → Uint8List - Signs a message using Ed25519 private key (seed).
-
validateMnemonic(
String mnemonic) → String? - Validates a BIP39 mnemonic phrase.
-
verifyEd25519(
Uint8List message, Uint8List signature, Uint8List publicKey) → bool - Verifies an Ed25519 signature.
-
verifyPresentation(
String token, Uint8List holderPublicKey, {String? expectedAudience, String? expectedNonce}) → VPClaims - Verifies a Verifiable Presentation token and returns the claims.
-
verifyVC(
String token, Uint8List publicKey) → VCClaims - Verifies a Verifiable Credential token and returns the claims.
Exceptions / Errors
- DIDResolutionException
- Exception thrown when DID resolution fails.
- PresentationVerificationException
- Exception thrown when presentation verification fails.
- RevocationException
- Exception thrown for revocation registry errors.
- VerificationException
- Exception thrown when credential verification fails.
- WalletException
- Wallet errors.