scrt-link-core
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -12,3 +12,3 @@ "use strict"; | ||
const createSecret = (message, options = {}, baseUrl = constants_1.baseUrl) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
const { alias = utils_1.generateAlias(), encryptionKey = utils_1.generateEncryptionKey(), password, secretType = "text", neogramDestructionMessage = "This message will self-destruct in…", neogramDestructionTimeout = 3 } = options, rest = tslib_1.__rest(options, ["alias", "encryptionKey", "password", "secretType", "neogramDestructionMessage", "neogramDestructionTimeout"]); | ||
const { alias = utils_1.generateAlias(), encryptionKey = utils_1.generateEncryptionKey(), password, secretType = "text", neogramDestructionMessage = "This message will self-destruct in…", neogramDestructionTimeout = 3, receiptEmail, receiptPhoneNumber, } = options; | ||
if (password) { | ||
@@ -19,6 +19,12 @@ message = utils_1.encryptMessage(message, password); | ||
message = utils_1.encryptMessage(message, encryptionKey); | ||
const data = Object.assign({ alias, | ||
const data = { | ||
alias, | ||
message, | ||
secretType, isEncryptedWithUserPassword: !!password, neogramDestructionMessage, | ||
neogramDestructionTimeout }, rest); | ||
secretType, | ||
isEncryptedWithUserPassword: !!password, | ||
neogramDestructionMessage, | ||
neogramDestructionTimeout, | ||
receiptEmail, | ||
receiptPhoneNumber, | ||
}; | ||
return utils_1.api(`${baseUrl}/api/secrets`, { method: "POST" }, data).then(() => ({ | ||
@@ -25,0 +31,0 @@ alias, |
@@ -1,2 +0,1 @@ | ||
export declare type Maybe<T> = T | undefined | null; | ||
declare type SecretType = "text" | "url" | "neogram"; | ||
@@ -10,13 +9,9 @@ export interface CreateSecretOptions { | ||
password?: string; | ||
} | ||
export interface SecretUrlFields { | ||
alias: string; | ||
secretType: SecretType; | ||
isEncryptedWithUserPassword: boolean; | ||
message: string; | ||
neogramDestructionMessage?: string; | ||
neogramDestructionTimeout?: number; | ||
receiptEmail?: string; | ||
receiptPhoneNumber?: string; | ||
} | ||
export declare type SecretUrlFields = Omit<CreateSecretOptions, "encryptionKey" | "password"> & { | ||
message: string; | ||
isEncryptedWithUserPassword: boolean; | ||
}; | ||
export {}; |
{ | ||
"name": "scrt-link-core", | ||
"version": "0.1.4", | ||
"description": "Core for scrt.link", | ||
"version": "0.1.5", | ||
"description": "Core for scrt.link - a tool to securely share sensitive information online.", | ||
"author": "Chris Chiller <kingchiller@gmail.com>", | ||
@@ -6,0 +6,0 @@ "repository": "https://gitlab.com/kingchiller/scrt-link-core.git", |
@@ -27,3 +27,4 @@ import { baseUrl as defaultBaseUrl } from "./constants"; | ||
neogramDestructionTimeout = 3, | ||
...rest | ||
receiptEmail, | ||
receiptPhoneNumber, | ||
} = options; | ||
@@ -45,3 +46,4 @@ | ||
neogramDestructionTimeout, | ||
...rest, | ||
receiptEmail, | ||
receiptPhoneNumber, | ||
}; | ||
@@ -48,0 +50,0 @@ |
@@ -1,3 +0,1 @@ | ||
export type Maybe<T> = T | undefined | null; | ||
type SecretType = "text" | "url" | "neogram"; | ||
@@ -11,13 +9,12 @@ export interface CreateSecretOptions { | ||
password?: string; | ||
receiptEmail?: string; | ||
receiptPhoneNumber?: string; | ||
} | ||
export interface SecretUrlFields { | ||
alias: string; | ||
secretType: SecretType; | ||
export type SecretUrlFields = Omit< | ||
CreateSecretOptions, | ||
"encryptionKey" | "password" | ||
> & { | ||
message: string; | ||
isEncryptedWithUserPassword: boolean; | ||
message: string; | ||
neogramDestructionMessage?: string; | ||
neogramDestructionTimeout?: number; | ||
receiptEmail?: string; | ||
receiptPhoneNumber?: string; | ||
} | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
711
467139