|
1 |
| -if("__TAURI__"in window){var __TAURI_PLUGIN_STRONGHOLD__=function(t){"use strict";async function e(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}"function"==typeof SuppressedError&&SuppressedError;class r{constructor(t,e){this.type=t,this.payload=e}static generic(t,e){return new r("Generic",{vault:t,record:e})}static counter(t,e){return new r("Counter",{vault:t,counter:e})}}class n{constructor(t){this.procedureArgs=t}async generateSLIP10Seed(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Generate",payload:{output:t,sizeBytes:r}}}).then((t=>Uint8Array.from(t)))}async deriveSLIP10(t,r,n,a){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"SLIP10Derive",payload:{chain:t,input:{type:r,payload:n},output:a}}}).then((t=>Uint8Array.from(t)))}async recoverBIP39(t,r,n){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Recover",payload:{mnemonic:t,passphrase:n,output:r}}}).then((t=>Uint8Array.from(t)))}async generateBIP39(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"BIP39Generate",payload:{output:t,passphrase:r}}}).then((t=>Uint8Array.from(t)))}async getEd25519PublicKey(t){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"PublicKey",payload:{type:"Ed25519",privateKey:t}}}).then((t=>Uint8Array.from(t)))}async signEd25519(t,r){return await e("plugin:stronghold|execute_procedure",{...this.procedureArgs,procedure:{type:"Ed25519Sign",payload:{privateKey:t,msg:r}}}).then((t=>Uint8Array.from(t)))}}class a{constructor(t,e){this.path=t,this.name=e}getVault(t){return new o(this.path,this.name,t)}getStore(){return new s(this.path,this.name)}}class s{constructor(t,e){this.path=t,this.client=e}async get(t){return await e("plugin:stronghold|get_store_record",{snapshotPath:this.path,client:this.client,key:t}).then((t=>t&&Uint8Array.from(t)))}async insert(t,r,n){await e("plugin:stronghold|save_store_record",{snapshotPath:this.path,client:this.client,key:t,value:r,lifetime:n})}async remove(t){return await e("plugin:stronghold|remove_store_record",{snapshotPath:this.path,client:this.client,key:t}).then((t=>t&&Uint8Array.from(t)))}}class o extends n{constructor(t,e,r){super({snapshotPath:t,client:e,vault:r}),this.path=t,this.client=e,this.name=r}async insert(t,r){await e("plugin:stronghold|save_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:t,secret:r})}async remove(t){await e("plugin:stronghold|remove_secret",{snapshotPath:this.path,client:this.client,vault:this.name,recordPath:t.payload.record})}}class i{constructor(t){this.path=t}static async load(t,r){return await e("plugin:stronghold|initialize",{snapshotPath:t,password:r}).then((()=>new i(t)))}async unload(){await e("plugin:stronghold|destroy",{snapshotPath:this.path})}async loadClient(t){return await e("plugin:stronghold|load_client",{snapshotPath:this.path,client:t}).then((()=>new a(this.path,t)))}async createClient(t){return await e("plugin:stronghold|create_client",{snapshotPath:this.path,client:t}).then((()=>new a(this.path,t)))}async save(){await e("plugin:stronghold|save",{snapshotPath:this.path})}}return t.Client=a,t.Location=r,t.Store=s,t.Stronghold=i,t.Vault=o,t}({});Object.defineProperty(window.__TAURI__,"stronghold",{value:__TAURI_PLUGIN_STRONGHOLD__})} |
| 1 | +if ('__TAURI__' in window) { |
| 2 | + var __TAURI_PLUGIN_STRONGHOLD__ = (function (t) { |
| 3 | + 'use strict' |
| 4 | + async function e(t, e = {}, r) { |
| 5 | + return window.__TAURI_INTERNALS__.invoke(t, e, r) |
| 6 | + } |
| 7 | + 'function' == typeof SuppressedError && SuppressedError |
| 8 | + class r { |
| 9 | + constructor(t, e) { |
| 10 | + ;(this.type = t), (this.payload = e) |
| 11 | + } |
| 12 | + static generic(t, e) { |
| 13 | + return new r('Generic', { vault: t, record: e }) |
| 14 | + } |
| 15 | + static counter(t, e) { |
| 16 | + return new r('Counter', { vault: t, counter: e }) |
| 17 | + } |
| 18 | + } |
| 19 | + class n { |
| 20 | + constructor(t) { |
| 21 | + this.procedureArgs = t |
| 22 | + } |
| 23 | + async generateSLIP10Seed(t, r) { |
| 24 | + return await e('plugin:stronghold|execute_procedure', { |
| 25 | + ...this.procedureArgs, |
| 26 | + procedure: { |
| 27 | + type: 'SLIP10Generate', |
| 28 | + payload: { output: t, sizeBytes: r } |
| 29 | + } |
| 30 | + }).then((t) => Uint8Array.from(t)) |
| 31 | + } |
| 32 | + async deriveSLIP10(t, r, n, a) { |
| 33 | + return await e('plugin:stronghold|execute_procedure', { |
| 34 | + ...this.procedureArgs, |
| 35 | + procedure: { |
| 36 | + type: 'SLIP10Derive', |
| 37 | + payload: { chain: t, input: { type: r, payload: n }, output: a } |
| 38 | + } |
| 39 | + }).then((t) => Uint8Array.from(t)) |
| 40 | + } |
| 41 | + async recoverBIP39(t, r, n) { |
| 42 | + return await e('plugin:stronghold|execute_procedure', { |
| 43 | + ...this.procedureArgs, |
| 44 | + procedure: { |
| 45 | + type: 'BIP39Recover', |
| 46 | + payload: { mnemonic: t, passphrase: n, output: r } |
| 47 | + } |
| 48 | + }).then((t) => Uint8Array.from(t)) |
| 49 | + } |
| 50 | + async generateBIP39(t, r) { |
| 51 | + return await e('plugin:stronghold|execute_procedure', { |
| 52 | + ...this.procedureArgs, |
| 53 | + procedure: { |
| 54 | + type: 'BIP39Generate', |
| 55 | + payload: { output: t, passphrase: r } |
| 56 | + } |
| 57 | + }).then((t) => Uint8Array.from(t)) |
| 58 | + } |
| 59 | + async getEd25519PublicKey(t) { |
| 60 | + return await e('plugin:stronghold|execute_procedure', { |
| 61 | + ...this.procedureArgs, |
| 62 | + procedure: { |
| 63 | + type: 'PublicKey', |
| 64 | + payload: { type: 'Ed25519', privateKey: t } |
| 65 | + } |
| 66 | + }).then((t) => Uint8Array.from(t)) |
| 67 | + } |
| 68 | + async signEd25519(t, r) { |
| 69 | + return await e('plugin:stronghold|execute_procedure', { |
| 70 | + ...this.procedureArgs, |
| 71 | + procedure: { type: 'Ed25519Sign', payload: { privateKey: t, msg: r } } |
| 72 | + }).then((t) => Uint8Array.from(t)) |
| 73 | + } |
| 74 | + } |
| 75 | + class a { |
| 76 | + constructor(t, e) { |
| 77 | + ;(this.path = t), (this.name = e) |
| 78 | + } |
| 79 | + getVault(t) { |
| 80 | + return new o(this.path, this.name, t) |
| 81 | + } |
| 82 | + getStore() { |
| 83 | + return new s(this.path, this.name) |
| 84 | + } |
| 85 | + } |
| 86 | + class s { |
| 87 | + constructor(t, e) { |
| 88 | + ;(this.path = t), (this.client = e) |
| 89 | + } |
| 90 | + async get(t) { |
| 91 | + return await e('plugin:stronghold|get_store_record', { |
| 92 | + snapshotPath: this.path, |
| 93 | + client: this.client, |
| 94 | + key: t |
| 95 | + }).then((t) => t && Uint8Array.from(t)) |
| 96 | + } |
| 97 | + async insert(t, r, n) { |
| 98 | + await e('plugin:stronghold|save_store_record', { |
| 99 | + snapshotPath: this.path, |
| 100 | + client: this.client, |
| 101 | + key: t, |
| 102 | + value: r, |
| 103 | + lifetime: n |
| 104 | + }) |
| 105 | + } |
| 106 | + async remove(t) { |
| 107 | + return await e('plugin:stronghold|remove_store_record', { |
| 108 | + snapshotPath: this.path, |
| 109 | + client: this.client, |
| 110 | + key: t |
| 111 | + }).then((t) => t && Uint8Array.from(t)) |
| 112 | + } |
| 113 | + } |
| 114 | + class o extends n { |
| 115 | + constructor(t, e, r) { |
| 116 | + super({ snapshotPath: t, client: e, vault: r }), |
| 117 | + (this.path = t), |
| 118 | + (this.client = e), |
| 119 | + (this.name = r) |
| 120 | + } |
| 121 | + async insert(t, r) { |
| 122 | + await e('plugin:stronghold|save_secret', { |
| 123 | + snapshotPath: this.path, |
| 124 | + client: this.client, |
| 125 | + vault: this.name, |
| 126 | + recordPath: t, |
| 127 | + secret: r |
| 128 | + }) |
| 129 | + } |
| 130 | + async remove(t) { |
| 131 | + await e('plugin:stronghold|remove_secret', { |
| 132 | + snapshotPath: this.path, |
| 133 | + client: this.client, |
| 134 | + vault: this.name, |
| 135 | + recordPath: t.payload.record |
| 136 | + }) |
| 137 | + } |
| 138 | + } |
| 139 | + class i { |
| 140 | + constructor(t) { |
| 141 | + this.path = t |
| 142 | + } |
| 143 | + static async load(t, r) { |
| 144 | + return await e('plugin:stronghold|initialize', { |
| 145 | + snapshotPath: t, |
| 146 | + password: r |
| 147 | + }).then(() => new i(t)) |
| 148 | + } |
| 149 | + async unload() { |
| 150 | + await e('plugin:stronghold|destroy', { snapshotPath: this.path }) |
| 151 | + } |
| 152 | + async loadClient(t) { |
| 153 | + return await e('plugin:stronghold|load_client', { |
| 154 | + snapshotPath: this.path, |
| 155 | + client: t |
| 156 | + }).then(() => new a(this.path, t)) |
| 157 | + } |
| 158 | + async createClient(t) { |
| 159 | + return await e('plugin:stronghold|create_client', { |
| 160 | + snapshotPath: this.path, |
| 161 | + client: t |
| 162 | + }).then(() => new a(this.path, t)) |
| 163 | + } |
| 164 | + async save() { |
| 165 | + await e('plugin:stronghold|save', { snapshotPath: this.path }) |
| 166 | + } |
| 167 | + } |
| 168 | + return ( |
| 169 | + (t.Client = a), |
| 170 | + (t.Location = r), |
| 171 | + (t.Store = s), |
| 172 | + (t.Stronghold = i), |
| 173 | + (t.Vault = o), |
| 174 | + t |
| 175 | + ) |
| 176 | + })({}) |
| 177 | + Object.defineProperty(window.__TAURI__, 'stronghold', { |
| 178 | + value: __TAURI_PLUGIN_STRONGHOLD__ |
| 179 | + }) |
| 180 | +} |
0 commit comments