Offline Verification
Lithos ID SDKs can verify cryptographic proofs without an internet connection.
By default, verification resolves the issuer public key over the network (via did:web). For offline verification, cache the issuer public key ahead of time and provide a custom key resolver that returns that key during verification. Once the key is available locally, proof verification does not require network access.
Offline verification is intended for environments where security and availability matter most, for example physical access control, or systems that handle sensitive personal information in banking and similar regulated contexts. In these scenarios, verification must succeed even when connectivity is unavailable or untrusted.
Requirements
- Cache the Lithos ID issuer public key in your environment.
- Supply a custom key resolver when verifying the proof so the SDK uses your cached key instead of resolving it online.
See the SDKs for installation and language-specific details.
Example
The following example keeps issuer public keys in a simple in-memory map and resolves them locally during verification:
publicKeyCache := map[string][]byte{
keyID: publicKey,
}
opts = append(opts, lithosid.WithResolvePublicKey(func(_ context.Context, keyID string) ([]byte, error) {
key, ok := publicKeyCache[keyID]
if !ok {
return nil, fmt.Errorf("unknown key: %s", keyID)
}
return key, nil
}))
return lithosid.VerifyPresentation(ctx, presentation, opts...)const publicKeyCache: Record<string, Uint8Array> = {
[keyID]: publicKey,
};
return verifyPresentation(presentation, storedValues, {
resolvePublicKey: async (keyID) => {
const key = publicKeyCache[keyID];
if (!key) throw new Error(`unknown key: ${keyID}`);
return key;
},
});