@1auth/authn 0.0.0-alpha.46 → 0.0.0-alpha.48

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 +15 -2
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -45,7 +45,7 @@ export const count = async (credentialOptions, sub) => {
45
45
  )
46
46
  let count = 0
47
47
  const now = nowInSeconds()
48
- for (let i = credentials.length; i--;) {
48
+ for (let i = credentials.length; i--; ) {
49
49
  const credential = credentials[i]
50
50
  if (credential.expire && credential.expire < now) {
51
51
  continue
@@ -71,7 +71,7 @@ export const list = async (credentialOptions, sub, params, fields) => {
71
71
  )
72
72
  // const now = nowInSeconds();
73
73
  const list = []
74
- for (let i = items.length; i--;) {
74
+ for (let i = items.length; i--; ) {
75
75
  const item = items[i]
76
76
  // TODO need filter for expire
77
77
  // if (credential.expire < now) {
@@ -281,6 +281,19 @@ export const remove = async (credentialOptions, sub, id) => {
281
281
  await options.store.remove(options.table, { id, type, sub })
282
282
  }
283
283
 
284
+ export const select = async (credentialOptions, sub, id) => {
285
+ const type = makeType(credentialOptions)
286
+ const item = await options.store.select(options.table, { id, type, sub })
287
+ const { encryptionKey: encryptedKey } = item
288
+ delete item.encryptionKey
289
+ const decryptedItem = symmetricDecryptFields(
290
+ item,
291
+ { encryptedKey, sub },
292
+ options.encryptedFields
293
+ )
294
+ return decryptedItem
295
+ }
296
+
284
297
  // TODO manage onboard state
285
298
 
286
299
  // TODO save notification settings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1auth/authn",
3
- "version": "0.0.0-alpha.46",
3
+ "version": "0.0.0-alpha.48",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "engines": {
@@ -50,6 +50,6 @@
50
50
  "homepage": "https://github.com/willfarrell/1auth",
51
51
  "gitHead": "7a6c0fbb8ab71d6a2171e678697de9f237568431",
52
52
  "dependencies": {
53
- "@1auth/crypto": "0.0.0-alpha.46"
53
+ "@1auth/crypto": "0.0.0-alpha.48"
54
54
  }
55
55
  }