@1auth/account 0.0.0-alpha.0 → 0.0.0-alpha.2
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.
- package/index.js +7 -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
|
-
|
|
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
|
}
|
|
@@ -60,7 +63,9 @@ export const create = async (values = {}) => {
|
|
|
60
63
|
|
|
61
64
|
// for in the clear user metadata
|
|
62
65
|
export const update = async (sub, values = {}) => {
|
|
63
|
-
const { encryptionKey } = await options.store.select(options.table, {
|
|
66
|
+
const { encryptionKey } = await options.store.select(options.table, {
|
|
67
|
+
sub
|
|
68
|
+
})
|
|
64
69
|
|
|
65
70
|
for (const key of options.encryptedKeys) {
|
|
66
71
|
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.
|
|
3
|
+
"version": "0.0.0-alpha.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
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": "
|
|
51
|
+
"gitHead": "a02b1e01f039718f213d79b91d04ed660a955c73",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@1auth/crypto": "0.0.0-alpha.
|
|
53
|
+
"@1auth/crypto": "0.0.0-alpha.2"
|
|
54
54
|
}
|
|
55
55
|
}
|