Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@1auth/messenger

Package Overview
Dependencies
Maintainers
0
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@1auth/messenger - npm Package Compare versions

Comparing version 0.0.0-alpha.49 to 0.0.0-alpha.50

57

index.js

@@ -108,3 +108,3 @@ import {

{},
{ messengers: [valueExists.id] }
{ messengers: [{ id: valueExists.id }] }
)

@@ -167,3 +167,3 @@ return

},
{ messengers: [sourceId] }
{ messengers: [{ id: sourceId }] }
)

@@ -173,3 +173,14 @@ return id

export const verifyToken = async (type, sub, token, notify = true) => {
export const verifyToken = async (type, sub, token) => {
let messengers = list(type, sub).then((items) => {
const messengers = []
for (let i = items.length; i--;) {
const messenger = items[i]
if (!messenger.verify) {
continue
}
messengers.push({ id: messenger.id })
}
return messengers
})
const { sourceId } = await authnVerify(options.token, sub, token)

@@ -181,4 +192,7 @@ await options.store.update(

)
if (notify) {
await options.notify.trigger(`messenger-${type}-create`, sub)
messengers = await messengers
if (messengers.length) {
await options.notify.trigger(`messenger-${type}-create`, sub, undefined, {
messengers
})
}

@@ -188,7 +202,9 @@ }

export const remove = async (type, sub, id) => {
const item = await options.store.select(options.table, { id, sub, type }, [
'verify'
])
const messenger = await options.store.select(
options.table,
{ id, sub, type },
['value', 'verify']
)
if (!item) {
if (!messenger) {
throw new Error('403 Unauthorized')

@@ -203,5 +219,24 @@ }

if (item?.verify) {
await options.notify.trigger(`messenger-${type}-remove`, sub)
// remove request is self clean up
if (!messenger?.verify) {
return
}
const { encryptionKey: encryptedKey } = messenger
delete messenger.encryptionKey
const { value } = symmetricDecryptFields(
messenger,
{ encryptedKey, sub },
options.encryptedFields
)
await Promise.all([
// Let messenger know it was removed
options.notify.trigger(`messenger-${type}-remove-self`, sub, undefined, {
messengers: [{ type, value }]
}),
// Let all others know one was removed
options.notify.trigger(`messenger-${type}-remove`, sub)
])
}

@@ -208,0 +243,0 @@

6

package.json
{
"name": "@1auth/messenger",
"version": "0.0.0-alpha.49",
"version": "0.0.0-alpha.50",
"description": "",

@@ -53,5 +53,5 @@ "type": "module",

"dependencies": {
"@1auth/authn": "0.0.0-alpha.49",
"@1auth/crypto": "0.0.0-alpha.49"
"@1auth/authn": "0.0.0-alpha.50",
"@1auth/crypto": "0.0.0-alpha.50"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc