@1auth/account 0.0.0-alpha.0 → 0.0.0-alpha.10

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 (2) hide show
  1. package/index.js +9 -3
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -6,15 +6,18 @@ import {
6
6
  decrypt
7
7
  } from '@1auth/crypto'
8
8
 
9
- export const options = {
9
+ const options = {
10
10
  store: undefined,
11
11
  notify: undefined,
12
12
  table: 'accounts',
13
13
  encryptedKeys: []
14
14
  }
15
+
15
16
  export default (params) => {
16
17
  Object.assign(options, { id: subject }, params)
17
18
  }
19
+ export const getOptions = () => options
20
+
18
21
  export const exists = async (sub) => {
19
22
  return options.store.exists(options.table, { sub })
20
23
  }
@@ -43,13 +46,14 @@ export const create = async (values = {}) => {
43
46
  }
44
47
 
45
48
  await options.store.insert(options.table, {
49
+ create: now, // allow use for import
46
50
  ...values,
47
51
  sub,
48
52
  encryptionKey: encryptedKey,
49
53
  publicKey,
50
54
  privateKey,
51
- create: now,
52
55
  update: now
56
+
53
57
  // notifications,
54
58
  // authorization
55
59
  })
@@ -60,7 +64,9 @@ export const create = async (values = {}) => {
60
64
 
61
65
  // for in the clear user metadata
62
66
  export const update = async (sub, values = {}) => {
63
- const { encryptionKey } = await options.store.select(options.table, { sub })
67
+ const { encryptionKey } = await options.store.select(options.table, {
68
+ sub
69
+ })
64
70
 
65
71
  for (const key of options.encryptedKeys) {
66
72
  values[key] &&= await encrypt(values[key], encryptionKey, sub)
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@1auth/account",
3
- "version": "0.0.0-alpha.0",
3
+ "version": "0.0.0-alpha.10",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "engines": {
7
- "node": ">=18"
7
+ "node": ">=16"
8
8
  },
9
9
  "engineStrict": true,
10
10
  "publishConfig": {
@@ -48,8 +48,8 @@
48
48
  "url": "https://github.com/willfarrell/1auth/issues"
49
49
  },
50
50
  "homepage": "https://github.com/willfarrell/1auth",
51
- "gitHead": "dcd3cb3dcacdebbe21625f092187e7cf02473f68",
51
+ "gitHead": "40d015ce640f9813d809fddb847f60974c596b46",
52
52
  "dependencies": {
53
- "@1auth/crypto": "0.0.0-alpha.0"
53
+ "@1auth/crypto": "0.0.0-alpha.10"
54
54
  }
55
55
  }