Home Manual Reference Source
public class | source

ICryptoAdapter

Method Summary

Public Methods
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 abstract decryptComment(comment$: string, envelope: string, privateKeyPEM: string): Promise<string> source

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 abstract decryptFileBlock(data$: string, privateKeyPEM: string): Promise<string> source

Params:

NameTypeAttributeDescription
data$ string

The encrypted file block (and envelope)

privateKeyPEM string

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

Return:

Promise<string>

A base64 representation of the original block

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

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 abstract decryptPrivateKey(privateKey$: string, password: string): Promise<string> source

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 abstract encryptFileBlock(keyIV: {key: string, iv: string}, fileBlockBase64: string): Promise<string> source

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 abstract encryptPrivateKey(privateKeyPEM: string, password: string): Promise<string> source

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 abstract envelopeSeal(secret: string, publicKeyPEMs: Array<string>): Promise<string> source

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 abstract envelopeUnseal(envelope: string, privateKeyPEM: string): Promise<string> source

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 abstract generateAuthorizationHeaders(method: string, path: string, session: Session): Promise<Object<string, string>> source

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 abstract generateKeyIV(): Promise<KeyIV> source

Return:

Promise<KeyIV>

The randomly generated symmetric key and IV

public abstract generateKeyPair(): Promise<KeyPair> source

Return:

Promise<KeyPair>

The randomly generated asymmetric key pair

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

Params:

NameTypeAttributeDescription
password string

The user's original password

Return:

Promise<string>

The hashed password