@o3co/auth-provider-templates 0.0.0 → 0.18.0-rc.1

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.
Files changed (72) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +2 -3
  3. package/authorize-store/README.md +3 -0
  4. package/authorize-store/src/module.d.ts +2 -0
  5. package/authorize-store/src/module.js +19 -0
  6. package/client-assertion-store/README.md +3 -0
  7. package/client-assertion-store/src/module.d.ts +2 -0
  8. package/client-assertion-store/src/module.js +22 -0
  9. package/code-grant-store/README.md +3 -0
  10. package/code-grant-store/src/module.d.ts +2 -0
  11. package/code-grant-store/src/module.js +36 -0
  12. package/code-grant-store/src/section.d.ts +6 -0
  13. package/code-grant-store/src/section.js +18 -0
  14. package/consent-store/README.md +3 -0
  15. package/consent-store/src/module.d.ts +2 -0
  16. package/consent-store/src/module.js +34 -0
  17. package/device-grant-store/README.md +3 -0
  18. package/device-grant-store/src/module.d.ts +2 -0
  19. package/device-grant-store/src/module.js +33 -0
  20. package/dpop-store/README.md +3 -0
  21. package/dpop-store/src/module.d.ts +2 -0
  22. package/dpop-store/src/module.js +19 -0
  23. package/federation-grants-store/README.md +3 -0
  24. package/federation-grants-store/src/module.d.ts +2 -0
  25. package/federation-grants-store/src/module.js +91 -0
  26. package/federation-grants-store/src/section.d.ts +6 -0
  27. package/federation-grants-store/src/section.js +18 -0
  28. package/federation-store/README.md +3 -0
  29. package/federation-store/src/module.d.ts +2 -0
  30. package/federation-store/src/module.js +21 -0
  31. package/federation-tokens-store/README.md +3 -0
  32. package/federation-tokens-store/src/module.d.ts +2 -0
  33. package/federation-tokens-store/src/module.js +43 -0
  34. package/mfa-flows-store/README.md +3 -0
  35. package/mfa-flows-store/src/module.d.ts +2 -0
  36. package/mfa-flows-store/src/module.js +23 -0
  37. package/mfa-store/README.md +3 -0
  38. package/mfa-store/src/module.d.ts +2 -0
  39. package/mfa-store/src/module.js +24 -0
  40. package/package.json +95 -3
  41. package/refresh-store/README.md +3 -0
  42. package/refresh-store/src/module.d.ts +2 -0
  43. package/refresh-store/src/module.js +60 -0
  44. package/refresh-store/src/section.d.ts +8 -0
  45. package/refresh-store/src/section.js +32 -0
  46. package/rp-logout-store/README.md +3 -0
  47. package/rp-logout-store/src/module.d.ts +2 -0
  48. package/rp-logout-store/src/module.js +39 -0
  49. package/rp-logout-store/src/section.d.ts +7 -0
  50. package/rp-logout-store/src/section.js +25 -0
  51. package/session-store/README.md +3 -0
  52. package/session-store/src/module.d.ts +2 -0
  53. package/session-store/src/module.js +65 -0
  54. package/session-store/src/section.d.ts +7 -0
  55. package/session-store/src/section.js +25 -0
  56. package/session-tokens-store/README.md +3 -0
  57. package/session-tokens-store/src/module.d.ts +2 -0
  58. package/session-tokens-store/src/module.js +55 -0
  59. package/session-tokens-store/src/section.d.ts +7 -0
  60. package/session-tokens-store/src/section.js +25 -0
  61. package/subject-revocation-store/README.md +3 -0
  62. package/subject-revocation-store/src/module.d.ts +2 -0
  63. package/subject-revocation-store/src/module.js +26 -0
  64. package/tokens-store/README.md +3 -0
  65. package/tokens-store/src/module.d.ts +2 -0
  66. package/tokens-store/src/module.js +22 -0
  67. package/users-store/README.md +3 -0
  68. package/users-store/src/module.d.ts +2 -0
  69. package/users-store/src/module.js +44 -0
  70. package/webauthn-store/README.md +3 -0
  71. package/webauthn-store/src/module.d.ts +2 -0
  72. package/webauthn-store/src/module.js +50 -0
@@ -0,0 +1,26 @@
1
+ import { defineModule } from "@o3co/auth-provider-foundation/kernel";
2
+ import { recordsIn } from "@o3co/auth-provider-foundation/records";
3
+ import { spaces, store } from "@o3co/auth-provider-foundation/store";
4
+ import { boundaryStore, } from "@o3co/auth-provider-identity/subject-revocation";
5
+ /** Each need subject-revocation states, as the guarantee a space declares for it. */
6
+ const guaranteeFor = {
7
+ neverEvicted: "no-eviction",
8
+ survivesCrash: "durable",
9
+ survivesFailover: "replicated",
10
+ };
11
+ const boundaries = {
12
+ name: "subject-revocation-store.boundaries",
13
+ guarantees: Object.values(guaranteeFor),
14
+ };
15
+ export default defineModule({ name: "subject-revocation-store" }, (m) => [
16
+ m.contribute(spaces).by(() => boundaries),
17
+ m.provide(boundaryStore).by(async (c) => {
18
+ const place = { store: await c.get(store), space: boundaries, log: c.log, random: c.random };
19
+ const records = recordsIn(place);
20
+ return {
21
+ save: (subject, record) => records.create(subject, record, "endless"),
22
+ read: records.read,
23
+ update: (subject, change) => records.change(subject, (record) => ({ value: change(record) })),
24
+ };
25
+ }),
26
+ ]);
@@ -0,0 +1,3 @@
1
+ # tokens-store
2
+
3
+ Wires `tokens`' store interface, revoked tokens, to `records`' records. Its one space declares a guarantee for each need `tokens` states. A need with nothing mapped to it fails the type check, and `tokens`' store contract, run on a store that loses what a missing guarantee allows, checks what each guarantee means. The wiring only maps, with no branches or loops. Depends on `kernel`, `tokens`, `records` and `store`.
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@o3co/auth-provider-foundation/kernel").Module;
2
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import { defineModule } from "@o3co/auth-provider-foundation/kernel";
2
+ import { recordsIn } from "@o3co/auth-provider-foundation/records";
3
+ import { spaces, store } from "@o3co/auth-provider-foundation/store";
4
+ import { revokedTokens } from "@o3co/auth-provider-oauth/tokens";
5
+ /** Each need tokens states, as the guarantee a space declares for it. */
6
+ const guaranteeFor = {
7
+ neverEvicted: "no-eviction",
8
+ survivesCrash: "durable",
9
+ survivesFailover: "replicated",
10
+ };
11
+ const revoked = { name: "tokens-store.revoked", guarantees: Object.values(guaranteeFor) };
12
+ export default defineModule({ name: "tokens-store" }, (m) => [
13
+ m.contribute(spaces).by(() => revoked),
14
+ m.provide(revokedTokens).by(async (c) => {
15
+ const place = { store: await c.get(store), space: revoked, log: c.log, random: c.random };
16
+ const records = recordsIn(place);
17
+ return {
18
+ save: (id, lifetimeMs) => records.create(id, true, lifetimeMs),
19
+ holds: async (id) => (await records.read(id)) !== undefined,
20
+ };
21
+ }),
22
+ ]);
@@ -0,0 +1,3 @@
1
+ # users-store
2
+
3
+ Wires `users`' store interfaces, links and verified contacts, to `records`' records, kept without end. Each interface has a space of its own, which declares a guarantee for each need `users` states for it. A need with nothing mapped to it fails the type check, and `users`' store contracts, run on a store that loses what a missing guarantee allows, check what each guarantee means. The wiring only maps, with no branches or loops. Depends on `kernel`, `users`, `records` and `store`.
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@o3co/auth-provider-foundation/kernel").Module;
2
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import { defineModule } from "@o3co/auth-provider-foundation/kernel";
2
+ import { recordsIn } from "@o3co/auth-provider-foundation/records";
3
+ import { spaces, store } from "@o3co/auth-provider-foundation/store";
4
+ import { contactStore, linkStore, } from "@o3co/auth-provider-identity/users";
5
+ /** Each need users states for its links, as the guarantee a space declares for it. */
6
+ const guaranteeFor = {
7
+ neverEvicted: "no-eviction",
8
+ survivesCrash: "durable",
9
+ survivesFailover: "replicated",
10
+ confirmedReads: "confirmed-reads",
11
+ };
12
+ /** Each need users states for its contacts, mapped as for links. */
13
+ const contactGuaranteeFor = {
14
+ neverEvicted: guaranteeFor.neverEvicted,
15
+ survivesCrash: guaranteeFor.survivesCrash,
16
+ survivesFailover: guaranteeFor.survivesFailover,
17
+ };
18
+ const links = { name: "users-store.links", guarantees: Object.values(guaranteeFor) };
19
+ const contacts = {
20
+ name: "users-store.contacts",
21
+ guarantees: Object.values(contactGuaranteeFor),
22
+ };
23
+ export default defineModule({ name: "users-store" }, (m) => [
24
+ m.contribute(spaces).by(() => links),
25
+ m.contribute(spaces).by(() => contacts),
26
+ m.provide(linkStore).by(async (c) => {
27
+ const place = { store: await c.get(store), space: links, log: c.log, random: c.random };
28
+ const records = recordsIn(place);
29
+ return {
30
+ save: (key, record) => records.create(key, record, "endless"),
31
+ read: records.read,
32
+ update: records.change,
33
+ };
34
+ }),
35
+ m.provide(contactStore).by(async (c) => {
36
+ const place = { store: await c.get(store), space: contacts, log: c.log, random: c.random };
37
+ const records = recordsIn(place);
38
+ return {
39
+ save: (key, record) => records.create(key, record, "endless"),
40
+ read: records.read,
41
+ update: records.change,
42
+ };
43
+ }),
44
+ ]);
@@ -0,0 +1,3 @@
1
+ # webauthn-store
2
+
3
+ Wires `webauthn`'s store interfaces to `records`. Passkeys are records kept without end in two spaces, one for credentials and one for subjects, each declaring a guarantee for each need `webauthn` states for them. Challenges are records under a secret, so a challenge never reaches the store, in a space declaring the other needs. A need with nothing mapped to it fails the type check, and `webauthn`'s store contracts, run on a store that loses what a missing guarantee allows, check what each guarantee means. The wiring only maps, with no branches or loops. Depends on `kernel`, `webauthn`, `records` and `store`.
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@o3co/auth-provider-foundation/kernel").Module;
2
+ export default _default;
@@ -0,0 +1,50 @@
1
+ import { defineModule } from "@o3co/auth-provider-foundation/kernel";
2
+ import { recordsIn, secretRecordsIn } from "@o3co/auth-provider-foundation/records";
3
+ import { spaces, store } from "@o3co/auth-provider-foundation/store";
4
+ import { challengeStore, passkeyStore, } from "@o3co/auth-provider-passkey/webauthn";
5
+ /** Each need webauthn states for its passkeys, as the guarantee a space declares for it. */
6
+ const guaranteeFor = {
7
+ neverEvicted: "no-eviction",
8
+ survivesCrash: "durable",
9
+ survivesFailover: "replicated",
10
+ confirmedReads: "confirmed-reads",
11
+ };
12
+ /** Each need webauthn states for its challenges, as what meets it: a guarantee, or records under a secret. */
13
+ const { namesFromSecret: challengeRecordsFor, ...challengeGuaranteeFor } = {
14
+ survivesCrash: "durable",
15
+ survivesFailover: "replicated",
16
+ namesFromSecret: secretRecordsIn,
17
+ };
18
+ const passkeySpace = (name) => ({ name, guarantees: Object.values(guaranteeFor) });
19
+ const credentials = passkeySpace("webauthn-store.credentials");
20
+ const subjects = passkeySpace("webauthn-store.subjects");
21
+ const challenges = {
22
+ name: "webauthn-store.challenges",
23
+ guarantees: Object.values(challengeGuaranteeFor),
24
+ };
25
+ export default defineModule({ name: "webauthn-store" }, (m) => [
26
+ m.contribute(spaces).by(() => credentials),
27
+ m.contribute(spaces).by(() => subjects),
28
+ m.contribute(spaces).by(() => challenges),
29
+ m.provide(passkeyStore).by(async (c) => {
30
+ const place = { store: await c.get(store), log: c.log, random: c.random };
31
+ /** One space's records, kept without end. */
32
+ const passkeyRecordsIn = (space) => {
33
+ const records = recordsIn({ ...place, space });
34
+ return {
35
+ save: (key, record) => records.create(key, record, "endless"),
36
+ read: records.read,
37
+ update: records.change,
38
+ };
39
+ };
40
+ return { credentials: passkeyRecordsIn(credentials), subjects: passkeyRecordsIn(subjects) };
41
+ }),
42
+ m.provide(challengeStore).by(async (c) => {
43
+ const place = { store: await c.get(store), space: challenges, log: c.log, random: c.random };
44
+ const records = challengeRecordsFor(place);
45
+ return {
46
+ open: records.create,
47
+ take: (challenge, mark) => records.change(challenge, () => ({ value: mark })),
48
+ };
49
+ }),
50
+ ]);