Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
API v1 share links, with expiry and share webhooks (mailr spec G10, W5)
Murtaza Nasiraf1bf465244a
diff --git a/docs/admin-guide/webhooks.md b/docs/admin-guide/webhooks.mdindex 92fe698a..d3fae9ba 100644--- a/docs/admin-guide/webhooks.md+++ b/docs/admin-guide/webhooks.md@@ -21,6 +21,8 @@ or programmatically via the `/api/v1/webhooks` API.| `recording.events.extracted` | Calendar event extraction finished and produced at least one event | `recording_id`, `title`, `events_count` || `recording.updated` | A change a user can see, from the web app or the API (see below) | `recording_id`, `title`, `fields_changed` (list of strings), `updated_at` || `recording.deleted` | Recording removed | `recording_id`, `title` |+| `recording.share.created` | A public share link was created | `recording_id`, `share_id`, `share_summary`, `share_notes` |+| `recording.share.revoked` | A public share link was revoked | `recording_id`, `share_id`, `share_summary`, `share_notes` || `webhook.test` | Synthetic event from the **Test** button or `POST /api/v1/webhooks/{id}/test` | `reason`, `webhook_id` |All events listed above fire in the current backend. Thediff --git a/docs/user-guide/api-reference.md b/docs/user-guide/api-reference.mdindex 3eef39d7..6c601bce 100644--- a/docs/user-guide/api-reference.md+++ b/docs/user-guide/api-reference.md@@ -889,6 +889,64 @@ DELETE /api/v1/recordings/{id}---+## Share Links++### Create or Reuse a Share Link++```http+POST /api/v1/recordings/{id}/share+```++**Scope:** `share`++Only the recording's owner can create a link. Without `force_new`, the newest link of the recording is reused.++```json+{"share_summary": true, "share_notes": false, "force_new": false, "update_existing": false, "expires_in_days": 30}+```++| Field | Default | Meaning |+|-------|---------|---------|+| `share_summary` | `true` | Show the summary on the shared page |+| `share_notes` | `false` | Show the owner's notes. Off unless asked (the web dialog defaults to on). |+| `force_new` | `false` | Create a new link even when one exists |+| `update_existing` | `false` | Give a reused link the flags of this request. Without it a reused link keeps its flags, and `flags_differ` says when they differ from the request. |+| `expires_in_days` | none | 1 to 3650; after that the link answers `404` |++`201` for a new link, `200` for a reused one:++```json+{+ "share_url": "https://speakr.example.com/share/AbC123",+ "existing": true,+ "flags_differ": false,+ "share": {"id": 31, "share_summary": true, "share_notes": false,+ "created_at": "2026-10-02T09:00:00.000000Z", "expires_at": null}+}+```++`403` with `code` `feature_disabled` (public sharing is off), `not_permitted` (your account may not create public links) or `https_required` (the request did not arrive over HTTPS; behind a reverse proxy Speakr reads `X-Forwarded-Proto`, see `TRUSTED_PROXY_HOPS`).++### List Share Links++```http+GET /api/v1/recordings/{id}/shares+```++**Scope:** `share`++Your links of the recording, newest first, each with its `share_url`.++### Revoke a Share Link++```http+DELETE /api/v1/shares/{share_id}+```++**Scope:** `share`++`204`. The link stops working at once.+## Search### Search Recordings@@ -1632,6 +1690,8 @@ These are the event types a webhook can subscribe to:| `recording.events.extracted` | Calendar events are extracted || `recording.updated` | A recording is updated || `recording.deleted` | A recording is deleted |+| `recording.share.created` | A public share link is created |+| `recording.share.revoked` | A public share link is revoked || `webhook.test` | A manual test delivery (see Test Webhook below) |### List Webhooksdiff --git a/docs/user-guide/sharing.md b/docs/user-guide/sharing.mdindex 8735ae9d..dd7e0576 100644--- a/docs/user-guide/sharing.md+++ b/docs/user-guide/sharing.md@@ -154,6 +154,10 @@ The "Share Notes" option controls whether your personal notes are visible. TheseOnce you've selected your options, click "Create Share Link" to generate the secure URL. The link appears immediately in the modal, ready to copy to your clipboard. This link is permanent until you explicitly revoke it, so recipients can bookmark it for future reference.+### Share Links from Other Tools++Integrations can create, list and revoke share links through the API (see [Share Links](api-reference.md#share-links)) with a token that has the `share` scope. A link created there shares the summary only unless notes are asked for, can expire after a number of days, and an existing link keeps its settings unless the request asks to change them.+## What Recipients Experiencediff --git a/src/api/api_v1.py b/src/api/api_v1.pyindex f47d0e03..296fd4c7 100644--- a/src/api/api_v1.py+++ b/src/api/api_v1.py@@ -923,6 +923,7 @@ CAPABILITY_FEATURES = {'webhook_signature_v2': True,'external_refs': True,'upload_idempotency': True,+ 'share_links': True,}# search: {'keyword': True, 'semantic': <Inquire on>} is filled in get_capabilities.@@ -1456,6 +1457,76 @@ def delete_external_ref(recording_id, ref_id):return '', 204+@api_v1_bp.route('/recordings/<int:recording_id>/share', methods=['POST'])+@require_scope('share')+@login_required+def create_public_share(recording_id):+ """Create or reuse a public link (mailr spec G10). Notes are not shared+ unless asked, and a reused link's flags change only with update_existing."""+ from flask import url_for+ from src.services.public_shares import get_or_create, share_dict+ if os.environ.get('ENABLE_PUBLIC_SHARING', 'true').lower() != 'true':+ return jsonify({'error': 'Public sharing is turned off on this server', 'code': 'feature_disabled'}), 403+ if not getattr(current_user, 'can_share_publicly', True):+ return jsonify({'error': 'You may not create public links', 'code': 'not_permitted'}), 403+ if not request.is_secure:+ return jsonify({'error': 'Public links need an HTTPS connection', 'code': 'https_required'}), 403+ recording = db.session.get(Recording, recording_id)+ if not recording or recording.user_id != current_user.id:+ return jsonify({'error': 'Recording not found', 'code': 'not_found'}), 404+ data = request.get_json(silent=True) or {}+ flags = {}+ for key, default in (('share_summary', True), ('share_notes', False), ('force_new', False),+ ('update_existing', False)):+ value = data.get(key, default)+ if not isinstance(value, bool):+ return jsonify({'error': f'{key} must be true or false', 'code': 'invalid_parameter'}), 400+ flags[key] = value+ days = data.get('expires_in_days')+ if days is not None and (not isinstance(days, int) or isinstance(days, bool) or not 1 <= days <= 3650):+ return jsonify({'error': 'expires_in_days must be 1 to 3650', 'code': 'invalid_parameter'}), 400+ share, created, differ = get_or_create(recording, current_user, flags['share_summary'], flags['share_notes'],+ force_new=flags['force_new'], update_existing=flags['update_existing'],+ expires_in_days=days)+ return jsonify({+ 'share_url': url_for('shares.view_shared_recording', public_id=share.public_id, _external=True),+ 'existing': not created,+ 'flags_differ': differ,+ 'share': share_dict(share),+ }), 201 if created else 200+++@api_v1_bp.route('/recordings/<int:recording_id>/shares', methods=['GET'])+@require_scope('share')+@login_required+def list_public_shares(recording_id):+ """Your public links of a recording."""+ from flask import url_for+ from src.models import Share+ from src.services.public_shares import share_dict+ recording = db.session.get(Recording, recording_id)+ if not recording or recording.user_id != current_user.id:+ return jsonify({'error': 'Recording not found', 'code': 'not_found'}), 404+ shares = (Share.query.filter_by(recording_id=recording.id, user_id=current_user.id)+ .order_by(Share.created_at.desc()).all())+ return jsonify({'shares': [dict(share_dict(s), share_url=url_for('shares.view_shared_recording',+ public_id=s.public_id, _external=True))+ for s in shares]})+++@api_v1_bp.route('/shares/<int:share_id>', methods=['DELETE'])+@require_scope('share')+@login_required+def revoke_public_share(share_id):+ from src.models import Share+ from src.services.public_shares import revoke+ share = db.session.get(Share, share_id)+ if share is None or share.user_id != current_user.id:+ return jsonify({'error': 'Share not found', 'code': 'not_found'}), 404+ revoke(share)+ return '', 204++@api_v1_bp.route('/recordings/changes', methods=['GET'])@require_scope('read')@login_requireddiff --git a/src/api/shares.py b/src/api/shares.pyindex 2fbc1188..3222da96 100644--- a/src/api/shares.py+++ b/src/api/shares.py@@ -18,6 +18,7 @@ from src.database import dbfrom src.models import Recording, Share, InternalShare, SharedRecordingState, User, TranscriptChunk, ShareAuditLogfrom src.utils import md_to_htmlfrom src.services.storage import get_storage_service+from src.services.public_shares import active_share_or_404# Configuration from environmentENABLE_PUBLIC_SHARING = os.environ.get('ENABLE_PUBLIC_SHARING', 'true').lower() == 'true'@@ -122,7 +123,7 @@ def process_transcription_for_template(transcription_str):@shares_bp.route('/share/<string:public_id>', methods=['GET'])def view_shared_recording(public_id):"""View a publicly shared recording."""- share = Share.query.filter_by(public_id=public_id).first_or_404()+ share = active_share_or_404(public_id)recording = share.recording# Process transcription for server-side rendering (only if READABLE_PUBLIC_LINKS is enabled)@@ -154,7 +155,7 @@ def view_shared_recording(public_id):def get_shared_audio(public_id):"""Serve audio file for a publicly shared recording."""try:- share = Share.query.filter_by(public_id=public_id).first_or_404()+ share = active_share_or_404(public_id)recording = share.recordingif not recording or not recording.audio_path:return jsonify({'error': 'Recording or audio file not found'}), 404@@ -232,39 +233,20 @@ def create_share(recording_id):share_notes = data.get('share_notes', True)force_new = data.get('force_new', False)- # Check if ANY share already exists for this recording by this user- existing_share = Share.query.filter_by(- recording_id=recording.id,- user_id=current_user.id- ).order_by(Share.created_at.desc()).first()-- if existing_share and not force_new:- # Update the share permissions if they've changed- if existing_share.share_summary != share_summary or existing_share.share_notes != share_notes:- existing_share.share_summary = share_summary- existing_share.share_notes = share_notes- db.session.commit()-- # Return existing share info- share_url = url_for('shares.view_shared_recording', public_id=existing_share.public_id, _external=True)+ # The web dialog sets the flags of a reused link to what it sent.+ from src.services.public_shares import get_or_create+ share, created, _ = get_or_create(recording, current_user, share_summary, share_notes,+ force_new=force_new, update_existing=True)+ if not created:+ share_url = url_for('shares.view_shared_recording', public_id=share.public_id, _external=True)return jsonify({'success': True,'share_url': share_url,- 'share': existing_share.to_dict(),+ 'share': share.to_dict(),'existing': True,'message': 'Using existing share link for this recording'}), 200- # Create new share- share = Share(- recording_id=recording.id,- user_id=current_user.id,- share_summary=share_summary,- share_notes=share_notes- )- db.session.add(share)- db.session.commit()-share_url = url_for('shares.view_shared_recording', public_id=share.public_id, _external=True)return jsonify({@@ -304,8 +286,8 @@ def update_share(share_id):def delete_share(share_id):"""Delete a public share."""share = Share.query.filter_by(id=share_id, user_id=current_user.id).first_or_404()- db.session.delete(share)- db.session.commit()+ from src.services.public_shares import revoke+ revoke(share)return jsonify({'success': True})diff --git a/src/init_db.py b/src/init_db.pyindex c8c7c61c..8e04c396 100644--- a/src/init_db.py+++ b/src/init_db.py@@ -258,6 +258,9 @@ def _run_migrations(app, engine):run_once(engine, '0002_backfill_recording_updated_at', _backfill_recording_updated_at,logger=app.logger)+ # Public share link expiry (mailr spec G10).+ if add_column_if_not_exists(engine, 'share', 'expires_at', 'DATETIME'):+ app.logger.info("Added expires_at column to share table")# Speaker contact details (mailr spec G6).if add_column_if_not_exists(engine, 'speaker', 'email', 'VARCHAR(320)'):app.logger.info("Added email column to speaker table")diff --git a/src/models/sharing.py b/src/models/sharing.pyindex b8d34353..ee71042e 100644--- a/src/models/sharing.py+++ b/src/models/sharing.py@@ -25,6 +25,8 @@ class Share(db.Model):created_at = db.Column(db.DateTime, default=datetime.utcnow)share_summary = db.Column(db.Boolean, default=True)share_notes = db.Column(db.Boolean, default=True)+ # After this time the public link answers 404 (API v1 expires_in_days).+ expires_at = db.Column(db.DateTime, nullable=True)user = db.relationship('User', backref=db.backref('shares', lazy=True, cascade='all, delete-orphan'))recording = db.relationship('Recording', backref=db.backref('shares', lazy=True, cascade='all, delete-orphan'))@@ -39,7 +41,8 @@ class Share(db.Model):'share_summary': self.share_summary,'share_notes': self.share_notes,'recording_title': self.recording.title if self.recording else "N/A",- 'audio_available': self.recording.audio_deleted_at is None if self.recording else True+ 'audio_available': self.recording.audio_deleted_at is None if self.recording else True,+ 'expires_at': self.expires_at.isoformat() if self.expires_at else None,}diff --git a/src/models/webhook.py b/src/models/webhook.pyindex 256a07ff..3a966ebd 100644--- a/src/models/webhook.py+++ b/src/models/webhook.py@@ -29,6 +29,8 @@ WEBHOOK_EVENT_TYPES = ('recording.events.extracted','recording.updated','recording.deleted',+ 'recording.share.created',+ 'recording.share.revoked','webhook.test',)diff --git a/src/services/public_shares.py b/src/services/public_shares.pynew file mode 100644index 00000000..99dd543d--- /dev/null+++ b/src/services/public_shares.py@@ -0,0 +1,80 @@+"""Public share links: one set of rules for the web app and API v1 (mailr spec G10).++The newest link of a recording is reused unless a new one is asked for. The+web app updates the reused link's flags to what it sent; API v1 changes them+only with update_existing and otherwise reports that they differ, so flags+never change silently. Creating and revoking a link sends+recording.share.created and recording.share.revoked (spec W5).+"""++from datetime import datetime, timedelta++from src.database import db+++def active_share_or_404(public_id):+ """The share behind a public link; an expired one is gone (404)."""+ from flask import abort+ from src.models import Share+ share = Share.query.filter_by(public_id=public_id).first_or_404()+ if share.expires_at is not None and share.expires_at <= datetime.utcnow():+ abort(404)+ return share+++def get_or_create(recording, user, share_summary, share_notes, force_new=False,+ update_existing=False, expires_in_days=None):+ """Returns (share, created, flags_differ). Commits."""+ from src.models import Share+ existing = None+ if not force_new:+ existing = (Share.query.filter_by(recording_id=recording.id, user_id=user.id)+ .order_by(Share.created_at.desc(), Share.id.desc()).first())+ if existing is not None:+ differ = existing.share_summary != share_summary or existing.share_notes != share_notes+ if differ and update_existing:+ existing.share_summary = share_summary+ existing.share_notes = share_notes+ db.session.commit()+ differ = False+ return existing, False, differ++ share = Share(recording_id=recording.id, user_id=user.id, share_summary=share_summary,+ share_notes=share_notes)+ if expires_in_days:+ share.expires_at = datetime.utcnow() + timedelta(days=expires_in_days)+ db.session.add(share)+ db.session.commit()+ _emit('recording.share.created', share)+ return share, True, False+++def revoke(share):+ data = _data(share)+ user_id = share.user_id+ db.session.delete(share)+ db.session.commit()+ try:+ from src.services.webhook_dispatch import emit_webhook_event+ emit_webhook_event(user_id=user_id, event_type='recording.share.revoked', data=data)+ except Exception:+ pass+++def _data(share):+ return {'recording_id': share.recording_id, 'share_id': share.id,+ 'share_summary': bool(share.share_summary), 'share_notes': bool(share.share_notes)}+++def _emit(event_type, share):+ try:+ from src.services.webhook_dispatch import emit_webhook_event+ emit_webhook_event(user_id=share.user_id, event_type=event_type, data=_data(share))+ except Exception:+ pass+++def share_dict(share):+ z = lambda v: v.strftime('%Y-%m-%dT%H:%M:%S.%fZ') if v else None+ return {'id': share.id, 'share_summary': bool(share.share_summary), 'share_notes': bool(share.share_notes),+ 'created_at': z(share.created_at), 'expires_at': z(share.expires_at)}diff --git a/tests/test_api_v1_public_shares.py b/tests/test_api_v1_public_shares.pynew file mode 100644index 00000000..1920f24a--- /dev/null+++ b/tests/test_api_v1_public_shares.py@@ -0,0 +1,133 @@+"""Public share links in API v1 (mailr spec G10) and their webhooks (W5).++SHARED-DB: users, tokens, shares, webhooks and the recording are removed afterwards.+"""++import json+import os+import secrets+import sys+from datetime import datetime, timedelta+from unittest.mock import patch++import pytest++sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))++from src.app import app, db+from src.models import APIToken, Recording, Share, User, Webhook, WebhookDelivery+from src.utils.token_auth import hash_token++def world():+ with app.app_context():+ s = secrets.token_hex(4)+ owner = User(username=f"ps_{s}", email=f"ps_{s}@local.test", password="x", can_share_publicly=True)+ other = User(username=f"pso_{s}", email=f"pso_{s}@local.test", password="x")+ db.session.add_all([owner, other])+ db.session.commit()+ rec = Recording(user_id=owner.id, title="Sync", status="COMPLETED", original_filename="s.wav",+ summary="## Summary", notes="PRIVATE NOTES")+ db.session.add(rec)+ db.session.commit()+ tokens = {}+ for key, user, scopes in (("share", owner, ["read", "share"]), ("write", owner, ["read", "write"]),+ ("other", other, None)):+ p = f"tok-{secrets.token_urlsafe(16)}"+ db.session.add(APIToken(user_id=user.id, token_hash=hash_token(p), name=key, scopes=json.dumps(scopes) if scopes else None))+ tokens[key] = p+ hook = Webhook(user_id=owner.id, name="h", url="https://example.com/h", secret="s" * 40,+ events=json.dumps(["recording.share.created", "recording.share.revoked"]))+ db.session.add(hook)+ db.session.commit()+ ids = dict(owner=owner.id, other=other.id, rec=rec.id, tokens=tokens, hook=hook.id)+ yield ids+ with app.app_context():+ db.session.rollback()+ WebhookDelivery.query.filter_by(webhook_id=ids["hook"]).delete()+ Webhook.query.filter_by(id=ids["hook"]).delete()+ Share.query.filter_by(recording_id=ids["rec"]).delete()+ Recording.query.filter_by(id=ids["rec"]).delete()+ APIToken.query.filter(APIToken.user_id.in_([ids["owner"], ids["other"]])).delete(synchronize_session=False)+ User.query.filter(User.id.in_([ids["owner"], ids["other"]])).delete(synchronize_session=False)+ db.session.commit()+++def _post(world, body=None, token="share", secure=True):+ with app.test_client() as c:+ return c.post(f"/api/v1/recordings/{world['rec']}/share", json=body or {},+ headers={"Authorization": f"Bearer {world['tokens'][token]}"},+ base_url="https://localhost" if secure else "http://localhost")+++def test_create_then_reuse_without_changing_flags(world):+ first = _post(world)+ body = first.get_json()+ assert first.status_code == 201 and body["existing"] is False+ assert (body["share"]["share_summary"], body["share"]["share_notes"]) == (True, False)+ assert body["share_url"].startswith("https://") and "/share/" in body["share_url"]+ again = _post(world, {"share_notes": True})+ assert again.status_code == 200 and again.get_json()["existing"] is True+ assert again.get_json()["flags_differ"] is True and again.get_json()["share"]["share_notes"] is False+ with app.app_context():+ assert Share.query.filter_by(recording_id=world["rec"]).one().share_notes is False+++def test_update_existing_and_force_new(world):+ _post(world)+ updated = _post(world, {"share_notes": True, "update_existing": True})+ assert updated.status_code == 200 and updated.get_json()["share"]["share_notes"] is True+ assert updated.get_json()["flags_differ"] is False+ fresh = _post(world, {"force_new": True})+ assert fresh.status_code == 201 and fresh.get_json()["share"]["id"] != updated.get_json()["share"]["id"]+ with app.test_client() as c:+ listed = c.get(f"/api/v1/recordings/{world['rec']}/shares",+ headers={"Authorization": f"Bearer {world['tokens']['share']}"}).get_json()["shares"]+ assert len(listed) == 2 and all(s["share_url"] for s in listed)++[email protected]("case,code", [("plain_http", "https_required"), ("off", "feature_disabled"),+ ("no_permission", "not_permitted")])+def test_refusals(world, case, code):+ if case == "off":+ with patch.dict(os.environ, {"ENABLE_PUBLIC_SHARING": "false"}):+ resp = _post(world)+ elif case == "no_permission":+ with app.app_context():+ db.session.get(User, world["owner"]).can_share_publicly = False+ db.session.commit()+ resp = _post(world)+ else:+ resp = _post(world, secure=False)+ assert resp.status_code == 403 and resp.get_json()["code"] == code+++def test_non_owner_and_scope(world):+ assert _post(world, token="other").status_code == 404+ resp = _post(world, token="write")+ assert resp.status_code == 403 and resp.get_json()["code"] == "insufficient_scope"+++def test_revoke_and_webhooks(world):+ share_id = _post(world).get_json()["share"]["id"]+ with app.test_client() as c:+ assert c.delete(f"/api/v1/shares/{share_id}", headers={"Authorization": f"Bearer {world['tokens']['other']}"}).status_code == 404+ assert c.delete(f"/api/v1/shares/{share_id}", headers={"Authorization": f"Bearer {world['tokens']['share']}"}).status_code == 204+ with app.app_context():+ events = [(d.event_type, json.loads(d.payload)["data"]["share_id"])+ for d in WebhookDelivery.query.filter_by(webhook_id=world["hook"]).order_by(WebhookDelivery.id)]+ assert events == [("recording.share.created", share_id), ("recording.share.revoked", share_id)]+++def test_an_expired_link_is_gone(world):+ body = _post(world, {"expires_in_days": 7}).get_json()+ assert body["share"]["expires_at"].endswith("Z")+ path = "/share/" + body["share_url"].rsplit("/share/", 1)[1]+ with app.test_client() as c:+ assert c.get(path).status_code == 200+ with app.app_context():+ share = db.session.get(Share, body["share"]["id"])+ share.expires_at = datetime.utcnow() - timedelta(minutes=1)+ db.session.commit()+ assert c.get(path).status_code == 404+ assert _post(world, {"expires_in_days": 0}).status_code == 400diff --git a/tests/test_api_v1_scope_coverage.py b/tests/test_api_v1_scope_coverage.pyindex a4ac8933..5043a1ca 100644--- a/tests/test_api_v1_scope_coverage.py+++ b/tests/test_api_v1_scope_coverage.py@@ -17,6 +17,7 @@ EXPECTED = {"get_transcript", "get_summary", "get_notes", "get_recording_status", "list_tags", "list_folders","get_folder", "get_transcription_info", "list_speakers", "get_recording_speakers","get_recording_events", "download_events_ics", "download_audio"},+ "share": {"create_public_share", "list_public_shares", "revoke_public_share"},"write": {"replace_recording_tags", "add_external_ref", "replace_external_refs", "delete_external_ref", "update_recording", "replace_notes", "replace_summary", "create_tag", "update_tag","add_tags_to_recording", "remove_tag_from_recording", "create_folder", "update_folder","create_speaker", "update_speaker", "assign_speakers", "batch_update_recordings"},diff --git a/tests/test_upgrade_mailr_api.py b/tests/test_upgrade_mailr_api.pyindex 0fdf61ef..69993687 100644--- a/tests/test_upgrade_mailr_api.py+++ b/tests/test_upgrade_mailr_api.py@@ -175,3 +175,18 @@ def test_speaker_contact_columns(tmp_path, fixture):assert con.execute("SELECT name, email, aliases FROM speaker WHERE id = 4").fetchone() == ("Dana", None, None)con.close()+[email protected]("fixture", FIXTURES, ids=[f[:-4] for f in FIXTURES])+def test_share_expiry_column(tmp_path, fixture):+ """G10: share.expires_at arrives empty, so existing links never expire."""+ db_path, con = _load(tmp_path, fixture)+ if "share" not in {r[0] for r in con.execute("SELECT name FROM sqlite_master WHERE type='table'")}:+ con.close()+ pytest.skip("share table not in this release")+ con.close()+ _upgrade(db_path)+ _upgrade(db_path)+ con = sqlite3.connect(db_path)+ assert "expires_at" in _columns(con, "share")+ con.close()+