@1auth/messenger
Advanced tools
Comparing version 0.0.0-alpha.17 to 0.0.0-alpha.18
@@ -18,2 +18,4 @@ import { | ||
table: 'messengers', | ||
idGenerate: true, | ||
idPrefix: 'messenger', | ||
store: undefined, | ||
@@ -23,3 +25,3 @@ notify: undefined | ||
export default (params) => { | ||
Object.assign(options, { token: outOfBandToken }, params) | ||
Object.assign(options, { id: randomId, token: outOfBandToken }, params) | ||
} | ||
@@ -56,7 +58,6 @@ export const getOptions = () => options | ||
const now = nowInSeconds() | ||
const id = await randomId.create() | ||
const { encryptedKey } = makeSymetricKey(sub) | ||
const encryptedData = encrypt(value, encryptedKey, sub) | ||
await options.store.insert(options.table, { | ||
id, | ||
const params = { | ||
sub, | ||
@@ -69,3 +70,7 @@ type: options.id, | ||
update: now // in case new digests need to be created | ||
}) | ||
} | ||
if (options.idGenerate) { | ||
params.id = await options.id.create(options.idPrefix) | ||
} | ||
await options.store.insert(options.table, params) | ||
await createToken(sub, id) | ||
@@ -93,7 +98,3 @@ return id | ||
const token = await options.token.create() | ||
id = await authnCreate( | ||
options.token.type, | ||
{ id, sub, value: token }, | ||
options | ||
) | ||
id = await authnCreate(options.token.type, { id, sub, value: token }, options) | ||
await options.notify.trigger('messenger-TYPE-verify', sub, { token }) | ||
@@ -100,0 +101,0 @@ return id |
21
index.js
@@ -18,2 +18,4 @@ import { | ||
table: 'messengers', | ||
idGenerate: true, | ||
idPrefix: 'messenger', | ||
store: undefined, | ||
@@ -23,3 +25,3 @@ notify: undefined | ||
export default (params) => { | ||
Object.assign(options, { token: outOfBandToken }, params) | ||
Object.assign(options, { id: randomId, token: outOfBandToken }, params) | ||
} | ||
@@ -56,7 +58,6 @@ export const getOptions = () => options | ||
const now = nowInSeconds() | ||
const id = await randomId.create() | ||
const { encryptedKey } = makeSymetricKey(sub) | ||
const encryptedData = encrypt(value, encryptedKey, sub) | ||
await options.store.insert(options.table, { | ||
id, | ||
const params = { | ||
sub, | ||
@@ -69,3 +70,7 @@ type: options.id, | ||
update: now // in case new digests need to be created | ||
}) | ||
} | ||
if (options.idGenerate) { | ||
params.id = await options.id.create(options.idPrefix) | ||
} | ||
await options.store.insert(options.table, params) | ||
await createToken(sub, id) | ||
@@ -93,7 +98,3 @@ return id | ||
const token = await options.token.create() | ||
id = await authnCreate( | ||
options.token.type, | ||
{ id, sub, value: token }, | ||
options | ||
) | ||
id = await authnCreate(options.token.type, { id, sub, value: token }, options) | ||
await options.notify.trigger('messenger-TYPE-verify', sub, { token }) | ||
@@ -100,0 +101,0 @@ return id |
{ | ||
"name": "@1auth/messenger", | ||
"version": "0.0.0-alpha.17", | ||
"version": "0.0.0-alpha.18", | ||
"description": "", | ||
@@ -53,5 +53,5 @@ "type": "module", | ||
"dependencies": { | ||
"@1auth/authn": "0.0.0-alpha.17", | ||
"@1auth/crypto": "0.0.0-alpha.17" | ||
"@1auth/authn": "0.0.0-alpha.18", | ||
"@1auth/crypto": "0.0.0-alpha.18" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8315
+ Added@1auth/authn@0.0.0-alpha.18(transitive)
+ Added@1auth/crypto@0.0.0-alpha.18(transitive)
- Removed@1auth/authn@0.0.0-alpha.17(transitive)
- Removed@1auth/crypto@0.0.0-alpha.17(transitive)
Updated@1auth/authn@0.0.0-alpha.18
Updated@1auth/crypto@0.0.0-alpha.18