Manual Reference Source Test
import IdentityRecord from 'src/modules/identity-record.js'
public class | source

IdentityRecord

Identity record

Static Method Summary

Static Public Methods
public static

clear()

Clear record from storage

public static

restore(config: IdentityConfig, env: string, key: string, token: string): IdentityRecord

Restore record from storage

public static

store(env: string, key: string, token: string, user: IdentityUser): IdentityRecord

Create and persist record in storage

Constructor Summary

Public Constructor
public

constructor(properties: Object)

IdentityRecord constructor

Static Public Methods

public static clear() source

Clear record from storage

public static restore(config: IdentityConfig, env: string, key: string, token: string): IdentityRecord source

Restore record from storage

If env, key and/or token are specified they are verified to match with stored data.

Session TTL is also verified by the stored timestamp and IdentityConfig#sessionTimeout.

If the stored data is invalid then this returns null.

If user TTL has expired according to IdentityConfig#userTimeout then IdentityRecord#user will be null.

Params:

NameTypeAttributeDescription
config IdentityConfig

Identity config

env string
  • optional
  • default: null

Identity environment

key string
  • optional
  • default: null

Identity App key

token string
  • optional
  • default: null

Identity session token

Return:

IdentityRecord

Identity record or null

public static store(env: string, key: string, token: string, user: IdentityUser): IdentityRecord source

Create and persist record in storage

Params:

NameTypeAttributeDescription
env string

Identity environment

key string

Identity App key

token string

Identity session token

user IdentityUser

Identity user

Return:

IdentityRecord

Identity record

Public Constructors

public constructor(properties: Object) source

IdentityRecord constructor

Params:

NameTypeAttributeDescription
properties Object

Properties

properties.env string

Identity environment

properties.key string

Identity App key

properties.token string

Identity session token

properties.user IdentityUser

Identity user or null

properties.timestamp number

Identity record timestamp