createTempCustom(params: CreateCustomParams)

Requires:
@ray-js/lock-sdk≥1.0.0

Description

Create a custom temporary password.

Parameters

ParameterTypeRequiredDescription
YesCreation parameters

Return Value

Type: Promise<TempPasswordResult>
Creation result
TempPasswordResult
PropertyTypeDescription
type"custom" | "once" | "limit" | "clear" | "clearOne" | "dynamic"Password type or dynamic (dynamic code)
namestringDisplay name
passwordstringPassword plaintext or display string
unlockBindingIdstringCloud binding relationship ID
Effective time configuration

Error Code

Error CodeError Message
1052The previous operation on the same device has not completed
1030Invalid password format
1031Password name is too long (exceeds 20 characters)
1032Missing effective time configuration
1033Missing effective date
1034Missing expiration date
1010Effective time is later than expiration time
1035weeks not provided in weekly repeat mode
1043The cloud did not return a sequence number (near-field channel)
1001Device is offline (near-field channel)
1002Operation timed out (near-field channel)
1041Device reported creation failure: duplicate password (near-field channel)
1042Device reported creation failure (near-field channel)
1037Cloud: Password already exists (USER_PWD_ALREADY_EXIST)
1038Cloud: Duplicate password name (LOCK_PWD_NAME_REPEAT)
1039Cloud: Invalid time parameters (START_END_DATE_NOT_RIGHT)

Referenced Types

interfaceEffectiveConfig
PropertyTypeRequiredDescription
effectiveDatenumberYesEffective date (seconds-level timestamp)
expiredDatenumberYesExpiration date (seconds-level timestamp)
repeat"none" | "week"NoRepeat policy: none or weekly
weeksWeekNoWeekly repeat bitmap
effectiveTimenumberNoDaily start time (minutes)
expiredTimenumberNoDaily end time (minutes)
typeWeekWeekly repeat bitmap: indices 0–6 correspond to Sun–Sat; 0 inactive, 1 active
export type Week = [
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
  BitStatus,
];

Valid Values

EffectiveConfig.repeat
ValueDescriptionSince
none--
week--
Week
ValueDescriptionSince
0--
1--
return.type
ValueDescriptionSince
custom--
once--
limit--
clear--
clearOne--

Examples

import { createTempCustom } from '@ray-js/lock-sdk';
await createTempCustom({ password: '123456', effectiveTime: 1700000000, invalidTime: 1700086400 });