Class: BaseSecretRouteSQL
Defined in: src/routes/sql/BaseSecretRouteSQL.ts:10
Extends
Constructors
Constructor
new BaseSecretRouteSQL():
BaseSecretRouteSQL
Returns
BaseSecretRouteSQL
Inherited from
Properties
aclUtils?
protectedoptionalaclUtils?:ACLUtils
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:102
Inherited from
cacheClient?
protectedoptionalcacheClient?:Redis
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:104
The redis client that will be used as a 2nd level cache for all cacheable models.
Inherited from
config?
protectedoptionalconfig?:any
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:106
The global application configuration.
Inherited from
defaultACLUid
protecteddefaultACLUid:string
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:108
The unique identifier of the default ACL for the model type.
Inherited from
fido2Config
protectedfido2Config:PasskeyConfig
Defined in: src/routes/BaseSecretRoute.ts:54
The relying party configuration used for validating and generating FIDO2 hardware security key
(WebAuthn) registration data. Kept separate from passkeyConfig since a hardware key deployment
commonly wants a different authenticatorAttachment/residentKey policy — a hardware key is
typically registered as a "cross-platform", non-discoverable credential tied to a known
account, rather than a discoverable, possibly-synced passkey.
Inherited from
logger
protectedlogger:any
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:109
Inherited from
notificationUtils?
protectedoptionalnotificationUtils?:NotificationUtils
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:110
Inherited from
BaseSecretRoute.notificationUtils
objectFactory?
protectedoptionalobjectFactory?:ObjectFactory
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:111
Inherited from
passkeyConfig
protectedpasskeyConfig:PasskeyConfig
Defined in: src/routes/BaseSecretRoute.ts:40
The relying party configuration used for validating and generating passkey (WebAuthn) registration data.
Inherited from
repoUtils?
protectedoptionalrepoUtils?:RepoUtils<SecretSQL>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:115
The repository utility class to use for common operations.
Inherited from
repoUtilsClass
protectedreadonlyrepoUtilsClass:any=RepoUtils
Defined in: src/routes/BaseSecretRoute.ts:34
The class of the RepoUtils to use when instantiating the utility.
Inherited from
BaseSecretRoute.repoUtilsClass
totpConfig
protectedtotpConfig:TOTPConfig
Defined in: src/routes/BaseSecretRoute.ts:66
The issuer configuration used for validating and generating TOTP (RFC 6238) registration data.
Inherited from
trackChanges
protectedtrackChanges:number
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:120
The number of previous document versions to store in the database. A negative value indicates storing all
versions, a value of 0 stores no versions.
Inherited from
trustedRoles
protectedtrustedRoles:string[]
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:121
Inherited from
Accessors
modelClass
Get Signature
get modelClass():
any
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:125
The class type of the model this route is associated with.
Returns
any
Inherited from
Methods
cleanData()
protectedcleanData(obj):void
Defined in: src/routes/BaseSecretRoute.ts:77
Removes the data property from the secret(s) to protect sensitive information.
Parameters
obj
Returns
void
Inherited from
count()
count(
params,query,res,user?):Promise<any>
Defined in: src/routes/BaseSecretRoute.ts:91
Parameters
params
any
query
any
res
HttpResponse
user?
JWTUser
Returns
Promise<any>
Inherited from
create()
Defined in: src/routes/BaseSecretRoute.ts:323
Parameters
obj
req
HttpRequest
user?
JWTUser
Returns
Promise<SecretSQL | SecretSQL[]>
Inherited from
delete()
delete(
id,version,purge,req,user?):Promise<void>
Defined in: src/routes/BaseSecretRoute.ts:350
Parameters
id
string
version
string | undefined
purge
string | undefined
req
HttpRequest
user?
JWTUser
Returns
Promise<void>
Inherited from
doBulkCreate()
protecteddoBulkCreate(objs,options):Promise<SecretSQL[]>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:154
Attempts to store a collection of objects provided in options.req.body into the datastore. Upon success, sets the newly persisted
object(s) to the result property of the options.res argument, otherwise sends a 400 BAD REQUEST response to the
client.
Parameters
objs
Partial<SecretSQL>[]
The object(s) to store in the database.
options
CreateRequestOptions
The options to process the request using.
Returns
Promise<SecretSQL[]>
Inherited from
doBulkUpdate()
protecteddoBulkUpdate(objs,options):Promise<SecretSQL[]>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:206
Attempts to modify a collection of existing data model objects.
Parameters
objs
UpdateObject<SecretSQL>[]
The object(s) to bulk update in the database.
options
UpdateRequestOptions<SecretSQL>
The options to process the request using.
Returns
Promise<SecretSQL[]>
Inherited from
doCount()
protecteddoCount(options):Promise<HttpResponse>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:136
Attempts to retrieve the number of data model objects matching the given set of criteria as specified in the
request query. Any results that have been found are set to the content-length header of the res argument.
Parameters
options
FindRequestOptions
The options to process the request using.
Returns
Promise<HttpResponse>
Inherited from
doCreate()
protecteddoCreate(obj,options):Promise<SecretSQL|SecretSQL[]>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:163
Attempts to store one or more objects provided in options.req.body into the datastore. Upon success, sets the newly persisted
object(s) to the result property of the options.res argument, otherwise sends a 400 BAD REQUEST response to the
client.
Parameters
obj
Partial<SecretSQL> | Partial<SecretSQL>[]
The object(s) to store in the database.
options
CreateRequestOptions
The options to process the request using.
Returns
Promise<SecretSQL | SecretSQL[]>
Inherited from
doCreateObject()
protecteddoCreateObject(obj,options):Promise<SecretSQL>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:145
Attempts to store an object provided in options.req.body into the datastore. Upon success, sets the newly persisted
object(s) to the result property of the options.res argument, otherwise sends a 400 BAD REQUEST response to the
client.
Parameters
obj
Partial<T>
The object to store in the database.
options
CreateRequestOptions
The options to process the request using.
Returns
Promise<SecretSQL>
Inherited from
BaseSecretRoute.doCreateObject
doDelete()
protecteddoDelete(id,options):Promise<void>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:171
Attempts to delete an existing data model object with a given unique identifier encoded by the URI parameter
id.
Parameters
id
string
The unique identifier of the object to delete.
options
DeleteRequestOptions
The options to process the request using.
Returns
Promise<void>
Inherited from
doExists()
protecteddoExists(id,options):Promise<any>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:178
Attempts to determine if an existing object with the given unique identifier exists.
Parameters
id
string
The unique identifier of the object to verify exists.
options
FindRequestOptions
The options to process the request using.
Returns
Promise<any>
Inherited from
doFind()
protecteddoFind(options):Promise<SecretSQL[]>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:186
Attempts to retrieve all data model objects matching the given set of criteria as specified in the request
query. Any results that have been found are set to the result property of the res argument. result is
never null.
Parameters
options
FindRequestOptions
The options to process the request using.
Returns
Promise<SecretSQL[]>
Inherited from
doFindById()
protecteddoFindById(id,options):Promise<SecretSQL|null>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:192
Attempts to retrieve a single data model object as identified by the id parameter in the URI.
Parameters
id
string
options
FindRequestOptions
The options to process the request using.
Returns
Promise<SecretSQL | null>
Inherited from
doTruncate()
protecteddoTruncate(options):Promise<void>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:199
Attempts to remove all entries of the data model type from the datastore matching the given parameters and query.
Parameters
options
TruncateRequestOptions
The options to process the request using.
Returns
Promise<void>
Inherited from
doUpdate()
protecteddoUpdate(id,obj,options):Promise<SecretSQL>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:213
Attempts to modify an existing data model object as identified by the id parameter in the URI.
Parameters
id
string
obj
UpdateObject<SecretSQL>
The object to update in the database
options
UpdateRequestOptions<SecretSQL>
The options to process the request using.
Returns
Promise<SecretSQL>
Inherited from
doUpdateProperty()
protecteddoUpdateProperty(id,propertyName,value,options):Promise<SecretSQL>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:224
Attempts to modify a single property of an existing data model object as identified by the id parameter in the URI.
Note that this effectively bypasses optimistic locking and can cause unexpected data overwrites. Use with care.
Parameters
id
string
The unique identifier of the object to update.
propertyName
string
The name of the property to update.
value
any
The value of the property to set.
options
UpdateRequestOptions<SecretSQL>
The options to process the request using.
Returns
Promise<SecretSQL>
Inherited from
BaseSecretRoute.doUpdateProperty
exists()
exists(
id,query,res,user?):Promise<any>
Defined in: src/routes/BaseSecretRoute.ts:367
Parameters
id
string
query
any
res
HttpResponse
user?
JWTUser
Returns
Promise<any>
Inherited from
fido2RegistrationOptions()
fido2RegistrationOptions(
req,user?):Promise<any>
Defined in: src/routes/BaseSecretRoute.ts:306
Parameters
req
HttpRequest
user?
JWTUser
Returns
Promise<any>
Inherited from
BaseSecretRoute.fido2RegistrationOptions
find()
find(
params,query,user?):Promise<SecretSQL[]>
Defined in: src/routes/BaseSecretRoute.ts:380
Parameters
params
any
query
any
user?
JWTUser
Returns
Promise<SecretSQL[]>
Inherited from
findById()
findById(
id,query,user?):Promise<SecretSQL|null>
Defined in: src/routes/BaseSecretRoute.ts:390
Parameters
id
string
query
any
user?
JWTUser
Returns
Promise<SecretSQL | null>
Inherited from
passkeyRegistrationOptions()
passkeyRegistrationOptions(
req,user?):Promise<any>
Defined in: src/routes/BaseSecretRoute.ts:290
Parameters
req
HttpRequest
user?
JWTUser
Returns
Promise<any>
Inherited from
BaseSecretRoute.passkeyRegistrationOptions
truncate()
truncate(
params,query,user?):Promise<void>
Defined in: src/routes/BaseSecretRoute.ts:402
Parameters
params
any
query
any
user?
JWTUser
Returns
Promise<void>
Inherited from
validate()
validate(
objs,options?):Promise<void>
Defined in: node_modules/@rapidrest/service-core/dist/types/routes/ModelRoute.d.ts:228
Calls repoUtils.validate() to validate the object(s) provided.
Parameters
objs
Partial<SecretSQL> | Partial<SecretSQL>[]
options?
CreateRequestOptions | UpdateRequestOptions<SecretSQL>
Returns
Promise<void>
Inherited from
validateCreate()
protectedvalidateCreate(obj,req,user?):Promise<void>
Defined in: src/routes/BaseSecretRoute.ts:100
Parameters
obj
Partial<SecretSQL> | Partial<SecretSQL>[]
req
HttpRequest
user?
JWTUser
Returns
Promise<void>
Inherited from
BaseSecretRoute.validateCreate
validateTOTPCreate()
protectedvalidateTOTPCreate(obj):Promise<void>
Defined in: src/routes/BaseSecretRoute.ts:219
Validates (or generates) the secret for a new totp secret per RFC 6238/RFC 4226.
The client may either bring their own Base32-encoded secret (e.g. one generated on a
different server for migration purposes) or, more commonly, omit data entirely and have one
generated here. Either way, the secret's token parameters (digits/period/algorithm) are
captured onto the stored TOTPSecret alongside it, rather than left to always defer to
totpConfig, so verification keeps working for this secret even if the configured defaults
change later.
Parameters
obj
Partial<T>
The secret being created. If data is a string, it's used as the caller-supplied
secret; otherwise a new one is generated.
Returns
Promise<void>
Inherited from
BaseSecretRoute.validateTOTPCreate
validateWebAuthnCreate()
protectedvalidateWebAuthnCreate(obj,req,config):Promise<void>
Defined in: src/routes/BaseSecretRoute.ts:156
Verifies a client-submitted WebAuthn RegistrationResponseJSON (as produced by
navigator.credentials.create() using the options from generatePasskeyRegistrationOptions()) against
the challenge stored in the session, and replaces obj.data with the resulting StoredPasskeyCredential.
Shared by both passkey and fido2 secrets — the two differ only in relying party configuration
(see passkeyConfig/fido2Config) and which SecretType they're persisted under, not in the
underlying WebAuthn ceremony.
Per the WebAuthn registration ceremony (https://www.w3.org/TR/webauthn-2/#sctn-registering-a-new-credential),
the credential ID must be unique across all accounts known to this relying party. Rather than duplicate that
check here, the credential ID is used directly as this secret's own uid so that ModelRoute's existing
create-time identifier check rejects the request should the ID already be registered to any account. This
also lets a login ceremony, which only has the credential ID to go on, look the secret up directly by its
primary key (see BaseAuthPasskeyRoute/BaseAuthFIDO2Route's getCredentialById/updateCredentialCounter).
Parameters
obj
Partial<T>
The secret being created. Its data property must be a RegistrationResponseJSON.
req
HttpRequest
The source HTTP request, used to retrieve the challenge stored in the session by a prior call to
generatePasskeyRegistrationOptions().
config
The relying party configuration to verify the response against.
Returns
Promise<void>