API Docs for: 1.3.12
Show:

EcEncryptedValue Class

Represents an encrypted piece of data. Provides helper functions for encryption/decryption of JSON-LD objects, and provides some searchability of the data within.

Methods

addReader

(
  • newReader
)

Adds a reader to the object, if the reader does not exist.

Parameters:

  • newReader EcPk

    PK of the new reader.

addReader

(
  • newReader
)

Adds a reader to the object, if the reader does not exist.

Parameters:

  • newReader EcPk

    PK of the new reader.

addReaderAsync

(
  • newReader
  • success
  • failure
)

Adds a reader to the object, if the reader does not exist.

Parameters:

  • newReader EcPk

    PK of the new reader.

  • success Callback0

    Callback triggered after successful encryption

  • failure Callback1

    Callback triggered if error during secret decryption

decryptIntoObject

()

Decrypts this encrypted value into an object

Returns:

The Decrypted Object

decryptIntoObjectAsync

(
  • success
  • failure
)

Asynchronously decrypts this encrypted value into an object

Parameters:

  • success Callback1

    Callback triggered on successful encryption, returns the decrypted object

  • failure Callback1

    Callback triggered if error during encryption

decryptIntoObjectUsingIvAndSecretAsync

(
  • iv
  • secret
  • success
  • failure
)

Asynchronously decrypts this encrypted value into an object with a IV and secret provided

Parameters:

  • iv String

    Initialization Vector for decryption

  • secret String

    Secret for decryption

  • success Callback1

    Callback triggered after successful decryption

  • failure Callback1

    Callback triggered if error during decryption

decryptIntoString

() String

Decrypts an encrypted value into a string

Returns:

String:

Decrypted string value

decryptIntoString

() String

Decrypts an encrypted value into a string using an alternative secret.

Returns:

String:

Decrypted string value

decryptIntoStringAsync

(
  • success
  • failure
)

Asynchronously decrypts an encrypted value into a string

Parameters:

  • success Callback1

    Callback triggered after successfully decrypted, returns decrypted string

  • failure Callback1

    Callback triggered if error during decryption

decryptIntoStringAsync

(
  • success
  • failure
)

Asynchronously decrypts an encrypted value into a string

Parameters:

  • success Callback1

    Callback triggered after successfully decrypted, returns decrypted string

  • failure Callback1

    Callback triggered if error during decryption

decryptIntoStringUsingIvAndSecretAsync

(
  • iv
  • secret
  • success
  • failure
)

Asynchronously decrypts an encrypted value into a string with an IV and secrete provided

Parameters:

  • iv String

    Initialization Vector for decryption

  • secret String

    Secret for decryption

  • success Callback1

    Callback triggered on successful decryption

  • failure Callback1

    Callback triggered if error during decryption

decryptSecret

() EbacEncryptedSecret

Attempts to decrypt the secret by using all Identities in the Identity Manager

Returns:

EbacEncryptedSecret:

Secret after decrypted

decryptSecretAsync

(
  • success
  • failure
)

Asynchronously attempts to decrypt secret using all identities in Identity Manager

Parameters:

  • success Callback1

    Callback triggered after successfully decrypting secret, returns the decrypted secret

  • failure Callback1

    Callback triggered if error decrypting secret

decryptSecretByKey

(
  • decryptionKey
)
EbacEncryptedSecret

Attempts to decrypt secret with a specific key

Parameters:

  • decryptionKey EcPpk

    Key to attempt secret decryption

Returns:

EbacEncryptedSecret:

Decrypted Secret

decryptSecretByKeyAsync

(
  • decryptionKey
  • success
  • failure
)

Asynchronously attempts to decrypt secret with a specific key

Parameters:

  • decryptionKey EcPpk

    Key to attempt secret decryption

  • success Callback1

    Callback triggered after successful decryption of secret, returns decrypted secret

  • failure Callback1

    Callback triggered if error during secret decryption

encryptOnSave

(
  • id
  • [val]
)
Boolean static

Setter and getter function for encryptOnSave of an identifier, encryptOnSave is used by the static save functions of a class to determine whether or not to encrypt something when it is saved. This value is usually set when an object is decrypted using one of the decrypt functions above.

Parameters:

  • id String

    ID of the data to get/set encryptOnSave for

  • [val] Boolean optional

    If passed in, sets the value, if null this function gets the encryptOnSave value

Returns:

Boolean:

if val is null/ignored returns value in the map, if val is passed in returns val

encryptValue

(
  • text
  • id
  • owners
  • readers
)
EcEncryptedValue static

Encrypts a text value with the owners and readers provided

Parameters:

  • text String

    Text to encrypt

  • id String

    ID of the value to encrypt

  • owners String

    Owner keys to encrypt value with

  • readers String

    Reader keys to encrypt value with

Returns:

EcEncryptedValue:

Encrypted value

encryptValue

(
  • text
  • id
  • owners
  • readers
)
EcEncryptedValue static

Encrypts a text value with the owners and readers provided

Parameters:

  • text String

    Text to encrypt

  • id String

    ID of the value to encrypt

  • owners String

    Owner keys to encrypt value with

  • readers String

    Reader keys to encrypt value with

Returns:

EcEncryptedValue:

Encrypted value

encryptValueOld

(
  • text
  • id
  • owner
)
EcEncryptedValue deprecated static

Encrypts a text value with the key provided

Parameters:

  • text String

    Text to encrypt

  • id String

    ID of the encrypted value

  • owner EcPk

    Key to Encrypt

Returns:

EcEncryptedValue:

Encrypted value

encryptValueUsingIvAndSecret

(
  • iv
  • secret
  • text
  • id
  • owners
  • readers
)
EcEncryptedValue static

Encrypt a value with a specific IV and secret

Parameters:

  • iv String

    Initialization Vector for encryption

  • secret String

    Encryption secret

  • text String

    Text to encrypt

  • id String

    ID of value to encrypt

  • owners String

    Owners keys to encrypt with

  • readers String

    Reader Keys to encrypt with

Returns:

fromEncryptedValue

(
  • d
  • success
  • failure
  • d
)
static

Converts a piece of (likely) encrypted remote linked data to an unencrypted object.

Parameters:

  • d EcRemoteLinkedData

    Data to decrypt

  • success Callback1
  • failure Callback1
  • d Object

    Data to decrypt

Returns:

Decrypted data

fromEncryptedValue

(
  • d
)
static

Converts a piece of (likely) encrypted remote linked data to an unencrypted object.

Parameters:

  • d Object

    Data to decrypt

Returns:

Decrypted data

getEncryptedFullType

() String

Gets the fully qualified type name, as JSON-LD allows the "namespace" of the type to be defined in @context.

Returns:

String:

Fully qualified type name.

isAnEncrypted

(
  • type
)
Boolean

Checks if this encrypted value is an encrypted version of a specific type, only works if the type wasn't hidden during encryption

Parameters:

  • type String

    Type to compare if an encrypted type

Returns:

Boolean:

True if encrypted version of type, false if not or can't tell

removeReader

(
  • oldReader
)

Removes a reader from the object, if the reader does exist.

Parameters:

  • oldReader EcPk

    PK of the old reader.

removeReaderAsync

(
  • oldReader
  • success
  • failure
)

Removes a reader from the object, if the reader does exist.

Parameters:

  • oldReader EcPk

    PK of the old reader.

  • success Callback0

    Callback triggered after successful encryption

  • failure Callback1

    Callback triggered if error during secret decryption

toEncryptedValue

(
  • d
  • hideType
)
EcEncryptedValue static

Converts a piece of remote linked data to an encrypted value

Parameters:

  • d EcRemoteLinkedData

    Data to encrypt

  • hideType Boolean

    Flag to hide the type of the encrypted value when encrypting

Returns:

EcEncryptedValue:

Encrypted value

toEncryptedValueAsync

(
  • d
  • hideType
  • success
  • failure
)
static

Converts a piece of remote linked data to an encrypted value, asynchronously

Parameters:

  • d EcRemoteLinkedData

    Data to encrypt

  • hideType Boolean

    Flag to hide the type of the encrypted value when encrypting

  • success Callback1

    Callback triggered with successfully encrypted, returns the encrypted value

  • failure Callback1

    Callback triggered on error during encryption