@agimon-ai/po-auth-server 0.0.2-alpha.11 → 0.0.2-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -903,11 +903,15 @@ async function createIdentityHome(config, ports) {
903
903
  await tx.run("DELETE FROM first_workspace WHERE organizationId=?", org);
904
904
  await tx.run("DELETE FROM organization WHERE id=?", org);
905
905
  }
906
- async function deleteOrganization(subject, org) {
907
- const receipt = {
908
- deletedAt: now(),
909
- purgeDueAt: now() + _agimon_ai_po_web_security.FEDERATION_FRESHNESS.accountPurge
906
+ function deletionReceipt() {
907
+ const deletedAt = now();
908
+ return {
909
+ deletedAt,
910
+ purgeDueAt: deletedAt + _agimon_ai_po_web_security.FEDERATION_FRESHNESS.accountPurge
910
911
  };
912
+ }
913
+ async function deleteOrganization(subject, org) {
914
+ const receipt = deletionReceipt();
911
915
  await database.transaction(async (tx) => {
912
916
  if (await membership(tx, subject, org) !== "owner") throw new IdentityRefusal(403, "Owner required");
913
917
  await tombstoneOrg(tx, org, receipt);
@@ -919,10 +923,7 @@ async function createIdentityHome(config, ports) {
919
923
  };
920
924
  }
921
925
  async function deleteAccount(subject) {
922
- const receipt = {
923
- deletedAt: now(),
924
- purgeDueAt: now() + _agimon_ai_po_web_security.FEDERATION_FRESHNESS.accountPurge
925
- };
926
+ const receipt = deletionReceipt();
926
927
  await database.transaction(async (tx) => {
927
928
  const memberships = await tx.all("SELECT organizationId, role FROM member WHERE userId = ?", subject);
928
929
  const personal = await tx.get("SELECT organizationId FROM identity_personal_org WHERE subject = ? UNION SELECT organizationId FROM first_workspace WHERE marker = ? LIMIT 1", subject, subject);
@@ -903,11 +903,15 @@ async function createIdentityHome(config, ports) {
903
903
  await tx.run("DELETE FROM first_workspace WHERE organizationId=?", org);
904
904
  await tx.run("DELETE FROM organization WHERE id=?", org);
905
905
  }
906
- async function deleteOrganization(subject, org) {
907
- const receipt = {
908
- deletedAt: now(),
909
- purgeDueAt: now() + FEDERATION_FRESHNESS.accountPurge
906
+ function deletionReceipt() {
907
+ const deletedAt = now();
908
+ return {
909
+ deletedAt,
910
+ purgeDueAt: deletedAt + FEDERATION_FRESHNESS.accountPurge
910
911
  };
912
+ }
913
+ async function deleteOrganization(subject, org) {
914
+ const receipt = deletionReceipt();
911
915
  await database.transaction(async (tx) => {
912
916
  if (await membership(tx, subject, org) !== "owner") throw new IdentityRefusal(403, "Owner required");
913
917
  await tombstoneOrg(tx, org, receipt);
@@ -919,10 +923,7 @@ async function createIdentityHome(config, ports) {
919
923
  };
920
924
  }
921
925
  async function deleteAccount(subject) {
922
- const receipt = {
923
- deletedAt: now(),
924
- purgeDueAt: now() + FEDERATION_FRESHNESS.accountPurge
925
- };
926
+ const receipt = deletionReceipt();
926
927
  await database.transaction(async (tx) => {
927
928
  const memberships = await tx.all("SELECT organizationId, role FROM member WHERE userId = ?", subject);
928
929
  const personal = await tx.get("SELECT organizationId FROM identity_personal_org WHERE subject = ? UNION SELECT organizationId FROM first_workspace WHERE marker = ? LIMIT 1", subject, subject);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-auth-server",
3
- "version": "0.0.2-alpha.11",
3
+ "version": "0.0.2-alpha.12",
4
4
  "description": "Po auth server: sign-in, teams, device trust, recovery, rosters and delegated tokens for Node and Cloudflare hosts",
5
5
  "keywords": [
6
6
  "ai",
@@ -48,19 +48,19 @@
48
48
  "access": "public"
49
49
  },
50
50
  "dependencies": {
51
- "@agimon-ai/po-core": "0.0.0-alpha.169",
52
- "@agimon-ai/po-web-security": "0.0.0-alpha.169",
51
+ "@agimon-ai/po-core": "0.0.0-alpha.170",
52
+ "@agimon-ai/po-web-security": "0.0.0-alpha.170",
53
53
  "@better-auth/expo": "1.7.12",
54
54
  "@better-auth/passkey": "1.7.12",
55
55
  "@better-auth/sso": "1.7.12",
56
- "@earendil-works/chord": "1.5.1",
57
- "@earendil-works/pi-durable": "1.5.1",
56
+ "@earendil-works/chord": "1.5.2",
57
+ "@earendil-works/pi-durable": "1.5.2",
58
58
  "better-auth": "1.7.12",
59
59
  "jose": "6.2.2"
60
60
  },
61
61
  "devDependencies": {
62
- "@agimon-ai/po-network": "0.0.2-alpha.116",
63
- "@agimon-ai/vibe-lint-plugin-po-core": "0.0.0-alpha.169",
62
+ "@agimon-ai/po-network": "0.0.2-alpha.117",
63
+ "@agimon-ai/vibe-lint-plugin-po-core": "0.0.0-alpha.170",
64
64
  "@types/node": "26.4.1",
65
65
  "tsdown": "0.23.0",
66
66
  "typescript": "7.0.2",