MCPcopy Create free account
hub / github.com/adonisjs/session / #parseSessionData

Method #parseSessionData

src/stores/database.ts:125–134  ·  view source on GitHub ↗

* Parses and verifies session data from string format. * Returns null if the data is corrupted or verification fails. * * @param contents - Session data as string * @param sessionId - Session identifier for verification

(contents: string, sessionId: string)

Source from the content-addressed store, hash-verified

123 * @param sessionId - Session identifier for verification
124 */
125 #parseSessionData(contents: string, sessionId: string): SessionData | null {
126 try {
127 if (this.#encryption) {
128 return this.#encryption.decrypt<SessionData>(contents, sessionId)
129 }
130 return new MessageBuilder().verify<SessionData>(contents, sessionId)
131 } catch {
132 return null
133 }
134 }
135
136 /**
137 * Encrypts or signs the session data for the session id

Callers 2

#rowToTaggedSessionMethod · 0.95
readMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected