Home Manual Reference Source
import SyncCryptoAdapter from '@pageproof/sdk/src/adapters/SyncCryptoAdapter.js'
public class | source

SyncCryptoAdapter

Extends:

ICryptoAdapter → SyncCryptoAdapter

Method Summary

Public Methods
public

decryptComment(comment$: string, envelope: string, privateKeyPEM: string): Promise<string>

public

decryptImage(data$: string, privateKeyPEM: string): Promise<string>

public

decryptPrivateKey(privateKey$: string, password: string): Promise<string>

public

encryptFileBlock(keyIV: {key: string, iv: string}, fileBlockBase64: string): Promise<string>

public

encryptPrivateKey(privateKeyPEM: string, password: string): Promise<string>

public

envelopeSeal(secret: string, publicKeyPEMs: Array<string>): Promise<string>

public

envelopeUnseal(envelope: string, privateKeyPEM: string): Promise<string>

public
public
public
public

Inherited Summary

From class ICryptoAdapter
public abstract

decryptComment(comment$: string, envelope: string, privateKeyPEM: string): Promise<string>

public abstract

decryptFileBlock(data$: string, privateKeyPEM: string): Promise<string>

public abstract

decryptImage(data$: string, privateKeyPEM: string): Promise<string>

public abstract

decryptPrivateKey(privateKey$: string, password: string): Promise<string>

public abstract

encryptFileBlock(keyIV: {key: string, iv: string}, fileBlockBase64: string): Promise<string>

public abstract

encryptPrivateKey(privateKeyPEM: string, password: string): Promise<string>

public abstract

envelopeSeal(secret: string, publicKeyPEMs: Array<string>): Promise<string>

public abstract

envelopeUnseal(envelope: string, privateKeyPEM: string): Promise<string>

public abstract
public abstract
public abstract
public abstract

Public Methods

public decryptComment(comment$: string, envelope: string, privateKeyPEM: string): Promise<string> source

Override:

ICryptoAdapter#decryptComment

Params:

NameTypeAttributeDescription
comment$ string

The encrypted comment

envelope string

The comment envelope containing the key

privateKeyPEM string

The user's private key used to decrypt the envelope

Return:

Promise<string>

The original, raw comment text

public decryptImage(data$: string, privateKeyPEM: string): Promise<string> source

Override:

ICryptoAdapter#decryptImage

Params:

NameTypeAttributeDescription
data$ string

The encrypted image (and envelope)

privateKeyPEM string

The user's private key used to decrypt the embedded envelope

Return:

Promise<string>

A base64 representation of the original image

public decryptPrivateKey(privateKey$: string, password: string): Promise<string> source

Override:

ICryptoAdapter#decryptPrivateKey

Params:

NameTypeAttributeDescription
privateKey$ string

The user's encrypted private key

password string

The user's original password, used to decrypt the private key

Return:

Promise<string>

The user's private key (in PEM format)

public encryptFileBlock(keyIV: {key: string, iv: string}, fileBlockBase64: string): Promise<string> source

Override:

ICryptoAdapter#encryptFileBlock

Params:

NameTypeAttributeDescription
keyIV {key: string, iv: string}

The key & iv to encrypt the block with

fileBlockBase64 string

The base64 coded file block

Return:

Promise<string>

The encrypted block, base64 encoded

public encryptPrivateKey(privateKeyPEM: string, password: string): Promise<string> source

Override:

ICryptoAdapter#encryptPrivateKey

Params:

NameTypeAttributeDescription
privateKeyPEM string

The user's private key (in PEM format)

password string

The user's original password, used to encrypt the private key

Return:

Promise<string>

The user's encrypted private key

public envelopeSeal(secret: string, publicKeyPEMs: Array<string>): Promise<string> source

Override:

ICryptoAdapter#envelopeSeal

Params:

NameTypeAttributeDescription
secret string

The secret to seal within an envelope

publicKeyPEMs Array<string>

The list of public keys to encrypt the envelope for

Return:

Promise<string>

The full envelope

public envelopeUnseal(envelope: string, privateKeyPEM: string): Promise<string> source

Override:

ICryptoAdapter#envelopeUnseal

Params:

NameTypeAttributeDescription
envelope string

The full envelope to unseal

privateKeyPEM string

The user's private key (in PEM format), used to decrypt the envelope

Return:

Promise<string>

The secret within the envelope

public generateAuthorizationHeaders(method: string, path: string, session: Session): Promise<Object<string, string>> source

Override:

ICryptoAdapter#generateAuthorizationHeaders

Params:

NameTypeAttributeDescription
method string

The request method/verb (eg. GET, POST)

path string

The endpoint (pathname)

session Session

The Session object used to sign the request

Return:

Promise<Object<string, string>>

The additional headers to add to the request for it to be signed

public generateKeyIV(): Promise<KeyIV> source

Override:

ICryptoAdapter#generateKeyIV

Return:

Promise<KeyIV>

The randomly generated symmetric key and IV

public generateKeyPair(): Promise<KeyPair> source

Override:

ICryptoAdapter#generateKeyPair

Return:

Promise<KeyPair>

The randomly generated asymmetric key pair

public generatePasswordHash(password: string): Promise<string> source

Override:

ICryptoAdapter#generatePasswordHash

Params:

NameTypeAttributeDescription
password string

The user's original password

Return:

Promise<string>

The hashed password