From 6ef69d697a24720c0f8d787c4258e99e02dc0b79 Mon Sep 17 00:00:00 2001 From: Dendi Suhubdy <4477337+dendisuhubdy@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:26:16 +0800 Subject: [PATCH] =?UTF-8?q?wallet:=20deriveKey=20=E2=80=94=20an=20origin-b?= =?UTF-8?q?ound=20key=20a=20site=20can=20ask=20for=20(perps=20trading=20ke?= =?UTF-8?q?ys=20on=20durian.market)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit window.rand.deriveKey({ purpose }) → { key }: 32 bytes (64 lowercase hex) derived in the background by HKDF-SHA-256 (WebCrypto) from the wallet's spend key, salt "rand-wallet/site-key/v1", info = length-prefixed (domain, sender origin, purpose, connected address). Same wallet + origin + purpose gives the same key on any device restored from the same key; another origin, purpose or wallet gives an unrelated one. The viewing key (which provers receive) is never an input. Policy beside connect/invoke in provider-host.js: connected origin (NOT_CONNECTED), unlocked (LOCKED), purpose ^[a-z0-9./-]{1,64}$ (BAD_REQUEST); the first request per (origin, purpose) is parked like an invoke (shared BUSY rule) and approved in derive.html; the yes is stored as sites[origin].siteKeys[purpose] = {address, at} and later requests answer at once; disconnect forgets it; Reject or a closed window is USER_REJECTED. The key is in no store and no message but the answer to the asking frame; the window hears only {ok: true}. inpage.js adds deriveKey; content.js relays the method and its purpose string only. New lib/derive-key.js (classic script; Chrome importScripts, Firefox background.scripts) with a pinned vector recomputed by node:crypto. Nine new window strings in all twenty languages. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YGaYNNSAAQZWcccfnqCmLS --- extension/README.md | 36 ++++- extension/shared/background.js | 16 +- extension/shared/content.js | 16 +- extension/shared/derive.html | 18 +++ extension/shared/derive.js | 113 +++++++++++++ extension/shared/inpage.js | 17 +- extension/shared/lib/derive-key.js | 87 ++++++++++ extension/shared/provider-host.js | 123 +++++++++++++- extension/test/background.test.mjs | 10 +- extension/test/content-relay.test.mjs | 24 +++ extension/test/derive-key.test.mjs | 98 +++++++++++ extension/test/provider-host.test.mjs | 225 ++++++++++++++++++++++++++ extension/test/smoke.mjs | 2 + firefox/manifest.json | 1 + ui/locales/ar.js | 9 ++ ui/locales/de.js | 9 ++ ui/locales/en.js | 11 +- ui/locales/es.js | 9 ++ ui/locales/fa.js | 9 ++ ui/locales/fr.js | 9 ++ ui/locales/hi.js | 9 ++ ui/locales/id.js | 9 ++ ui/locales/it.js | 9 ++ ui/locales/ja.js | 9 ++ ui/locales/ko.js | 9 ++ ui/locales/ms.js | 9 ++ ui/locales/pl.js | 9 ++ ui/locales/ps.js | 9 ++ ui/locales/pt.js | 9 ++ ui/locales/ru.js | 9 ++ ui/locales/ta.js | 9 ++ ui/locales/ur.js | 9 ++ ui/locales/zh-hk.js | 9 ++ ui/locales/zh.js | 9 ++ 34 files changed, 946 insertions(+), 22 deletions(-) create mode 100644 extension/shared/derive.html create mode 100644 extension/shared/derive.js create mode 100644 extension/shared/lib/derive-key.js create mode 100644 extension/test/derive-key.test.mjs diff --git a/extension/README.md b/extension/README.md index fbc03f46..d9fb43e9 100644 --- a/extension/README.md +++ b/extension/README.md @@ -99,10 +99,10 @@ A Rand site — randbridge.org, and a local build of it — sees this wallet as contract in randbridge.org/web/lib/rand/provider.ts. Three files, each in its own world: - `inpage.js` runs in the page's own world (`world: "MAIN"`, document_start) and defines the - object: `connect`, `getAddress`, `getRecipientHash`, `invoke`, `withdraw`, `disconnect`, `on`, plus the + object: `connect`, `getAddress`, `getRecipientHash`, `invoke`, `withdraw`, `deriveKey`, `disconnect`, `on`, plus the `rand:announceProvider` / `rand:requestProvider` handshake. It knows nothing and can reach nothing. -- `content.js` relays those six method names — and none of the page's data except an `invoke`'s - or a `withdraw`'s request — to the background. +- `content.js` relays those seven method names — and none of the page's data except an `invoke`'s + or a `withdraw`'s request and a `deriveKey`'s `purpose` string — to the background. - `provider-host.js`, loaded by `background.js`, decides from the *sender's* origin: `connect` needs a wallet, unlocked, and the user's yes in `connect.html` for that origin; the approval (address plus its bridge recipient hash, `lib/recipient-hash.js`) is stored under `sites` in @@ -113,6 +113,36 @@ contract in randbridge.org/web/lib/rand/provider.ts. Three files, each in its ow a refusal or a closed window tells the site only that nothing was sent. `node --test extension/test/provider-host.test.mjs` is the policy's suite; `recipient-hash.test.mjs` pins the hash to the bridge's own fixture. +### `deriveKey` — a key of the site's own + +`window.rand.deriveKey({ purpose }) → Promise<{ key }>` gives a site a key it can use to act for +itself — durian.market signs the orders of its own trading account with it — so "sign in with the +wallet" needs no password and nothing new to back up. `key` is 32 bytes as 64 lowercase hex. + +- **Policy** (provider-host.js): the origin must already be connected (else `NOT_CONNECTED`) and + the wallet unlocked (else `LOCKED`; `NO_WALLET` with no wallet at all); `purpose` must match + `^[a-z0-9./-]{1,64}$` (else `BAD_REQUEST`). The first request for an (origin, purpose) opens + derive.html, which says which site asks, that it asks for a key it can use to act for itself, + that it gets the same key every time and no other site gets it, and that the key gives no access + to the wallet's funds, notes or address keys. Approve stores the yes under the site's entry in + `sites` (`siteKeys[purpose] = {address, at}`), tied to the address it was given for; later + requests answer at once. `disconnect` deletes the site's entry and so the yes with it, and a + new wallet's connect replaces the entry. Reject or a closed window is `USER_REJECTED`; a request + while another of the site's requests (of any kind) is waiting is `BUSY`. +- **Derivation** (lib/derive-key.js, WebCrypto in the background): + `HKDF-SHA-256(IKM = the spend key's 32 bytes, salt = "rand-wallet/site-key/v1", + info = LP("rand-wallet/site-key/v1") ‖ LP(origin) ‖ LP(purpose) ‖ LP(address), L = 32)`, where + LP is a 4-byte big-endian length then the UTF-8 bytes. `origin` is the *sender's* + (`URL.origin`: scheme, host, and a port only when it is not the default) — never a value from + the page; `address` is the connected `rand1…` address. The spend key is the wallet's root + secret, the one thing a backup holds, so a wallet restored on another device gives every site + the same key again; the viewing key, which a prover is given, is never an input. HKDF is one-way: + the key says nothing about the spend key, nor about the key of any other site, purpose or + wallet. `extension/test/derive-key.test.mjs` pins a vector and recomputes it with node:crypto. +- **What a site learns**: its own key, for the purposes the user approved, and nothing else. The + key is made when it is answered and is in no store and in no other message — not the window's, + not storage's, only the answer to the frame that asked. + When the extension itself is reloaded — a store update, or Reload at chrome://extensions on an unpacked build — the browser orphans `content.js` in every tab that has it and never puts a new one in, so every open bridge tab would answer "Rand Wallet did not respond" until reloaded. So diff --git a/extension/shared/background.js b/extension/shared/background.js index f4a63564..1cd4834b 100644 --- a/extension/shared/background.js +++ b/extension/shared/background.js @@ -113,9 +113,11 @@ ext.runtime.onStartup?.addListener(() => {}); // ---- the page provider (`window.rand`) ---- // -// inpage.js/content.js relay a Rand site's requests here; provider-host.js decides. Chrome's -// service worker pulls that file in with importScripts; Firefox's event page lists it before this -// one in the manifest's `background.scripts`, so the factory is already on the global there. +// inpage.js/content.js relay a Rand site's requests here; provider-host.js decides, and +// lib/derive-key.js makes the key a site's `deriveKey` gets. Chrome's service worker pulls both in +// with importScripts; Firefox's event page lists them before this one in the manifest's +// `background.scripts`, so they are already on the global there. +if (typeof importScripts === 'function' && typeof globalThis.RandSiteKey !== 'object') importScripts('lib/derive-key.js'); if (typeof importScripts === 'function' && typeof globalThis.makeRandProviderHost !== 'function') importScripts('provider-host.js'); const providerHost = globalThis.makeRandProviderHost({ @@ -142,6 +144,14 @@ const providerHost = globalThis.makeRandProviderHost({ const win = await ext.windows.create({ url: ext.runtime.getURL(`withdraw.html?${query}`), type: 'popup', width: 400, height: 660 }); return win && Number.isInteger(win.id) ? win.id : null; }, + // The approval window for a site's first `deriveKey` of a purpose (derive.html): one yes or no, + // but parked and answered like an invoke's, so closing it answers the site (`windowClosed`). + openDerive: async ({ id, origin }) => { + const query = new URLSearchParams({ id, origin }); + const win = await ext.windows.create({ url: ext.runtime.getURL(`derive.html?${query}`), type: 'popup', width: 380, height: 600 }); + return win && Number.isInteger(win.id) ? win.id : null; + }, + deriveSiteKey: globalThis.RandSiteKey && globalThis.RandSiteKey.deriveSiteKey, }); ext.windows?.onRemoved?.addListener((windowId) => { void providerHost.windowClosed(windowId); }); diff --git a/extension/shared/content.js b/extension/shared/content.js index c879e0bd..a56f4c9e 100644 --- a/extension/shared/content.js +++ b/extension/shared/content.js @@ -1,6 +1,7 @@ // The relay between the page's `window.rand` (inpage.js, in the page's world) and the extension -// (background.js). Isolated world, classic script, no imports. It forwards exactly six method -// names, and nothing the page put in the message except the request of `invoke` or `withdraw`: +// (background.js). Isolated world, classic script, no imports. It forwards exactly seven method +// names, and nothing the page put in the message except the request of `invoke` or `withdraw` +// and the `purpose` string of `deriveKey` (that one field, at most `MAX_PURPOSE_CHARS`): // the background decides everything else from who is asking (`sender`), never from what they // said, and that request is data the user is shown and approves in the wallet's own window, // capped here at `MAX_INVOKE_CHARS` of JSON. A connect or an invoke that needs the user comes back as @@ -26,7 +27,9 @@ const FROM_PAGE = 'rand-wallet:page'; const TO_PAGE = 'rand-wallet:content'; const TAKEOVER = 'rand-wallet:content-takeover'; - const METHODS = new Set(['connect', 'getAddress', 'getRecipientHash', 'disconnect', 'invoke', 'withdraw']); + const METHODS = new Set(['connect', 'getAddress', 'getRecipientHash', 'disconnect', 'invoke', 'withdraw', 'deriveKey']); + /** The background checks a purpose in full (`^[a-z0-9./-]{1,64}$`); here only its type and length. */ + const MAX_PURPOSE_CHARS = 64; /** An invoke request (a withdraw's is smaller still) is a few kilobytes (eight cells, a few dozen input words); 256 KiB of JSON * is far past any real one and well short of a page using the relay to push megabytes. */ const MAX_INVOKE_CHARS = 256 * 1024; @@ -59,6 +62,13 @@ return; } msg.params = d.params; + } else if (d.method === 'deriveKey') { + const purpose = d.params && typeof d.params === 'object' ? d.params.purpose : undefined; + if (typeof purpose !== 'string' || purpose.length > MAX_PURPOSE_CHARS) { + reply(d.id, { ok: false, error: { code: 'BAD_REQUEST', message: 'Rand Wallet could not read that request.' } }); + return; + } + msg.params = { purpose }; } let res, why = ''; try { res = await ext.runtime.sendMessage(msg); } catch (e) { res = null; why = String((e && e.message) || e); } diff --git a/extension/shared/derive.html b/extension/shared/derive.html new file mode 100644 index 00000000..eff23ad3 --- /dev/null +++ b/extension/shared/derive.html @@ -0,0 +1,18 @@ + + + + + + + +Approve in Rand Wallet + + + + + + + + diff --git a/extension/shared/derive.js b/extension/shared/derive.js new file mode 100644 index 00000000..8ae8d49d --- /dev/null +++ b/extension/shared/derive.js @@ -0,0 +1,113 @@ +// The approval window for a site's first `deriveKey` of a purpose: " asks Rand Wallet for a +// key of its own". One yes or no, sent to background.js as a `rand:deriveResult`, which stores the +// yes, makes the key and gives it to the asking tab. This window never sees the key: the +// background answers it `{ok: true}` and nothing more. +// +// The request is read from the background by id (`rand:deriveRequest`), as invoke.js reads its +// own: nothing in the URL is trusted beyond the id, so the site shown is the origin the background +// recorded from the message's sender. Closing the window is a no (background.js `windowClosed`). +// Everything shown is built from DOM nodes and textContent: the origin and the purpose are data, +// never markup. +// +// No app.js here, so the language is this page's own job (lib/window-locale.js), as in connect.js: +// the wallet's `settings.locale` is read straight from storage and nothing is rendered before the +// dictionary is in force. Every string shown goes through `t()`. +import { ext } from './lib/browser.js'; +import { applyWindowLocale, sentenceWith } from './lib/window-locale.js'; +import { markSvg } from './ui/lib/entropy.js'; +import { t } from './ui/i18n.js'; + +const id = new URLSearchParams(location.search).get('id') || ''; + +const el = (tag, className, text) => { + const node = document.createElement(tag); + if (className) node.className = className; + if (text != null) node.textContent = text; + return node; +}; + +/** The wallet's language setting, from the settings the engine keeps under `settings`; nothing when unset. */ +async function localeSetting() { + try { + const bag = await ext.storage.local.get('settings'); + const settings = bag && bag.settings; + return settings && typeof settings === 'object' ? settings.locale : undefined; + } catch { return undefined; } +} + +const root = el('div', 'app'); +let answered = false; +async function answer(approved) { + if (answered) return; + answered = true; + try { await ext.runtime.sendMessage({ type: 'rand:deriveResult', id, approved }); } catch { /* closing answers for us */ } + window.close(); +} + +function shell(titleText, subText) { + root.replaceChildren(); + const box = el('div', 'onboard'); + const mark = el('span', 'mark-lg bare'); + // Our own SVG, no user data in it — parsed rather than assigned to innerHTML. + mark.append(new DOMParser().parseFromString(markSvg(), 'image/svg+xml').documentElement); + const head = el('div', 'stack tight'); + const title = el('h1', 'title', titleText); + const sub = el('p', 'subtitle'); + if (subText != null) sub.append(subText); + head.append(title, sub); + box.append(mark, head); + root.append(box); + return box; +} + +function nothing(reason) { + const box = shell(t('Nothing to approve'), reason); + const actions = el('div', 'onboard-actions'); + const close = el('button', 'btn block', t('Close')); + close.type = 'button'; + close.addEventListener('click', () => window.close()); + actions.append(close); + box.append(actions); +} + +function review({ origin, purpose }) { + let host = origin; + try { host = new URL(origin).host; } catch { host = origin || t('A site'); } + const box = shell(t('Give this site a key?'), sentenceWith(t('{host} asks Rand Wallet for a key of its own.'), 'host', el('strong', null, host))); + const card = el('div', 'card'); + for (const [k, v] of [[t('Site'), origin], [t('Purpose'), purpose]]) { + const kv = el('div', 'kv'); + kv.append(el('span', 'k', k), el('span', 'v mono', v)); + card.append(kv); + } + const what = el('p', 'caption pitch', t('The site can use the key to act for you on that site, for example to sign trades in your trading account there.') + ' ' + + t('Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.')); + const safe = el('p', 'caption pitch', t('The key gives no access to this wallet’s funds, notes or address keys.') + ' ' + + t('You are asked once for each purpose; disconnecting the site forgets your answer.')); + const actions = el('div', 'onboard-actions'); + const yes = el('button', 'btn btn-primary block', t('Approve')); + yes.type = 'button'; + const no = el('button', 'btn block', t('Reject')); + no.type = 'button'; + yes.addEventListener('click', () => { void answer(true); }); + no.addEventListener('click', () => { void answer(false); }); + actions.append(yes, no); + box.append(card, what, safe, actions); + yes.focus(); +} + +(async () => { + await applyWindowLocale(await localeSetting()); + document.title = t('Approve in Rand Wallet'); + document.body.append(root); + if (!id) { nothing(t('This window was not opened by a site.')); return; } + shell(t('Reading the request…'), null); + let res = null; + try { res = await ext.runtime.sendMessage({ type: 'rand:deriveRequest', id }); } catch { /* shown as gone */ } + const r = res && res.ok && res.result; + if (!r || typeof r.origin !== 'string' || !r.request || typeof r.request.purpose !== 'string') { + nothing(t('That request is no longer waiting.')); + return; + } + review({ origin: r.origin, purpose: r.request.purpose }); +})(); diff --git a/extension/shared/inpage.js b/extension/shared/inpage.js index 9f124f13..eb976601 100644 --- a/extension/shared/inpage.js +++ b/extension/shared/inpage.js @@ -7,11 +7,14 @@ // `invoke(request) → {tx}`, an RPL-2 program call (durian.market's `web/lib/rand/provider.ts`), // which the user approves in the wallet's own window before anything is proved, and // `withdraw(request) → {tx}`, a bridge burn (randbridge.org), approved the same way, whose proof -// phases arrive as `withdrawPhase` events while it works. +// phases arrive as `withdrawPhase` events while it works, and `deriveKey({purpose}) → {key}`, a +// key of the site's own (durian.market's trading key), derived by the extension from this wallet, +// this origin and the purpose, after the user has said yes once to that origin and purpose. // -// What is never here: keys, balances, notes, signing. The extension answers with the address and +// What is never here: the wallet's keys, balances, notes, signing. The extension answers with the address and // its bridge recipient hash, after the user has said yes to this origin, and — for an `invoke` or `withdraw` the -// user approved — the transaction hash and the phase it has reached; nothing else. +// user approved — the transaction hash and the phase it has reached, and for a `deriveKey` the +// user approved, the site's own key; nothing else. (() => { if (window.rand && window.rand.isRandWallet) return; const TO_CONTENT = 'rand-wallet:page'; @@ -70,6 +73,14 @@ } return request('withdraw', params); }, + // A key of this site's own, for `purpose` (1–64 of a-z 0-9 . / -): the same 32 bytes (hex) + // every time for this wallet and this site, and to no other site. Only the purpose string is + // sent; the site is the page's origin as the extension sees it. + deriveKey: (req) => { + const purpose = req && typeof req === 'object' ? req.purpose : undefined; + if (typeof purpose !== 'string') return Promise.reject(refused('BAD_REQUEST', 'Rand Wallet could not read that request.')); + return request('deriveKey', { purpose }); + }, disconnect: () => request('disconnect').then(() => { emit('disconnect', null); }), on(event, cb) { if (!listeners[event] || typeof cb !== 'function') return () => {}; diff --git a/extension/shared/lib/derive-key.js b/extension/shared/lib/derive-key.js new file mode 100644 index 00000000..5f728ecb --- /dev/null +++ b/extension/shared/lib/derive-key.js @@ -0,0 +1,87 @@ +// The key a site gets from `window.rand.deriveKey({purpose})`: 32 bytes, bound to this wallet, to +// the site that asked, to what it asked for and to the address it is connected with. A classic +// script, like provider-host.js, so the background can load it in both browsers (Chrome's service +// worker by importScripts, Firefox's event page from the manifest's `scripts` list); it puts one +// frozen object on the global, `RandSiteKey`, and imports nothing. +// +// ---- the construction (a second implementation reproduces it from this alone) ---- +// +// key = HKDF-SHA-256(IKM = the wallet's spend key, its 32 bytes (the 64 hex characters the +// core writes, decoded), +// salt = UTF-8("rand-wallet/site-key/v1"), +// info = LP("rand-wallet/site-key/v1") || LP(origin) || LP(purpose) || LP(address), +// L = 32) +// +// where LP(s) is the UTF-8 bytes of s preceded by their length as a 4-byte big-endian integer, so +// no two different (origin, purpose, address) can give the same info. `origin` is the asking page's +// web origin exactly as `URL.origin` writes it (scheme://host, and :port only when it is not the +// scheme's default) — the background takes it from the message's sender, never from the page; +// `purpose` matches PURPOSE_RE; `address` is the wallet's `rand1…` address the site is connected +// with. The key is returned as 64 lowercase hex characters. +// +// ---- why the spend key, and why it is safe ---- +// +// The spend key is the wallet's root secret: it is what a backup (the key file) holds and what an +// import restores, so the same wallet gives the same site key on every device, with nothing new to +// back up. It is also the one secret only this wallet holds — the viewing key is not, since a +// prover that makes a proof for this wallet is given it, so it is never an input here. HKDF is +// one-way: the site key reveals nothing about the spend key, and a key for one (origin, purpose, +// address) says nothing about the key for any other. The spend key is never published on chain +// (it is a private witness inside the wallet's own proofs), and the domain string makes this +// derivation's outputs unrelated to anything else ever computed from it. +(function (root) { + const DOMAIN = 'rand-wallet/site-key/v1'; + const PURPOSE_RE = /^[a-z0-9./-]{1,64}$/; + const SPEND_KEY_RE = /^[0-9a-fA-F]{64}$/; + const utf8 = (s) => new TextEncoder().encode(s); + + /** LP(field) for each field, concatenated. */ + function lengthPrefixed(fields) { + const parts = fields.map(utf8); + const out = new Uint8Array(parts.reduce((n, p) => n + 4 + p.length, 0)); + const view = new DataView(out.buffer); + let at = 0; + for (const p of parts) { + view.setUint32(at, p.length, false); + out.set(p, at + 4); + at += 4 + p.length; + } + return out; + } + + /** HKDF's info for these inputs (exported for the test vector). */ + function siteKeyInfo({ origin, purpose, address }) { + return lengthPrefixed([DOMAIN, origin, purpose, address]); + } + + /** An http(s) origin in URL.origin's own spelling, and nothing else. */ + function isWebOrigin(origin) { + if (typeof origin !== 'string' || !origin) return false; + try { + const u = new URL(origin); + return /^https?:$/.test(u.protocol) && u.origin === origin; + } catch { return false; } + } + + /** → Promise<64 lowercase hex>. Throws on any input that is not what the wallet would pass. */ + async function deriveSiteKey({ spendKey, origin, purpose, address }) { + if (typeof spendKey !== 'string' || !SPEND_KEY_RE.test(spendKey)) throw new Error('site key: not a spend key'); + if (!isWebOrigin(origin)) throw new Error('site key: not a web origin'); + if (typeof purpose !== 'string' || !PURPOSE_RE.test(purpose)) throw new Error('site key: bad purpose'); + if (typeof address !== 'string' || !address) throw new Error('site key: no address'); + const ikm = new Uint8Array(32); + for (let i = 0; i < 32; i++) ikm[i] = parseInt(spendKey.slice(2 * i, 2 * i + 2), 16); + let bits; + try { + const base = await crypto.subtle.importKey('raw', ikm, 'HKDF', false, ['deriveBits']); + bits = await crypto.subtle.deriveBits( + { name: 'HKDF', hash: 'SHA-256', salt: utf8(DOMAIN), info: siteKeyInfo({ origin, purpose, address }) }, + base, 256); + } finally { + ikm.fill(0); // best effort: the copy this function made + } + return Array.from(new Uint8Array(bits), (b) => b.toString(16).padStart(2, '0')).join(''); + } + + root.RandSiteKey = Object.freeze({ DOMAIN, PURPOSE_RE, deriveSiteKey, siteKeyInfo }); +})(globalThis); diff --git a/extension/shared/provider-host.js b/extension/shared/provider-host.js index 9c365eda..17ca3b3c 100644 --- a/extension/shared/provider-host.js +++ b/extension/shared/provider-host.js @@ -2,7 +2,7 @@ // background.js can load it in both browsers (Chrome's service worker via importScripts, Firefox's // event page from the manifest's `scripts` list). It puts one factory on the global: // -// makeRandProviderHost({ ext, openConsent, openInvoke, openWithdraw }) → { handle(msg, sender), windowClosed(id) } +// makeRandProviderHost({ ext, openConsent, openInvoke, openWithdraw, openDerive }) → { handle(msg, sender), windowClosed(id) } // // What a site can learn, and when: // * `connect` — the address, once the user has approved THIS origin in the consent window @@ -28,12 +28,24 @@ // burn on the user. The window's proof phases are also forwarded to the // asking tab (`rand:phase`), display only, for the site's progress view. // A window of one kind cannot read or answer the other kind's record. +// * `deriveKey` — a key of the site's own (durian.market's trading key): 32 bytes derived by +// lib/derive-key.js from this wallet's spend key, the SENDER's origin, the +// request's `purpose` and the connected address — so the same wallet gives +// a site the same key on any device, and no other site that key. For an +// origin already approved and a wallet that is unlocked. The first request for +// an (origin, purpose) is parked like an invoke (`kind: 'derive'`, so the +// one-request-per-site rule covers it too) and approved in derive.html; the +// yes is kept under the site's entry (`siteKeys[purpose]`, with the address it +// was given for), and later requests answer at once. The key itself is +// computed when it is answered and is in no store and no other message: not +// the window's, not storage's — only the answer to the tab that asked. // What a site is told when the wallet refuses: a code and a FIXED sentence for that code // (`SITE_ERRORS`, the same table as lib/site-errors.js), never the window's own reason, which can // name a balance, a note's value or the user's own prover host. A window's answer is re-worded // here whatever it says, so nothing the window computed but the code and the hash reaches a page. // The origin is always `sender`'s — the page's own message carries no parameters at all except an -// invoke's or a withdraw's request, which is the thing the user is asked to approve and nothing else. An +// invoke's or a withdraw's request, which is the thing the user is asked to approve and nothing else, +// and a deriveKey's `purpose`. An // approval is tied to the address it was given for: import a different wallet and every site is // disconnected until it asks again. Approvals live in storage.local under `sites`, so a wipe // clears them with the rest. @@ -44,7 +56,7 @@ const SITES_KEY = 'sites'; const WALLET_KEY = 'wallet'; // ui/engine/backend-shared.js K.wallet: {address, pk} const UNLOCKED_KEY = 'unlocked'; // its UNLOCKED_SESSION_KEY, in storage.session - const INVOKES_KEY = 'invokes'; // storage.session: id → {kind, origin, tabId, request, windowId, phase, at}; no kind reads as 'invoke' + const INVOKES_KEY = 'invokes'; // storage.session: id → {kind, origin, tabId, frameId?, request, windowId, phase, at}; no kind reads as 'invoke' const HEX32_RE = /^[0-9a-fA-F]{64}$/; const AMOUNT_RE = /^[1-9][0-9]{0,29}$/; const WORD8_RE = /^(0x)?[0-9a-fA-F]{64}$/; @@ -93,7 +105,7 @@ const fail = (code, message) => ({ ok: false, error: { code, message } }); const one = (bag, key) => (bag && Object.prototype.hasOwnProperty.call(bag, key) ? bag[key] : undefined); - function makeRandProviderHost({ ext, openConsent, openInvoke, openWithdraw, newId }) { + function makeRandProviderHost({ ext, openConsent, openInvoke, openWithdraw, openDerive, deriveSiteKey, newId }) { const local = ext.storage.local; const session = ext.storage.session; const id = newId || (() => (globalThis.crypto && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random()}`)); @@ -152,7 +164,7 @@ const rootUrl = extensionRoot(); return !!rootUrl && !!sender && typeof sender.url === 'string' && sender.url.startsWith(rootUrl); }; - const kindOf = (rec) => (rec && rec.kind === 'withdraw' ? 'withdraw' : 'invoke'); + const kindOf = (rec) => (rec && (rec.kind === 'withdraw' || rec.kind === 'derive') ? rec.kind : 'invoke'); /** Answer the tab that asked, and forget the request. Idempotent: a second answer finds nothing. */ async function settle(invokeId, verdict) { const all = await invokes(); @@ -161,7 +173,9 @@ delete all[invokeId]; await saveInvokes(all); if (Number.isInteger(rec.tabId)) { - try { await ext.tabs.sendMessage(rec.tabId, { type: 'rand:decision', id: invokeId, ...verdict }); } catch { /* the tab is gone */ } + // A key request remembers the frame that asked, and its answer goes to that frame only. + const to = Number.isInteger(rec.frameId) ? [{ frameId: rec.frameId }] : []; + try { await ext.tabs.sendMessage(rec.tabId, { type: 'rand:decision', id: invokeId, ...verdict }, ...to); } catch { /* the tab is gone */ } } return true; } @@ -226,9 +240,10 @@ if (!fromExtensionPage(sender)) return fail('FORBIDDEN', 'not the approval window'); const invokeId = msg.id; if (typeof invokeId !== 'string') return fail('BAD_REQUEST', 'malformed invoke message'); - const m = /^rand:(invoke|withdraw)(Request|Progress|Result)$/.exec(msg.type); + const m = /^rand:(invoke|withdraw|derive)(Request|Progress|Result)$/.exec(msg.type); const kind = m[1]; const gone = () => fail('GONE', 'That request is no longer waiting.'); + if (kind === 'derive' && m[2] !== 'Request') return deriveAnswered(msg, invokeId, gone); if (m[2] === 'Request') { const rec = (await invokes())[invokeId]; return rec && kindOf(rec) === kind ? { ok: true, result: { origin: rec.origin, request: rec.request } } : gone(); @@ -262,6 +277,95 @@ return { ok: true }; } + // ---- deriveKey ---- + const derive = () => deriveSiteKey || (root.RandSiteKey && root.RandSiteKey.deriveSiteKey); + const PURPOSE_RE = /^[a-z0-9./-]{1,64}$/; + const lockedFail = () => fail('LOCKED', 'Rand Wallet is locked.'); + /** The unlocked spend key, or null. Read when a key is made, and kept nowhere. */ + async function spendKey() { + try { + const u = one(await session.get(UNLOCKED_KEY), UNLOCKED_KEY); + return u && typeof u.spend_key === 'string' && HEX32_RE.test(u.spend_key) ? u.spend_key : null; + } catch { return null; } + } + /** Whether `g` (this origin's grant) holds a yes for `purpose`, given to the address it has now. */ + const keyApproved = (g, purpose) => { + const k = g.siteKeys && Object.prototype.hasOwnProperty.call(g.siteKeys, purpose) ? g.siteKeys[purpose] : null; + return !!k && k.address === g.address; + }; + /** The site's answer: `{key}`, or LOCKED when there is no spend key to make it from. */ + async function keyFor(origin, purpose, g) { + const sk = await spendKey(); + if (!sk) return lockedFail(); + try { + return { ok: true, result: { key: await derive()({ spendKey: sk, origin, purpose, address: g.address }) } }; + } catch { + return fail('UNAVAILABLE', 'Rand Wallet could not make the key.'); + } + } + + async function deriveKey(origin, sender, params) { + const w = await wallet(); + if (!w || !w.address) return fail('NO_WALLET', 'Rand Wallet has no wallet yet.'); + if (!(await unlocked())) return lockedFail(); + const g = await grant(origin); + if (!g) return fail('NOT_CONNECTED', 'Rand Wallet is not connected to this site.'); + const purpose = params && typeof params === 'object' && !Array.isArray(params) ? params.purpose : undefined; + if (typeof purpose !== 'string' || !PURPOSE_RE.test(purpose)) return fail('BAD_REQUEST', 'Rand Wallet could not read that request.'); + if (keyApproved(g, purpose)) return keyFor(origin, purpose, g); + const all = await invokes(); + if (Object.values(all).some((r) => r && r.origin === origin)) { + return fail('BUSY', 'Rand Wallet is already showing a request from this site. Finish or cancel it first.'); + } + const reqId = id(); + const tabId = sender && sender.tab && Number.isInteger(sender.tab.id) ? sender.tab.id : undefined; + const frameId = sender && Number.isInteger(sender.frameId) ? sender.frameId : undefined; + all[reqId] = { kind: 'derive', origin, tabId, frameId, request: { purpose }, windowId: null, phase: null, at: Date.now() }; + await saveInvokes(all); + let windowId = null; + try { + windowId = await openDerive({ id: reqId, origin }); + } catch { + delete all[reqId]; + await saveInvokes(all); + return fail('UNAVAILABLE', 'Rand Wallet could not open its window.'); + } + if (Number.isInteger(windowId)) { + const now = await invokes(); + if (now[reqId]) { now[reqId].windowId = windowId; await saveInvokes(now); } + } + return { pending: reqId }; + } + + /** + * derive.html's yes or no (`rand:deriveResult`, `{id, approved}`); a key request has no + * progress. On yes the grant is checked again — the site may have been disconnected, or the + * wallet locked or changed, while the window was open — the yes is stored, and the key goes + * to the asking tab. The window hears only `{ok: true}`. + */ + async function deriveAnswered(msg, reqId, gone) { + if (msg.type !== 'rand:deriveResult') return fail('BAD_REQUEST', 'A key request has no progress.'); + const rec = (await invokes())[reqId]; + if (!rec || kindOf(rec) !== 'derive') return gone(); + let verdict = fail('USER_REJECTED', 'The request was not approved in Rand Wallet.'); + if (msg.approved === true) { + const { origin } = rec; + const purpose = rec.request && rec.request.purpose; + const g = await grant(origin); + verdict = g ? await keyFor(origin, purpose, g) : fail('NOT_CONNECTED', 'Rand Wallet is not connected to this site.'); + if (verdict.ok) { + const all = await sites(); + const entry = all[origin]; + if (entry && entry.address === g.address) { + entry.siteKeys = { ...(entry.siteKeys || {}), [purpose]: { address: g.address, at: Date.now() } }; + await local.set({ [SITES_KEY]: all }); + } + } + } + await settle(reqId, verdict); + return { ok: true }; + } + /** * The approval window `windowId` closed. A request it had not answered is answered here: never * approved, or stopped before anything left the device, is a refusal; closed once the @@ -289,7 +393,7 @@ async function handle(msg, sender) { if (!msg || typeof msg.type !== 'string' || !msg.type.startsWith('rand:')) return undefined; if (msg.type === 'rand:decision') return decide(msg, sender); - if (/^rand:(invoke|withdraw)(Request|Progress|Result)$/.test(msg.type)) return fromWindow(msg, sender); + if (/^rand:(invoke|withdraw|derive)(Request|Progress|Result)$/.test(msg.type)) return fromWindow(msg, sender); const origin = originOf(sender); if (!origin) return fail('UNSUPPORTED_ORIGIN', 'This page cannot connect to Rand Wallet.'); switch (msg.type) { @@ -317,6 +421,9 @@ case 'rand:withdraw': if (typeof openWithdraw !== 'function') return fail('UNKNOWN_METHOD', 'This Rand Wallet does not support withdraw.'); return start('withdraw', origin, sender, msg.params); + case 'rand:deriveKey': + if (typeof openDerive !== 'function' || typeof derive() !== 'function') return fail('UNKNOWN_METHOD', 'This Rand Wallet does not support deriveKey.'); + return deriveKey(origin, sender, msg.params); case 'rand:disconnect': { const all = await sites(); if (all[origin]) { delete all[origin]; await local.set({ [SITES_KEY]: all }); } diff --git a/extension/test/background.test.mjs b/extension/test/background.test.mjs index aedab682..b566e5b7 100644 --- a/extension/test/background.test.mjs +++ b/extension/test/background.test.mjs @@ -42,7 +42,7 @@ function boot({ tabs = [], refuse = () => false, browser = {} } = {}) { sandbox.importScripts = (f) => vm.runInContext(read(f), ctx); const ctx = vm.createContext(sandbox); vm.runInContext(read('background.js'), ctx); - return { calls, fire: (details) => calls.listeners.installed(details) }; + return { calls, sandbox, fire: (details) => calls.listeners.installed(details) }; } test('an update re-injects inpage.js (page world) then content.js into every open bridge tab', async () => { @@ -108,3 +108,11 @@ test('the toolbar button opens the side panel: Chrome is told to, Firefox toggle assert.equal(m.action.default_popup, undefined, `${which}: no popup, so the click is ours to answer`); } }); + +test('deriveKey\'s KDF is loaded before the provider host, in Chrome\'s worker and in Firefox\'s event page', () => { + const { sandbox } = boot(); + assert.equal(typeof sandbox.RandSiteKey.deriveSiteKey, 'function'); + assert.equal(typeof sandbox.makeRandProviderHost, 'function'); + const scripts = JSON.parse(readFileSync(new URL('../../firefox/manifest.json', import.meta.url), 'utf8')).background.scripts; + assert.deepEqual(scripts, ['lib/derive-key.js', 'provider-host.js', 'background.js']); +}); diff --git a/extension/test/content-relay.test.mjs b/extension/test/content-relay.test.mjs index 172b3bf5..10f1fd8b 100644 --- a/extension/test/content-relay.test.mjs +++ b/extension/test/content-relay.test.mjs @@ -167,3 +167,27 @@ test('withdraw is relayed with its params, and a rand:phase for a waiting reques assert.equal(replies(win, 'w2')[0].error.code, 'BAD_REQUEST'); assert.equal(replies(win, 'w3')[0].error.code, 'BAD_REQUEST'); }); + +test('deriveKey is relayed with its purpose and nothing else; anything but a short string purpose never reaches the background', async () => { + const win = fakeWindow(); + const chrome = fakeChrome({ answer: () => ({ pending: 'd1' }) }); + inject(win, chrome); + win.postMessage({ target: 'rand-wallet:page', id: 'k1', method: 'deriveKey', params: { purpose: 'perps/trading', origin: 'https://durian.market', extra: { a: 1 } } }, ORIGIN); + await tick(); + assert.deepEqual(plain(chrome.sent), [{ type: 'rand:deriveKey', params: { purpose: 'perps/trading' } }]); + for (const fn of chrome.decisions) fn({ type: 'rand:decision', id: 'd1', ok: true, result: { key: 'ab'.repeat(32) } }); + await tick(); + assert.deepEqual(replies(win, 'k1'), [{ target: 'rand-wallet:content', id: 'k1', ok: true, result: { key: 'ab'.repeat(32) } }]); + + for (const [id, params] of [['k2', undefined], ['k3', { purpose: 7 }], ['k4', { purpose: 'a'.repeat(65) }], ['k5', 'perps'], ['k6', { purpose: { toString: 1 } }]]) { + win.postMessage({ target: 'rand-wallet:page', id, method: 'deriveKey', params }, ORIGIN); + } + await tick(); + assert.equal(chrome.sent.length, 1, 'none reached the background'); + for (const id of ['k2', 'k3', 'k4', 'k5', 'k6']) assert.equal(replies(win, id)[0].error.code, 'BAD_REQUEST', id); +}); + +test('the relayed method names are exactly the provider\'s, deriveKey the one new one', () => { + const names = /const METHODS = new Set\(\[([^\]]*)\]\)/.exec(SOURCE)[1].match(/'[^']+'/g).map((s) => s.slice(1, -1)); + assert.deepEqual(names.sort(), ['connect', 'deriveKey', 'disconnect', 'getAddress', 'getRecipientHash', 'invoke', 'withdraw']); +}); diff --git a/extension/test/derive-key.test.mjs b/extension/test/derive-key.test.mjs new file mode 100644 index 00000000..4e1f6de3 --- /dev/null +++ b/extension/test/derive-key.test.mjs @@ -0,0 +1,98 @@ +// lib/derive-key.js under plain Node, evaluated as the classic script the background loads. What is +// checked is the construction itself: HKDF-SHA-256 over the wallet's spend key, salt the fixed +// domain string, info the length-prefixed (domain, origin, purpose, address) — recomputed here by a +// second, independent implementation (node:crypto's hkdfSync) and pinned to a vector, so a change +// to any byte of it fails here before it changes every site's key. +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { hkdfSync } from 'node:crypto'; +import vm from 'node:vm'; + +vm.runInThisContext(readFileSync(new URL('../shared/lib/derive-key.js', import.meta.url), 'utf8')); +const { DOMAIN, PURPOSE_RE, deriveSiteKey, siteKeyInfo } = globalThis.RandSiteKey; + +const SPEND = '000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f'; +const ORIGIN = 'https://durian.market'; +const PURPOSE = 'perps/trading'; +const ADDRESS = 'rand1qexampleaddress'; +const base = { spendKey: SPEND, origin: ORIGIN, purpose: PURPOSE, address: ADDRESS }; + +/** The construction, written out again with node:crypto: what a second implementation does. */ +function reference({ spendKey, origin, purpose, address }) { + const lp = (s) => { + const b = Buffer.from(s, 'utf8'); + const n = Buffer.alloc(4); + n.writeUInt32BE(b.length); + return Buffer.concat([n, b]); + }; + const info = Buffer.concat([lp('rand-wallet/site-key/v1'), lp(origin), lp(purpose), lp(address)]); + return Buffer.from(hkdfSync('sha256', Buffer.from(spendKey, 'hex'), Buffer.from('rand-wallet/site-key/v1', 'utf8'), info, 32)).toString('hex'); +} + +test('the domain string and the purpose rule are the documented ones', () => { + assert.equal(DOMAIN, 'rand-wallet/site-key/v1'); + assert.equal(PURPOSE_RE.source, '^[a-z0-9./-]{1,64}$'); +}); + +test('the pinned vector, and an independent HKDF-SHA-256 agrees with it', async () => { + const key = await deriveSiteKey(base); + assert.match(key, /^[0-9a-f]{64}$/); + assert.equal(key, reference(base)); + // Pinned: the README's worked vector. Changing it changes every site's key for every wallet. + assert.equal(key, '60ff86759cc122f6277ce23e0f2430640780354cc214445b5e6297daf50f31b1'); + assert.equal(Buffer.from(siteKeyInfo(base)).toString('hex'), + '0000001772616e642d77616c6c65742f736974652d6b65792f7631' + + '0000001568747470733a2f2f64757269616e2e6d61726b6574' + + '0000000d70657270732f74726164696e67' + + '0000001472616e6431716578616d706c6561646472657373'); +}); + +test('the same inputs give the same key; each input changes it', async () => { + const k = await deriveSiteKey(base); + assert.equal(await deriveSiteKey({ ...base }), k, 'deterministic'); + // An uppercase spend key is the same key (the core's hex is lowercase; an import lowercases). + assert.equal(await deriveSiteKey({ ...base, spendKey: SPEND.toUpperCase() }), k); + const others = [ + { ...base, origin: 'https://evil.example' }, + { ...base, origin: 'http://durian.market' }, + { ...base, origin: 'https://durian.market:8443' }, + { ...base, purpose: 'perps/trading2' }, + { ...base, address: 'rand1qotheraddress' }, + { ...base, spendKey: SPEND.replace(/^00/, '01') }, + ]; + const keys = await Promise.all(others.map(deriveSiteKey)); + for (const [i, other] of keys.entries()) assert.notEqual(other, k, JSON.stringify(others[i])); + assert.equal(new Set(keys).size, keys.length, 'all different from each other too'); +}); + +test('the info is length-prefixed, so moving bytes between fields is a different input', () => { + const a = Buffer.from(siteKeyInfo({ origin: 'https://a.example', purpose: 'x/y', address: 'rand1q' })); + const b = Buffer.from(siteKeyInfo({ origin: 'https://a.example', purpose: 'x', address: '/yrand1q' })); + assert.notDeepEqual(a, b); + // The layout: four u32-big-endian length prefixes, each before its UTF-8 field. + assert.equal(a.readUInt32BE(0), DOMAIN.length); + assert.equal(a.subarray(4, 4 + DOMAIN.length).toString('utf8'), DOMAIN); +}); + +test('inputs that are not what the wallet would pass are refused, not derived from', async () => { + for (const bad of [ + { ...base, spendKey: '' }, + { ...base, spendKey: SPEND.slice(2) }, + { ...base, spendKey: 'zz' + SPEND.slice(2) }, + { ...base, spendKey: undefined }, + { ...base, origin: 'https://durian.market/' }, + { ...base, origin: 'durian.market' }, + { ...base, origin: 'chrome-extension://abc' }, + { ...base, origin: '' }, + { ...base, purpose: '' }, + { ...base, purpose: 'Perps' }, + { ...base, purpose: 'a'.repeat(65) }, + { ...base, purpose: 'perps trading' }, + { ...base, purpose: 7 }, + { ...base, address: '' }, + { ...base, address: null }, + ]) { + await assert.rejects(deriveSiteKey(bad), undefined, JSON.stringify(bad)); + } +}); diff --git a/extension/test/provider-host.test.mjs b/extension/test/provider-host.test.mjs index 0ebc1abd..31374a27 100644 --- a/extension/test/provider-host.test.mjs +++ b/extension/test/provider-host.test.mjs @@ -6,6 +6,8 @@ import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import vm from 'node:vm'; +// lib/derive-key.js first, as background.js loads it: the host's `deriveKey` uses its KDF. +vm.runInThisContext(readFileSync(new URL('../shared/lib/derive-key.js', import.meta.url), 'utf8')); vm.runInThisContext(readFileSync(new URL('../shared/provider-host.js', import.meta.url), 'utf8')); const ROOT = 'chrome-extension://abc/'; @@ -90,3 +92,226 @@ test('messages that are not ours are ignored', async () => { const host = globalThis.makeRandProviderHost({ ext: fakeExt(), openConsent: async () => {} }); assert.equal(await host.handle({ type: 'something-else' }, site()), undefined); }); + +// ---- deriveKey: a key bound to the asking origin, the purpose and the connected address ---- + +const SPEND = '1f'.repeat(32); +const DURIAN = 'https://durian.market'; +const HEX64 = /^[0-9a-f]{64}$/; +/** A wallet on a device: storage.local and storage.session as the engine leaves them. */ +function deriveExt({ address = 'rand1real', spendKey = SPEND, unlocked = true, granted = [DURIAN] } = {}) { + const local = { + wallet: { address, pk: 'pk' }, + sites: Object.fromEntries(granted.map((o) => [o, { address, hash: 'h'.repeat(64), at: 1 }])), + }; + const session = unlocked ? { unlocked: { spend_key: spendKey, viewing_key: 'ab'.repeat(32) } } : {}; + const sent = []; + const copy = (v) => JSON.parse(JSON.stringify(v)); + const pick = (bag) => async (key) => (key in bag ? { [key]: copy(bag[key]) } : {}); + return { + sent, local, session, + runtime: { getURL: (p) => ROOT + p }, + storage: { + local: { get: pick(local), set: async (obj) => Object.assign(local, copy(obj)) }, + session: { get: pick(session), set: async (obj) => Object.assign(session, copy(obj)) }, + }, + tabs: { sendMessage: async (tabId, msg, opts) => { sent.push(opts ? [tabId, msg, opts] : [tabId, msg]); } }, + }; +} +function deriveHost(ext, { windowId = 55, ids = ['d1', 'd2', 'd3'] } = {}) { + const opened = []; + const queue = [...ids]; + const host = globalThis.makeRandProviderHost({ + ext, openConsent: async () => {}, newId: () => queue.shift(), + openInvoke: async () => 99, + openDerive: async (r) => { opened.push(r); return windowId; }, + }); + return { host, opened }; +} +const page = (origin = DURIAN, tabId = 4, frameId = 0) => ({ origin, url: `${origin}/perps`, tab: { id: tabId }, frameId }); +const deriveWin = () => ({ url: `${ROOT}derive.html?id=d1` }); +const ask = (host, purpose = 'perps/trading', sender = page()) => host.handle({ type: 'rand:deriveKey', params: { purpose } }, sender); +/** Ask, approve in the window, and return the key the tab was given. */ +async function approveOnce(ext, host, purpose = 'perps/trading', sender = page()) { + const res = await ask(host, purpose, sender); + assert.ok(res.pending, JSON.stringify(res)); + assert.deepEqual(await host.handle({ type: 'rand:deriveResult', id: res.pending, approved: true }, deriveWin()), { ok: true }); + const [, msg] = ext.sent.at(-1); + assert.equal(msg.ok, true, JSON.stringify(msg)); + return msg.result.key; +} + +test('deriveKey: an origin that is not connected is refused NOT_CONNECTED, without a window', async () => { + const ext = deriveExt({ granted: [] }); + const { host, opened } = deriveHost(ext); + assert.equal((await ask(host)).error.code, 'NOT_CONNECTED'); + assert.equal(opened.length, 0); + // A grant for another site is not this site's. + const { host: h2, opened: o2 } = deriveHost(deriveExt({ granted: ['https://randbridge.org'] })); + assert.equal((await ask(h2)).error.code, 'NOT_CONNECTED'); + assert.equal(o2.length, 0); +}); + +test('deriveKey: the first request opens the approval window; Approve stores the yes and the tab gets the key', async () => { + const ext = deriveExt(); + const { host, opened } = deriveHost(ext); + assert.deepEqual(await ask(host), { pending: 'd1' }); + assert.deepEqual(opened, [{ id: 'd1', origin: DURIAN }]); + const rec = ext.session.invokes.d1; + assert.equal(rec.kind, 'derive'); + assert.equal(rec.origin, DURIAN, 'the origin is the sender\'s'); + assert.deepEqual(rec.request, { purpose: 'perps/trading' }); + assert.equal(rec.windowId, 55); + // The window reads what it shows by id; a page cannot, and an invoke window cannot either. + assert.deepEqual(await host.handle({ type: 'rand:deriveRequest', id: 'd1' }, deriveWin()), { ok: true, result: { origin: DURIAN, request: { purpose: 'perps/trading' } } }); + assert.equal((await host.handle({ type: 'rand:deriveRequest', id: 'd1' }, page())).error.code, 'FORBIDDEN'); + assert.equal((await host.handle({ type: 'rand:invokeRequest', id: 'd1' }, deriveWin())).error.code, 'GONE'); + // Only an extension page may approve. + assert.equal((await host.handle({ type: 'rand:deriveResult', id: 'd1', approved: true }, page())).error.code, 'FORBIDDEN'); + assert.equal(ext.sent.length, 0); + + const answer = await host.handle({ type: 'rand:deriveResult', id: 'd1', approved: true }, deriveWin()); + assert.deepEqual(answer, { ok: true }, 'the window is told nothing but that it was heard'); + assert.equal(ext.sent.length, 1); + const [tabId, msg, opts] = ext.sent[0]; + assert.equal(tabId, 4); + assert.deepEqual(opts, { frameId: 0 }, 'to the frame that asked'); + assert.equal(msg.type, 'rand:decision'); + assert.equal(msg.id, 'd1'); + assert.equal(msg.ok, true); + assert.deepEqual(Object.keys(msg.result), ['key']); + assert.match(msg.result.key, HEX64); + // It is the documented derivation, over the sender's origin and the connected address. + assert.equal(msg.result.key, await globalThis.RandSiteKey.deriveSiteKey({ spendKey: SPEND, origin: DURIAN, purpose: 'perps/trading', address: 'rand1real' })); + // The yes is stored under the site's entry, per purpose and tied to the address; the key is not stored anywhere. + assert.deepEqual(Object.keys(ext.local.sites[DURIAN].siteKeys), ['perps/trading']); + assert.equal(ext.local.sites[DURIAN].siteKeys['perps/trading'].address, 'rand1real'); + assert.deepEqual(ext.session.invokes, {}); + assert.doesNotMatch(JSON.stringify(ext.local) + JSON.stringify(ext.session), new RegExp(msg.result.key)); +}); + +test('deriveKey: once approved, later requests answer at once with the same key and no window', async () => { + const ext = deriveExt(); + const { host, opened } = deriveHost(ext); + const key = await approveOnce(ext, host); + const again = await ask(host); + assert.deepEqual(again, { ok: true, result: { key } }); + assert.equal(opened.length, 1, 'no second window'); + // Another purpose is another question. + assert.deepEqual(await ask(host, 'perps/other'), { pending: 'd2' }); + assert.equal(opened.length, 2); +}); + +test('deriveKey: same wallet, origin and purpose give the same key on another device; another origin or purpose a different one', async () => { + const a = deriveExt({ granted: [DURIAN, 'https://www.durian.market', 'http://localhost:3000'] }); + const { host: ha } = deriveHost(a, { ids: ['d1', 'd2', 'd3', 'd4'] }); + const key = await approveOnce(a, ha); + // A second device restored from the same spend key. + const b = deriveExt(); + const { host: hb } = deriveHost(b); + assert.equal(await approveOnce(b, hb), key); + const otherOrigin = await approveOnce(a, ha, 'perps/trading', page('https://www.durian.market')); + const otherPort = await approveOnce(a, ha, 'perps/trading', page('http://localhost:3000')); + const otherPurpose = await approveOnce(a, ha, 'perps/staging'); + assert.equal(new Set([key, otherOrigin, otherPort, otherPurpose]).size, 4); + // Another wallet, same site and purpose: another key. + const c = deriveExt({ spendKey: '2e'.repeat(32), address: 'rand1other' }); + const { host: hc } = deriveHost(c); + assert.notEqual(await approveOnce(c, hc), key); +}); + +test('deriveKey: the origin is the sender\'s, whatever the message says', async () => { + const ext = deriveExt({ granted: [DURIAN, 'https://evil.example'] }); + const { host } = deriveHost(ext); + const evil = page('https://evil.example'); + const res = await host.handle({ type: 'rand:deriveKey', origin: DURIAN, params: { purpose: 'perps/trading', origin: DURIAN } }, evil); + assert.equal(ext.session.invokes[res.pending].origin, 'https://evil.example'); + assert.deepEqual(ext.session.invokes[res.pending].request, { purpose: 'perps/trading' }, 'nothing else of the params is kept'); + await host.handle({ type: 'rand:deriveResult', id: res.pending, approved: true, origin: DURIAN }, deriveWin()); + const key = ext.sent[0][1].result.key; + assert.equal(key, await globalThis.RandSiteKey.deriveSiteKey({ spendKey: SPEND, origin: 'https://evil.example', purpose: 'perps/trading', address: 'rand1real' })); + assert.notEqual(key, await globalThis.RandSiteKey.deriveSiteKey({ spendKey: SPEND, origin: DURIAN, purpose: 'perps/trading', address: 'rand1real' })); + assert.equal(ext.local.sites[DURIAN].siteKeys, undefined, 'the yes went to the asking site only'); +}); + +test('deriveKey: a purpose outside [a-z0-9./-]{1,64} is BAD_REQUEST, without a window', async () => { + const ext = deriveExt(); + const { host, opened } = deriveHost(ext); + for (const params of [{ purpose: '' }, { purpose: 'Perps' }, { purpose: 'perps trading' }, { purpose: 'a'.repeat(65) }, { purpose: 'perps/é' }, + { purpose: 'perps\n' }, { purpose: 7 }, { purpose: ['perps'] }, {}, null, undefined, 'perps']) { + const res = await host.handle({ type: 'rand:deriveKey', params }, page()); + assert.equal(res.error && res.error.code, 'BAD_REQUEST', JSON.stringify(params)); + } + assert.equal(opened.length, 0); + assert.ok((await ask(host, 'a'.repeat(64))).pending, '64 characters is allowed'); +}); + +test('deriveKey: a locked wallet is LOCKED, before a window and after an approval', async () => { + const { host, opened } = deriveHost(deriveExt({ unlocked: false })); + assert.equal((await ask(host)).error.code, 'LOCKED'); + assert.equal(opened.length, 0); + // Approved earlier, locked now: no key. + const ext = deriveExt(); + const h = deriveHost(ext).host; + await approveOnce(ext, h); + delete ext.session.unlocked; + assert.equal((await ask(h)).error.code, 'LOCKED'); + // Locked while the window was open: the approval answers LOCKED and gives nothing. + const ext2 = deriveExt(); + const h2 = deriveHost(ext2).host; + await ask(h2); + delete ext2.session.unlocked; + await h2.handle({ type: 'rand:deriveResult', id: 'd1', approved: true }, deriveWin()); + assert.equal(ext2.sent[0][1].ok, false); + assert.equal(ext2.sent[0][1].error.code, 'LOCKED'); + assert.equal(ext2.local.sites[DURIAN].siteKeys, undefined); +}); + +test('deriveKey: Reject or a closed window is USER_REJECTED and stores nothing', async () => { + const ext = deriveExt(); + const { host } = deriveHost(ext); + await ask(host); + await host.handle({ type: 'rand:deriveResult', id: 'd1', approved: false }, deriveWin()); + assert.equal(ext.sent[0][1].error.code, 'USER_REJECTED'); + assert.equal(ext.local.sites[DURIAN].siteKeys, undefined); + // Progress is not a thing a key request has. + await ask(host); + assert.equal((await host.handle({ type: 'rand:deriveProgress', id: 'd2', phase: 'submitting' }, deriveWin())).error.code, 'BAD_REQUEST'); + await host.windowClosed(55); + assert.equal(ext.sent[1][1].id, 'd2'); + assert.equal(ext.sent[1][1].error.code, 'USER_REJECTED'); + assert.deepEqual(ext.session.invokes, {}); + assert.equal(ext.local.sites[DURIAN].siteKeys, undefined); +}); + +test('deriveKey: one request per site at a time, shared with invoke (BUSY)', async () => { + const ext = deriveExt(); + const { host, opened } = deriveHost(ext); + await ask(host); + assert.equal((await ask(host)).error.code, 'BUSY'); + assert.equal((await host.handle({ type: 'rand:invoke', params: { program: 'ab'.repeat(32) } }, page())).error.code, 'BUSY'); + assert.equal(opened.length, 1); +}); + +test('deriveKey: disconnect forgets the approval; a yes given to another address is not honoured', async () => { + const ext = deriveExt(); + const { host, opened } = deriveHost(ext); + await approveOnce(ext, host); + await host.handle({ type: 'rand:disconnect' }, page()); + assert.equal((await ask(host)).error.code, 'NOT_CONNECTED'); + // Connected again: the key is asked for again. + ext.local.sites[DURIAN] = { address: 'rand1real', hash: 'h'.repeat(64), at: 3 }; + assert.ok((await ask(host)).pending); + assert.equal(opened.length, 2); + // A stored yes for another address (the site entry rewritten for this one) does not answer. + const ext2 = deriveExt(); + ext2.local.sites[DURIAN].siteKeys = { 'perps/trading': { address: 'rand1old', at: 1 } }; + const d2 = deriveHost(ext2); + assert.ok((await ask(d2.host)).pending); + assert.equal(d2.opened.length, 1); +}); + +test('deriveKey: a host built without openDerive does not know the method', async () => { + const host = globalThis.makeRandProviderHost({ ext: deriveExt(), openConsent: async () => {} }); + assert.equal((await ask(host)).error.code, 'UNKNOWN_METHOD'); +}); diff --git a/extension/test/smoke.mjs b/extension/test/smoke.mjs index df68363c..4347d52e 100644 --- a/extension/test/smoke.mjs +++ b/extension/test/smoke.mjs @@ -77,6 +77,8 @@ const NEEDED = [ // the page provider (`window.rand`) and its consent window 'inpage.js', 'content.js', 'provider-host.js', 'connect.html', 'connect.js', 'lib/recipient-hash.js', 'lib/site-errors.js', 'lib/address-format.js', + // deriveKey: the background's KDF and its approval window + 'lib/derive-key.js', 'derive.html', 'derive.js', // the manifest's own strings (`__MSG_…__`, WebExtension i18n): without `default_locale`'s file // the browser refuses the manifest outright '_locales/en/messages.json', 'ui/i18n.js', 'lib/window-locale.js', diff --git a/firefox/manifest.json b/firefox/manifest.json index 70084887..9593057c 100644 --- a/firefox/manifest.json +++ b/firefox/manifest.json @@ -47,6 +47,7 @@ }, "background": { "scripts": [ + "lib/derive-key.js", "provider-host.js", "background.js" ] diff --git a/ui/locales/ar.js b/ui/locales/ar.js index 1cdcd18c..c3fdbdcc 100644 --- a/ui/locales/ar.js +++ b/ui/locales/ar.js @@ -1130,4 +1130,13 @@ export default { "the record does not open with this password": "لا يُفتح السجل بكلمة المرور هذه", "block {height} has {got} of the {n} transactions its header announced": "الكتلة {height} تحتوي على {got} من أصل {n} معاملة أعلنت عنها ترويستها", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "أُوقف العمل بمفتاح هذا المُثبِت ولم يعد مستخدمًا. اقرن مُثبِتًا آخر في الإعدادات، أو حدّث Rand Wallet إلى أحدث إصدار.", + "{host} asks Rand Wallet for a key of its own.": "يطلب {host} من Rand Wallet مفتاحًا خاصًا به.", + "Give this site a key?": "هل تعطي هذا الموقع مفتاحًا؟", + "Nothing to approve": "لا شيء للموافقة عليه", + "Purpose": "الغرض", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "يعطي Rand Wallet هذا الموقع المفتاح نفسه في كل مرة، على أي جهاز فيه هذه المحفظة، ولا يعطيه لأي موقع آخر.", + "Site": "الموقع", + "The key gives no access to this wallet’s funds, notes or address keys.": "لا يمنح المفتاح أي وصول إلى أموال هذه المحفظة أو سنداتها أو مفاتيح عنوانها.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "يمكن للموقع استخدام المفتاح للتصرف نيابةً عنك على ذلك الموقع، مثل توقيع الصفقات في حساب التداول الخاص بك هناك.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "يُطلب منك ذلك مرة واحدة لكل غرض، وقطع الاتصال بالموقع يُنسي إجابتك.", }; diff --git a/ui/locales/de.js b/ui/locales/de.js index f9ad0c37..fbafbfdc 100644 --- a/ui/locales/de.js +++ b/ui/locales/de.js @@ -1130,4 +1130,13 @@ export default { "the record does not open with this password": "der Datensatz lässt sich mit diesem Passwort nicht öffnen", "block {height} has {got} of the {n} transactions its header announced": "Block {height} enthält {got} der {n} Transaktionen, die sein Header angekündigt hat", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "Der Schlüssel dieses Provers wurde außer Betrieb genommen und wird nicht mehr verwendet. Kopple in den Einstellungen einen anderen Prover oder aktualisiere Rand Wallet auf die neueste Version.", + "{host} asks Rand Wallet for a key of its own.": "{host} bittet Rand Wallet um einen eigenen Schlüssel.", + "Give this site a key?": "Dieser Website einen Schlüssel geben?", + "Nothing to approve": "Nichts zu genehmigen", + "Purpose": "Zweck", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet gibt dieser Website jedes Mal denselben Schlüssel, auf jedem Gerät mit dieser Wallet, und keiner anderen Website.", + "Site": "Website", + "The key gives no access to this wallet’s funds, notes or address keys.": "Der Schlüssel gibt keinen Zugriff auf das Guthaben, die Noten oder die Adressschlüssel dieser Wallet.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "Die Website kann den Schlüssel nutzen, um auf dieser Website für dich zu handeln, zum Beispiel um Trades in deinem Handelskonto dort zu signieren.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "Du wirst für jeden Zweck einmal gefragt; trennst du die Website, wird deine Antwort vergessen.", }; diff --git a/ui/locales/en.js b/ui/locales/en.js index 64df0c6f..49a16029 100644 --- a/ui/locales/en.js +++ b/ui/locales/en.js @@ -4,7 +4,7 @@ // value, or an object of CLDR plural categories ({one, few, many, other}) for a key with an // {n} hole whose translation inflects by number. `{name}` holes and the words in the glossary // at the top of each dictionary are kept as they are. -// 1123 strings. +// 1132 strings. export default { "{amount} {symbol}": "{amount} {symbol}", "{blocks} blocks left to prove it.": "{blocks} blocks left to prove it.", @@ -27,6 +27,7 @@ export default { "{field} is not hex of at most {max} characters": "{field} is not hex of at most {max} characters", "{field} is not none, deposit or burn": "{field} is not none, deposit or burn", "{field} is zero": "{field} is zero", + "{host} asks Rand Wallet for a key of its own.": "{host} asks Rand Wallet for a key of its own.", "{host} asks Rand Wallet to send this transaction.": "{host} asks Rand Wallet to send this transaction.", "{host} has the transaction {tx}.": "{host} has the transaction {tx}.", "{host} wants to connect to Rand Wallet.": "{host} wants to connect to Rand Wallet.", @@ -338,6 +339,7 @@ export default { "Get test RAND": "Get test RAND", "Get test RAND from the faucet": "Get test RAND from the faucet", "Give the contact a name.": "Give the contact a name.", + "Give this site a key?": "Give this site a key?", "Good": "Good", "Guardian set": "Guardian set", "has a different genesis hash": "has a different genesis hash", @@ -474,6 +476,7 @@ export default { "Nothing found": "Nothing found", "Nothing left the pool": "Nothing left the pool", "Nothing scanned": "Nothing scanned", + "Nothing to approve": "Nothing to approve", "Nothing to connect": "Nothing to connect", "Nothing was sent": "Nothing was sent", "Nothing was sent.": "Nothing was sent.", @@ -567,6 +570,7 @@ export default { "proving the spend authorisation failed: {reason}": "proving the spend authorisation failed: {reason}", "Proving.": "Proving.", "Proving… {elapsed}": "Proving… {elapsed}", + "Purpose": "Purpose", "QR code of the pairing link": "QR code of the pairing link", "QR code of your payment link": "QR code of your payment link", "RAND is not a bridged asset, so it cannot be withdrawn.": "RAND is not a bridged asset, so it cannot be withdrawn.", @@ -579,6 +583,7 @@ export default { "Rand Wallet could not start": "Rand Wallet could not start", "Rand Wallet could not tell whether the burn was sent. Check its activity before trying again.": "Rand Wallet could not tell whether the burn was sent. Check its activity before trying again.", "Rand Wallet does not hold enough to cover this and its network fee: {reason}": "Rand Wallet does not hold enough to cover this and its network fee: {reason}", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.", "rand1… or randpay:…": "rand1… or randpay:…", "rand1…, randpay:… or a contact": "rand1…, randpay:… or a contact", "Rate": "Rate", @@ -681,6 +686,7 @@ export default { "Signer {index}'s share verifies. {have} of {threshold} in hand: signers {list}.": "Signer {index}'s share verifies. {have} of {threshold} in hand: signers {list}.", "signer {index}'s signature does not verify over this proposal": "signer {index}'s signature does not verify over this proposal", "Signer key file, or its 64-hex seed": "Signer key file, or its 64-hex seed", + "Site": "Site", "So the address above is one you have actually read.": "So the address above is one you have actually read.", "Something went wrong": "Something went wrong", "Something went wrong.": "Something went wrong.", @@ -754,6 +760,7 @@ export default { "the inflow is `none` exactly when the bundle burns no token (inflow.amount == 0)": "the inflow is `none` exactly when the bundle burns no token (inflow.amount == 0)", "the key file's address is not the one its seed derives": "the key file's address is not the one its seed derives", "the key file's public_key is not the one its seed derives": "the key file's public_key is not the one its seed derives", + "The key gives no access to this wallet’s funds, notes or address keys.": "The key gives no access to this wallet’s funds, notes or address keys.", "The key you exported when this wallet was created.": "The key you exported when this wallet was created.", "The language could not be saved.": "The language could not be saved.", "The link asks for {linked} {symbol}; you typed {typed} {symbol}.": "The link asks for {linked} {symbol}; you typed {typed} {symbol}.", @@ -879,6 +886,7 @@ export default { "the saved signer profiles could not be opened ({reason}); nothing was changed. Restore this device's storage or wipe the wallet and restore it from its key": "the saved signer profiles could not be opened ({reason}); nothing was changed. Restore this device's storage or wipe the wallet and restore it from its key", "The scan was cancelled.": "The scan was cancelled.", "The side panel could not be opened.": "The side panel could not be opened.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "The site can use the key to act for you on that site, for example to sign trades in your trading account there.", "The site sent an invoke this wallet cannot read: {reason}.": "The site sent an invoke this wallet cannot read: {reason}.", "The spend key could not be read.": "The spend key could not be read.", "The spend key is the wallet. Export it to move to another device, or to send from the desktop app, which can prove a transfer natively.": "The spend key is the wallet. Export it to move to another device, or to send from the desktop app, which can prove a transfer natively.", @@ -1104,6 +1112,7 @@ export default { "would not name its genesis": "would not name its genesis", "Yes": "Yes", "Yesterday": "Yesterday", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "You are asked once for each purpose; disconnecting the site forgets your answer.", "You are asked once; to keep your history to yourself, pair your own prover in the wallet's Settings.": "You are asked once; to keep your history to yourself, pair your own prover in the wallet's Settings.", "You can look at other screens": "You can look at other screens", "You have {amount} {symbol}.": "You have {amount} {symbol}.", diff --git a/ui/locales/es.js b/ui/locales/es.js index 371078c1..deffd66f 100644 --- a/ui/locales/es.js +++ b/ui/locales/es.js @@ -1130,4 +1130,13 @@ export default { "the record does not open with this password": "el registro no se abre con esta contraseña", "block {height} has {got} of the {n} transactions its header announced": "el bloque {height} tiene {got} de las {n} transacciones que anunció su cabecera", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "La clave de este probador fue retirada y ya no se usa. Vincula otro probador en Ajustes o actualiza Rand Wallet a la última versión.", + "{host} asks Rand Wallet for a key of its own.": "{host} le pide a Rand Wallet una clave propia.", + "Give this site a key?": "¿Dar una clave a este sitio?", + "Nothing to approve": "Nada que aprobar", + "Purpose": "Propósito", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet le da a este sitio la misma clave cada vez, en cualquier dispositivo con esta billetera, y no se la da a ningún otro sitio.", + "Site": "Sitio", + "The key gives no access to this wallet’s funds, notes or address keys.": "La clave no da acceso a los fondos, las notas ni las claves de dirección de esta billetera.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "El sitio puede usar la clave para actuar por ti en ese sitio, por ejemplo para firmar operaciones en tu cuenta de trading allí.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "Se te pregunta una vez por cada propósito; desconectar el sitio olvida tu respuesta.", }; diff --git a/ui/locales/fa.js b/ui/locales/fa.js index ecdd55ec..5ffd323b 100644 --- a/ui/locales/fa.js +++ b/ui/locales/fa.js @@ -1131,4 +1131,13 @@ export default { "the record does not open with this password": "رکورد با این گذرواژه باز نمی‌شود", "block {height} has {got} of the {n} transactions its header announced": "بلوک {height} تنها {got} تراکنش از {n} تراکنشی را دارد که سرآیندش اعلام کرده بود", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "کلید این اثبات‌گر بازنشسته شده و دیگر استفاده نمی‌شود. اثبات‌گر دیگری را در تنظیمات جفت کنید، یا Rand Wallet را به آخرین نسخه به‌روزرسانی کنید.", + "{host} asks Rand Wallet for a key of its own.": "{host} از Rand Wallet یک کلید مخصوص خودش می‌خواهد.", + "Give this site a key?": "به این سایت کلید داده شود؟", + "Nothing to approve": "چیزی برای تأیید نیست", + "Purpose": "کاربرد", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet هر بار همان کلید را به این سایت می‌دهد، روی هر دستگاهی که این کیف پول را دارد، و آن را به هیچ سایت دیگری نمی‌دهد.", + "Site": "سایت", + "The key gives no access to this wallet’s funds, notes or address keys.": "این کلید هیچ دسترسی‌ای به دارایی‌ها، نوت‌ها یا کلیدهای آدرس این کیف پول نمی‌دهد.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "سایت می‌تواند با این کلید در همان سایت از طرف شما عمل کند؛ برای نمونه، معامله‌ها را در حساب معاملاتی شما در آنجا امضا کند.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "برای هر کاربرد فقط یک بار از شما پرسیده می‌شود؛ با قطع اتصال سایت، پاسخ شما فراموش می‌شود.", }; diff --git a/ui/locales/fr.js b/ui/locales/fr.js index 43883771..e3893777 100644 --- a/ui/locales/fr.js +++ b/ui/locales/fr.js @@ -1132,4 +1132,13 @@ export default { "the record does not open with this password": "l'enregistrement ne s'ouvre pas avec ce mot de passe", "block {height} has {got} of the {n} transactions its header announced": "le bloc {height} contient {got} des {n} transactions annoncées par son en-tête", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "La clé de ce prouveur a été retirée et n'est plus utilisée. Associez un autre prouveur dans les Paramètres, ou mettez à jour Rand Wallet vers la dernière version.", + "{host} asks Rand Wallet for a key of its own.": "{host} demande à Rand Wallet une clé qui lui est propre.", + "Give this site a key?": "Donner une clé à ce site ?", + "Nothing to approve": "Rien à approuver", + "Purpose": "Usage", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet donne à ce site la même clé à chaque fois, sur tout appareil doté de ce portefeuille, et ne la donne à aucun autre site.", + "Site": "Site", + "The key gives no access to this wallet’s funds, notes or address keys.": "La clé ne donne aucun accès aux fonds, aux notes ni aux clés d’adresse de ce portefeuille.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "Le site peut utiliser la clé pour agir en votre nom sur ce site, par exemple pour signer des ordres dans votre compte de trading.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "La question vous est posée une fois par usage ; déconnecter le site efface votre réponse.", }; diff --git a/ui/locales/hi.js b/ui/locales/hi.js index 330d32af..be588f41 100644 --- a/ui/locales/hi.js +++ b/ui/locales/hi.js @@ -1130,4 +1130,13 @@ export default { "the record does not open with this password": "रिकॉर्ड इस पासवर्ड से नहीं खुलता", "block {height} has {got} of the {n} transactions its header announced": "ब्लॉक {height} में उसके हेडर द्वारा घोषित {n} लेनदेन में से {got} हैं", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "इस प्रूवर की की हटा दी गई है और अब इस्तेमाल नहीं होती। सेटिंग्स में कोई दूसरा प्रूवर पेयर करें, या Rand Wallet को नवीनतम संस्करण में अपडेट करें।", + "{host} asks Rand Wallet for a key of its own.": "{host} Rand Wallet से अपनी खुद की एक की माँग रही है।", + "Give this site a key?": "इस साइट को की दें?", + "Nothing to approve": "स्वीकृत करने के लिए कुछ नहीं", + "Purpose": "उद्देश्य", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet इस साइट को हर बार वही की देता है, इस वॉलेट वाले किसी भी डिवाइस पर, और किसी दूसरी साइट को यह की नहीं देता।", + "Site": "साइट", + "The key gives no access to this wallet’s funds, notes or address keys.": "यह की इस वॉलेट के फ़ंड, नोट या पते की कीज़ तक कोई पहुँच नहीं देती।", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "साइट इस की से उसी साइट पर आपकी ओर से काम कर सकती है, उदाहरण के लिए वहाँ आपके ट्रेडिंग खाते में ट्रेड पर हस्ताक्षर करना।", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "हर उद्देश्य के लिए आपसे एक बार पूछा जाता है; साइट को डिस्कनेक्ट करने पर आपका जवाब भुला दिया जाता है।", }; diff --git a/ui/locales/id.js b/ui/locales/id.js index 5710363c..84970efb 100644 --- a/ui/locales/id.js +++ b/ui/locales/id.js @@ -1123,4 +1123,13 @@ export default { "the record does not open with this password": "rekaman tidak terbuka dengan kata sandi ini", "block {height} has {got} of the {n} transactions its header announced": "blok {height} berisi {got} dari {n} transaksi yang diumumkan header-nya", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "Kunci prover ini telah dipensiunkan dan tidak lagi digunakan. Pasangkan prover lain di Pengaturan, atau perbarui Rand Wallet ke versi terbaru.", + "{host} asks Rand Wallet for a key of its own.": "{host} meminta Rand Wallet sebuah kunci miliknya sendiri.", + "Give this site a key?": "Beri situs ini sebuah kunci?", + "Nothing to approve": "Tidak ada yang perlu disetujui", + "Purpose": "Tujuan", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet memberi situs ini kunci yang sama setiap kali, di perangkat mana pun yang memiliki dompet ini, dan tidak memberikannya ke situs lain.", + "Site": "Situs", + "The key gives no access to this wallet’s funds, notes or address keys.": "Kunci ini tidak memberi akses ke dana, catatan, atau kunci alamat dompet ini.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "Situs dapat memakai kunci ini untuk bertindak atas nama Anda di situs tersebut, misalnya untuk menandatangani transaksi di akun trading Anda di sana.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "Anda ditanya sekali untuk setiap tujuan; memutus koneksi situs akan menghapus jawaban Anda.", }; diff --git a/ui/locales/it.js b/ui/locales/it.js index cdfb1c86..7a6eea2a 100644 --- a/ui/locales/it.js +++ b/ui/locales/it.js @@ -1130,4 +1130,13 @@ export default { "the record does not open with this password": "il record non si apre con questa password", "block {height} has {got} of the {n} transactions its header announced": "il blocco {height} contiene {got} delle {n} transazioni annunciate dalla sua intestazione", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "La chiave di questo prover è stata ritirata e non è più in uso. Associa un altro prover nelle Impostazioni, oppure aggiorna Rand Wallet all'ultima versione.", + "{host} asks Rand Wallet for a key of its own.": "{host} chiede a Rand Wallet una chiave tutta sua.", + "Give this site a key?": "Dare una chiave a questo sito?", + "Nothing to approve": "Nulla da approvare", + "Purpose": "Scopo", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet dà a questo sito la stessa chiave ogni volta, su qualsiasi dispositivo con questo portafoglio, e non la dà a nessun altro sito.", + "Site": "Sito", + "The key gives no access to this wallet’s funds, notes or address keys.": "La chiave non dà accesso ai fondi, alle note o alle chiavi d’indirizzo di questo portafoglio.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "Il sito può usare la chiave per agire per te su quel sito, ad esempio per firmare operazioni nel tuo conto di trading lì.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "Ti viene chiesto una volta per ogni scopo; disconnettere il sito cancella la tua risposta.", }; diff --git a/ui/locales/ja.js b/ui/locales/ja.js index b0682819..2d1c49a0 100644 --- a/ui/locales/ja.js +++ b/ui/locales/ja.js @@ -1123,4 +1123,13 @@ export default { "the record does not open with this password": "このパスワードではレコードを開けません", "block {height} has {got} of the {n} transactions its header announced": "ブロック {height} には、ヘッダーが示した {n} 件のトランザクションのうち {got} 件しかありません", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "このプルーバーの鍵は廃止され、もう使われていません。設定で別のプルーバーをペアリングするか、Rand Wallet を最新バージョンに更新してください。", + "{host} asks Rand Wallet for a key of its own.": "{host} が Rand Wallet に専用のキーを求めています。", + "Give this site a key?": "このサイトにキーを渡しますか?", + "Nothing to approve": "承認するものがありません", + "Purpose": "用途", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet は、このウォレットがあるどの端末でも、このサイトに毎回同じキーを渡し、ほかのサイトには渡しません。", + "Site": "サイト", + "The key gives no access to this wallet’s funds, notes or address keys.": "このキーでは、このウォレットの資金、ノート、アドレスのキーにはアクセスできません。", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "サイトはこのキーを使って、そのサイト上であなたの代わりに操作できます。たとえば、そこでのトレード口座で取引に署名します。", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "用途ごとに一度だけ確認されます。サイトとの接続を解除すると、その回答は消去されます。", }; diff --git a/ui/locales/ko.js b/ui/locales/ko.js index 5e582369..ab469f64 100644 --- a/ui/locales/ko.js +++ b/ui/locales/ko.js @@ -1123,4 +1123,13 @@ export default { "the record does not open with this password": "이 비밀번호로는 레코드가 열리지 않습니다", "block {height} has {got} of the {n} transactions its header announced": "블록 {height}에는 헤더가 알린 트랜잭션 {n}개 중 {got}개만 있습니다", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "이 프루버의 키는 폐기되어 더 이상 사용되지 않습니다. 설정에서 다른 프루버를 페어링하거나 Rand Wallet을 최신 버전으로 업데이트하세요.", + "{host} asks Rand Wallet for a key of its own.": "{host}이(가) Rand Wallet에 자체 키를 요청합니다.", + "Give this site a key?": "이 사이트에 키를 줄까요?", + "Nothing to approve": "승인할 항목 없음", + "Purpose": "용도", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet은 이 지갑이 있는 어떤 기기에서든 이 사이트에 매번 같은 키를 주며, 다른 어떤 사이트에도 주지 않습니다.", + "Site": "사이트", + "The key gives no access to this wallet’s funds, notes or address keys.": "이 키로는 이 지갑의 자금, 노트 또는 주소 키에 접근할 수 없습니다.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "사이트는 이 키로 해당 사이트에서 사용자를 대신해 작업할 수 있습니다. 예를 들어 그곳의 거래 계정에서 거래에 서명할 수 있습니다.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "용도마다 한 번만 묻습니다. 사이트 연결을 해제하면 답변이 지워집니다.", }; diff --git a/ui/locales/ms.js b/ui/locales/ms.js index 3ca41a13..6af625ee 100644 --- a/ui/locales/ms.js +++ b/ui/locales/ms.js @@ -1125,4 +1125,13 @@ export default { "the record does not open with this password": "rekod tidak terbuka dengan kata laluan ini", "block {height} has {got} of the {n} transactions its header announced": "blok {height} mengandungi {got} daripada {n} transaksi yang diumumkan oleh pengepalanya", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "Kunci pembukti ini telah dibersarakan dan tidak lagi digunakan. Pasangkan pembukti lain dalam Tetapan, atau kemas kini Rand Wallet ke versi terkini.", + "{host} asks Rand Wallet for a key of its own.": "{host} meminta Rand Wallet satu kunci miliknya sendiri.", + "Give this site a key?": "Beri laman ini satu kunci?", + "Nothing to approve": "Tiada apa-apa untuk diluluskan", + "Purpose": "Tujuan", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet memberi laman ini kunci yang sama setiap kali, pada mana-mana peranti yang mempunyai dompet ini, dan tidak memberikannya kepada laman lain.", + "Site": "Laman", + "The key gives no access to this wallet’s funds, notes or address keys.": "Kunci ini tidak memberi akses kepada dana, nota atau kunci alamat dompet ini.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "Laman ini boleh menggunakan kunci tersebut untuk bertindak bagi pihak anda di laman itu, contohnya untuk menandatangani dagangan dalam akaun dagangan anda di sana.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "Anda ditanya sekali bagi setiap tujuan; memutuskan sambungan laman akan melupakan jawapan anda.", }; diff --git a/ui/locales/pl.js b/ui/locales/pl.js index 77483bfb..8dd399e1 100644 --- a/ui/locales/pl.js +++ b/ui/locales/pl.js @@ -1126,4 +1126,13 @@ export default { "the record does not open with this password": "rekord nie otwiera się tym hasłem", "block {height} has {got} of the {n} transactions its header announced": "blok {height} zawiera {got} z {n} transakcji zapowiedzianych w nagłówku", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "Klucz tego provera został wycofany i nie jest już używany. Sparuj inny prover w Ustawieniach lub zaktualizuj Rand Wallet do najnowszej wersji.", + "{host} asks Rand Wallet for a key of its own.": "{host} prosi Rand Wallet o własny klucz.", + "Give this site a key?": "Dać tej stronie klucz?", + "Nothing to approve": "Nie ma czego zatwierdzić", + "Purpose": "Cel", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet daje tej stronie za każdym razem ten sam klucz, na każdym urządzeniu z tym portfelem, i nie daje go żadnej innej stronie.", + "Site": "Strona", + "The key gives no access to this wallet’s funds, notes or address keys.": "Klucz nie daje dostępu do środków, not ani kluczy adresu tego portfela.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "Strona może używać tego klucza, aby działać w twoim imieniu na tej stronie, na przykład podpisywać transakcje na twoim koncie handlowym.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "Pytanie pada raz dla każdego celu; rozłączenie strony usuwa twoją odpowiedź.", }; diff --git a/ui/locales/ps.js b/ui/locales/ps.js index 5e8313d9..521ce8dd 100644 --- a/ui/locales/ps.js +++ b/ui/locales/ps.js @@ -1130,4 +1130,13 @@ export default { "the record does not open with this password": "ریکارډ د دې پاسورډ سره نه خلاصېږي", "block {height} has {got} of the {n} transactions its header announced": "بلاک {height} د هغو {n} راکړو ورکړو څخه {got} لري چې سرلیک یې اعلان کړې وې", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "د دې ثبوت جوړوونکي کیلي له کاره ایستل شوې او نوره نه کارول کېږي. په امستنو کې بل ثبوت جوړوونکی جوړه کړئ، یا Rand Wallet وروستۍ نسخې ته تازه کړئ.", + "{host} asks Rand Wallet for a key of its own.": "{host} له Rand Wallet څخه خپله ځانګړې کیلي غواړي.", + "Give this site a key?": "دې وېبپاڼې ته کیلي ورکړئ؟", + "Nothing to approve": "د تصویب لپاره هېڅ نشته", + "Purpose": "موخه", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet دې وېبپاڼې ته هر ځل همغه کیلي ورکوي، په هره هغه وسیله چې دا والټ پرې وي، او بلې هېڅ وېبپاڼې ته يې نه ورکوي.", + "Site": "وېبپاڼه", + "The key gives no access to this wallet’s funds, notes or address keys.": "دا کیلي د دې والټ پیسو، نوټونو یا د پتې کیلیو ته هېڅ لاسرسی نه ورکوي.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "وېبپاڼه کولی شي په دې کیلي سره په همدغه وېبپاڼه کې ستاسو په استازیتوب کار وکړي، د بېلګې په توګه هلته ستاسو د سوداګرۍ په حساب کې پر معاملو لاسلیک وکړي.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "د هرې موخې لپاره یو ځل پوښتل کېږئ؛ د وېبپاڼې پرې کول ستاسو ځواب هېروي.", }; diff --git a/ui/locales/pt.js b/ui/locales/pt.js index 66bad687..e426d6b2 100644 --- a/ui/locales/pt.js +++ b/ui/locales/pt.js @@ -1130,4 +1130,13 @@ export default { "the record does not open with this password": "o registro não abre com esta senha", "block {height} has {got} of the {n} transactions its header announced": "o bloco {height} tem {got} das {n} transações que seu cabeçalho anunciou", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "A chave deste provador foi aposentada e não é mais usada. Pareie outro provador em Configurações ou atualize o Rand Wallet para a versão mais recente.", + "{host} asks Rand Wallet for a key of its own.": "{host} pede ao Rand Wallet uma chave própria.", + "Give this site a key?": "Dar uma chave a este site?", + "Nothing to approve": "Nada para aprovar", + "Purpose": "Finalidade", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "O Rand Wallet dá a este site a mesma chave todas as vezes, em qualquer dispositivo com esta carteira, e não a dá a nenhum outro site.", + "Site": "Site", + "The key gives no access to this wallet’s funds, notes or address keys.": "A chave não dá acesso aos fundos, às notas nem às chaves de endereço desta carteira.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "O site pode usar a chave para agir por você nesse site, por exemplo para assinar operações na sua conta de trading lá.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "Você é consultado uma vez para cada finalidade; desconectar o site esquece sua resposta.", }; diff --git a/ui/locales/ru.js b/ui/locales/ru.js index 6e45bb16..608519de 100644 --- a/ui/locales/ru.js +++ b/ui/locales/ru.js @@ -1128,4 +1128,13 @@ export default { "the record does not open with this password": "запись не открывается этим паролем", "block {height} has {got} of the {n} transactions its header announced": "блок {height} содержит {got} из {n} транзакций, объявленных в его заголовке", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "Ключ этого прувера выведен из обращения и больше не используется. Подключите другой прувер в настройках или обновите Rand Wallet до последней версии.", + "{host} asks Rand Wallet for a key of its own.": "{host} просит у Rand Wallet собственный ключ.", + "Give this site a key?": "Выдать этому сайту ключ?", + "Nothing to approve": "Нечего подтверждать", + "Purpose": "Назначение", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet каждый раз выдаёт этому сайту один и тот же ключ — на любом устройстве с этим кошельком — и не выдаёт его никакому другому сайту.", + "Site": "Сайт", + "The key gives no access to this wallet’s funds, notes or address keys.": "Ключ не даёт доступа к средствам, нотам или ключам адреса этого кошелька.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "Сайт может использовать этот ключ, чтобы действовать от вашего имени на этом сайте, например подписывать сделки в вашем торговом аккаунте на нём.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "Вас спрашивают один раз для каждого назначения; при отключении сайта ваш ответ забывается.", }; diff --git a/ui/locales/ta.js b/ui/locales/ta.js index d7ba65b3..df817a62 100644 --- a/ui/locales/ta.js +++ b/ui/locales/ta.js @@ -1130,4 +1130,13 @@ export default { "the record does not open with this password": "இந்தக் கடவுச்சொல்லால் பதிவு திறக்கவில்லை", "block {height} has {got} of the {n} transactions its header announced": "தொகுதி {height} அதன் தலைப்பு அறிவித்த {n} பரிவர்த்தனைகளில் {got} மட்டுமே கொண்டுள்ளது", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "இந்த நிரூபிப்பானின் விசை நீக்கப்பட்டது, இனி பயன்படுத்தப்படாது. அமைப்புகளில் வேறொரு நிரூபிப்பானை இணைக்கவும், அல்லது Rand Wallet ஐச் சமீபத்திய பதிப்புக்குப் புதுப்பிக்கவும்.", + "{host} asks Rand Wallet for a key of its own.": "{host} Rand Wallet-இடம் தனக்கென ஒரு விசையைக் கேட்கிறது.", + "Give this site a key?": "இந்தத் தளத்துக்கு ஒரு விசையைக் கொடுக்கவா?", + "Nothing to approve": "ஒப்புதல் அளிக்க எதுவும் இல்லை", + "Purpose": "நோக்கம்", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "இந்த வாலட் உள்ள எந்தச் சாதனத்திலும், Rand Wallet இந்தத் தளத்துக்கு ஒவ்வொரு முறையும் அதே விசையைக் கொடுக்கும்; வேறு எந்தத் தளத்துக்கும் அதைக் கொடுக்காது.", + "Site": "தளம்", + "The key gives no access to this wallet’s funds, notes or address keys.": "இந்த விசை இந்த வாலட்டின் நிதி, நோட்டுகள் அல்லது முகவரி விசைகளுக்கு எந்த அணுகலையும் தராது.", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "அந்தத் தளத்தில் உங்கள் சார்பாகச் செயல்பட தளம் இந்த விசையைப் பயன்படுத்தலாம், எடுத்துக்காட்டாக அங்குள்ள உங்கள் வர்த்தகக் கணக்கில் வர்த்தகங்களில் கையொப்பமிட.", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "ஒவ்வொரு நோக்கத்துக்கும் ஒருமுறை மட்டுமே கேட்கப்படும்; தளத்தைத் துண்டித்தால் உங்கள் பதில் மறக்கப்படும்.", }; diff --git a/ui/locales/ur.js b/ui/locales/ur.js index 372df529..f2b3d393 100644 --- a/ui/locales/ur.js +++ b/ui/locales/ur.js @@ -1131,4 +1131,13 @@ export default { "the record does not open with this password": "ریکارڈ اس پاس ورڈ سے نہیں کھلتا", "block {height} has {got} of the {n} transactions its header announced": "بلاک {height} میں اس کے ہیڈر کے اعلان کردہ {n} لین دین میں سے {got} ہیں", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "اس پروور کی کی ختم کر دی گئی ہے اور اب استعمال نہیں ہوتی۔ ترتیبات میں کوئی دوسرا پروور جوڑیں، یا Rand Wallet کو تازہ ترین ورژن پر اپ ڈیٹ کریں۔", + "{host} asks Rand Wallet for a key of its own.": "{host} Rand Wallet سے اپنی الگ کی مانگ رہی ہے۔", + "Give this site a key?": "اس سائٹ کو کی دیں؟", + "Nothing to approve": "منظوری کے لیے کچھ نہیں", + "Purpose": "مقصد", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet اس سائٹ کو ہر بار وہی کی دیتا ہے، کسی بھی ایسے آلے پر جس میں یہ والیٹ ہو، اور کسی دوسری سائٹ کو نہیں دیتا۔", + "Site": "سائٹ", + "The key gives no access to this wallet’s funds, notes or address keys.": "یہ کی اس والیٹ کے فنڈز، نوٹس یا پتے کی کیز تک کوئی رسائی نہیں دیتی۔", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "سائٹ اس کی سے اسی سائٹ پر آپ کی طرف سے کام کر سکتی ہے، مثلاً وہاں آپ کے ٹریڈنگ اکاؤنٹ میں سودوں پر دستخط کرنا۔", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "ہر مقصد کے لیے آپ سے ایک بار پوچھا جاتا ہے؛ سائٹ کا رابطہ منقطع کرنے پر آپ کا جواب بھلا دیا جاتا ہے۔", }; diff --git a/ui/locales/zh-hk.js b/ui/locales/zh-hk.js index 42da4cb2..dc3be005 100644 --- a/ui/locales/zh-hk.js +++ b/ui/locales/zh-hk.js @@ -1123,4 +1123,13 @@ export default { "the record does not open with this password": "此密碼無法開啟該記錄", "block {height} has {got} of the {n} transactions its header announced": "區塊 {height} 只有 {got} 筆交易,而其區塊頭宣告了 {n} 筆", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "此證明器的密鑰已停用,不再使用。請在設定中配對另一個證明器,或將 Rand Wallet 更新至最新版本。", + "{host} asks Rand Wallet for a key of its own.": "{host} 向 Rand Wallet 索取一個屬於它自己的密鑰。", + "Give this site a key?": "要給這個網站一個密鑰嗎?", + "Nothing to approve": "沒有需要批准的項目", + "Purpose": "用途", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet 每次都給這個網站同一個密鑰(在任何載有此錢包的裝置上都一樣),而且不會把它給任何其他網站。", + "Site": "網站", + "The key gives no access to this wallet’s funds, notes or address keys.": "此密鑰無法存取此錢包的資金、票據或地址密鑰。", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "該網站可以用這個密鑰在該網站上代你操作,例如在你於該處的交易帳戶中簽署交易。", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "每種用途只會問你一次;與該網站中斷連接會清除你的答覆。", }; diff --git a/ui/locales/zh.js b/ui/locales/zh.js index 5827697b..c2aa13a5 100644 --- a/ui/locales/zh.js +++ b/ui/locales/zh.js @@ -1123,4 +1123,13 @@ export default { "the record does not open with this password": "此密码无法打开该记录", "block {height} has {got} of the {n} transactions its header announced": "区块 {height} 只有 {got} 笔交易,而其区块头声明了 {n} 笔", "This prover's key was retired and is no longer used. Pair another prover in Settings, or update Rand Wallet to the latest version.": "此证明器的密钥已停用,不再使用。请在设置中配对另一个证明器,或将 Rand Wallet 更新到最新版本。", + "{host} asks Rand Wallet for a key of its own.": "{host} 向 Rand Wallet 请求一个它自己的密钥。", + "Give this site a key?": "要给这个网站一个密钥吗?", + "Nothing to approve": "没有需要批准的内容", + "Purpose": "用途", + "Rand Wallet gives this site the same key every time, on any device with this wallet, and gives it to no other site.": "Rand Wallet 每次都给这个网站同一个密钥(在任何装有此钱包的设备上都一样),且不会把它给任何其他网站。", + "Site": "网站", + "The key gives no access to this wallet’s funds, notes or address keys.": "此密钥无法访问此钱包的资金、票据或地址密钥。", + "The site can use the key to act for you on that site, for example to sign trades in your trading account there.": "该网站可以用这个密钥在该网站上代你操作,例如在你在那里的交易账户中签署交易。", + "You are asked once for each purpose; disconnecting the site forgets your answer.": "每种用途只询问你一次;断开与该网站的连接会清除你的回答。", };