6.1 Lock/Unlock Text

6.1.1 Lock Text

The lockText function locks text with default BayunEncryptionPolicy and BayunKeyGenerationPolicy dictated by company settings.

The function takes the following parameters :

  • sessionId : Unique SessionId which is received in the login/registration function response.

  • plainText : Text to be locked.

var lockedText = await bayunCore.lockText("<sessionId>", "<plainText>");

6.1.2 Lock Text with Encryption Policy, Key Generation Policy

The lockText function with encryption policy, key generation policy as parameters locks the plain text. The function takes the following parameters :

  • sessionId : Unique SessionId which is received in the login/registration function response.

  • plainText : Text to be locked.

  • encryptionPolicy : BayunEncryptionPolicy determines the key to be used to generate the lockingKey.

  • keyGenerationPolicy : BayunKeyGenerationPolicy determines the policy to generate the lockingKey.

  • groupId : GroupId is required if encryptionPolicy is GROUP.

If encryptionPolicy is other than GROUP then groupId should be an empty string.

const encryptionPolicy = BayunCore.EncryptionPolicy.GROUP;
const keyGenerationPolicy = BayunCore.KeyGenerationPolicy.ENVELOPE;

var lockedText = await bayunCore.lockText("<sessionId>", "<plainText>", 
                                 encryptionPolicy, keyGenerationPolicy, "<groupId>");

6.1.3 Unlock Text

The unlockText function unlocks a locked text. The function takes the following parameters :

  • sessionId : Unique SessionId which is received in the login/registration function response.

  • lockedText : Text to be unlocked.

var unlockedText = await bayunCore.unlockText("<sessionId>", "<lockedText>");

Last updated

Was this helpful?