diff --git a/src/components/create.vue b/src/components/create.vue index 2f1e321..e6ee2a5 100644 --- a/src/components/create.vue +++ b/src/components/create.vue @@ -80,6 +80,7 @@ /* global maxSecretExpire */ import appCrypto from '../crypto.js' +import OTSMeta from '../ots-meta' const defaultExpiryChoices = [ 90 * 86400, // 90 days @@ -164,7 +165,12 @@ export default { this.securePassword = [...window.crypto.getRandomValues(new Uint8Array(passwordLength))] .map(n => passwordCharset[n % passwordCharset.length]) .join('') - appCrypto.enc(this.secret, this.securePassword) + + const meta = new OTSMeta() + meta.secret = this.secret + + meta.serialize() + .then(secret => appCrypto.enc(secret, this.securePassword)) .then(secret => { let reqURL = 'api/create' if (this.selectedExpiry !== null) { diff --git a/src/components/secret-display.vue b/src/components/secret-display.vue index a0c5b72..3cbb3fd 100644 --- a/src/components/secret-display.vue +++ b/src/components/secret-display.vue @@ -49,6 +49,7 @@ import appClipboardButton from './clipboard-button.vue' import appCrypto from '../crypto.js' import appQrButton from './qr-button.vue' +import OTSMeta from '../ots-meta' export default { components: { appClipboardButton, appQrButton }, @@ -89,11 +90,10 @@ export default { appCrypto.dec(secret, this.securePassword) .then(secret => { - this.secret = secret - }) - .catch(() => { - this.$emit('error', this.$t('alert-something-went-wrong')) + const meta = new OTSMeta(secret) + this.secret = meta.secret }) + .catch(() => this.$emit('error', this.$t('alert-something-went-wrong'))) }) }) .catch(() => {