[{"data":1,"prerenderedAt":804},["ShallowReactive",2],{"navigation":3,"\u002Fguides\u002Fsessions":116,"\u002Fguides\u002Fsessions-surround":799},[4,27,61,82,112],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":26},"Getting started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,14,18,22],{"title":11,"path":12,"stem":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction",{"title":15,"path":16,"stem":17},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation",{"title":19,"path":20,"stem":21},"Quick start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start",{"title":23,"path":24,"stem":25},"Development","\u002Fgetting-started\u002Fdevelopment","1.getting-started\u002F4.development",false,{"title":28,"icon":29,"path":30,"stem":31,"children":32,"page":26},"Guides","i-lucide-book-open","\u002Fguides","2.guides",[33,37,41,45,49,53,57],{"title":34,"path":35,"stem":36},"Sessions and store","\u002Fguides\u002Fsessions","2.guides\u002F1.sessions",{"title":38,"path":39,"stem":40},"Vault and procedures","\u002Fguides\u002Fvault","2.guides\u002F2.vault",{"title":42,"path":43,"stem":44},"Password accounts","\u002Fguides\u002Fpasswords","2.guides\u002F3.passwords",{"title":46,"path":47,"stem":48},"Rust backend","\u002Fguides\u002Frust","2.guides\u002F4.rust",{"title":50,"path":51,"stem":52},"Security notes","\u002Fguides\u002Fsecurity","2.guides\u002F5.security",{"title":54,"path":55,"stem":56},"Permissions","\u002Fguides\u002Fpermissions","2.guides\u002F6.permissions",{"title":58,"path":59,"stem":60},"Coming from Stronghold","\u002Fguides\u002Fstronghold","2.guides\u002F7.stronghold",{"title":62,"icon":63,"path":64,"stem":65,"children":66,"page":26},"API reference","i-lucide-file-code","\u002Freference","3.reference",[67,71,75,79],{"title":68,"path":69,"stem":70},"JavaScript API","\u002Freference\u002Fjavascript-api","3.reference\u002F1.javascript-api",{"title":72,"path":73,"stem":74},"Types","\u002Freference\u002Ftypes","3.reference\u002F2.types",{"title":76,"path":77,"stem":78},"Tauri commands","\u002Freference\u002Fcommands","3.reference\u002F3.commands",{"title":54,"path":80,"stem":81},"\u002Freference\u002Fpermissions","3.reference\u002F4.permissions",{"title":83,"icon":84,"path":85,"stem":86,"children":87,"page":26},"Platforms","i-lucide-monitor-smartphone","\u002Fplatforms","4.platforms",[88,92,96,100,104,108],{"title":89,"path":90,"stem":91},"Overview","\u002Fplatforms\u002Foverview","4.platforms\u002F1.overview",{"title":93,"path":94,"stem":95},"macOS","\u002Fplatforms\u002Fmacos","4.platforms\u002F2.macos",{"title":97,"path":98,"stem":99},"Windows","\u002Fplatforms\u002Fwindows","4.platforms\u002F3.windows",{"title":101,"path":102,"stem":103},"Linux","\u002Fplatforms\u002Flinux","4.platforms\u002F4.linux",{"title":105,"path":106,"stem":107},"Android","\u002Fplatforms\u002Fandroid","4.platforms\u002F5.android",{"title":109,"path":110,"stem":111},"iOS","\u002Fplatforms\u002Fios","4.platforms\u002F6.ios",{"title":113,"path":114,"stem":115},"Changelog","\u002Fchangelog","9.changelog",{"id":117,"title":34,"body":118,"description":793,"extension":794,"generated":26,"links":795,"meta":796,"navigation":202,"path":35,"seo":797,"stem":36,"__hash__":798},"docs\u002F2.guides\u002F1.sessions.md",{"type":119,"value":120,"toc":784},"minimark",[121,152,448,453,464,511,514,518,538,542,586,589,610,613,670,684,688,712,716,719,753,768,777,780],[122,123,124,125,129,130,134,135,138,139,142,143,146,147,151],"p",{},"The session API follows ",[126,127,128],"code",{},"tauri-plugin-stronghold",": a ",[131,132,133],"strong",{},"session"," (Stronghold: snapshot) holds\n",[131,136,137],{},"clients",", each client has a ",[131,140,141],{},"store"," (key → bytes) and any number of ",[131,144,145],{},"vaults","\n(",[148,149,150],"a",{"href":39},"next guide",").",[153,154,159],"pre",{"className":155,"code":156,"language":157,"meta":158,"style":158},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { KeyringSession } from \"tauri-plugin-keyring-store-api\";\n\nconst session = await KeyringSession.load(\"\u002Fapp\u002Fsecrets\", \"\");\nconst client = await session.loadClient(\"desktop\");\nconst store = client.getStore();\n\nawait store.insert(\"settings.json\", new TextEncoder().encode('{\"theme\":\"dark\"}'));\nconst bytes = await store.get(\"settings.json\");\nconst json = bytes && new TextDecoder().decode(bytes);\n\nawait session.unload();\n","ts","",[126,160,161,197,204,250,283,306,311,364,395,427,432],{"__ignoreMap":158},[162,163,166,170,174,178,181,184,187,191,194],"span",{"class":164,"line":165},"line",1,[162,167,169],{"class":168},"s7zQu","import",[162,171,173],{"class":172},"sMK4o"," {",[162,175,177],{"class":176},"sTEyZ"," KeyringSession",[162,179,180],{"class":172}," }",[162,182,183],{"class":168}," from",[162,185,186],{"class":172}," \"",[162,188,190],{"class":189},"sfazB","tauri-plugin-keyring-store-api",[162,192,193],{"class":172},"\"",[162,195,196],{"class":172},";\n",[162,198,200],{"class":164,"line":199},2,[162,201,203],{"emptyLinePlaceholder":202},true,"\n",[162,205,207,211,214,217,220,222,225,229,232,234,237,239,242,245,248],{"class":164,"line":206},3,[162,208,210],{"class":209},"spNyl","const",[162,212,213],{"class":176}," session ",[162,215,216],{"class":172},"=",[162,218,219],{"class":168}," await",[162,221,177],{"class":176},[162,223,224],{"class":172},".",[162,226,228],{"class":227},"s2Zo4","load",[162,230,231],{"class":176},"(",[162,233,193],{"class":172},[162,235,236],{"class":189},"\u002Fapp\u002Fsecrets",[162,238,193],{"class":172},[162,240,241],{"class":172},",",[162,243,244],{"class":172}," \"\"",[162,246,247],{"class":176},")",[162,249,196],{"class":172},[162,251,253,255,258,260,262,265,267,270,272,274,277,279,281],{"class":164,"line":252},4,[162,254,210],{"class":209},[162,256,257],{"class":176}," client ",[162,259,216],{"class":172},[162,261,219],{"class":168},[162,263,264],{"class":176}," session",[162,266,224],{"class":172},[162,268,269],{"class":227},"loadClient",[162,271,231],{"class":176},[162,273,193],{"class":172},[162,275,276],{"class":189},"desktop",[162,278,193],{"class":172},[162,280,247],{"class":176},[162,282,196],{"class":172},[162,284,286,288,291,293,296,298,301,304],{"class":164,"line":285},5,[162,287,210],{"class":209},[162,289,290],{"class":176}," store ",[162,292,216],{"class":172},[162,294,295],{"class":176}," client",[162,297,224],{"class":172},[162,299,300],{"class":227},"getStore",[162,302,303],{"class":176},"()",[162,305,196],{"class":172},[162,307,309],{"class":164,"line":308},6,[162,310,203],{"emptyLinePlaceholder":202},[162,312,314,317,320,322,325,327,329,332,334,336,339,342,344,346,349,351,354,357,359,362],{"class":164,"line":313},7,[162,315,316],{"class":168},"await",[162,318,319],{"class":176}," store",[162,321,224],{"class":172},[162,323,324],{"class":227},"insert",[162,326,231],{"class":176},[162,328,193],{"class":172},[162,330,331],{"class":189},"settings.json",[162,333,193],{"class":172},[162,335,241],{"class":172},[162,337,338],{"class":172}," new",[162,340,341],{"class":227}," TextEncoder",[162,343,303],{"class":176},[162,345,224],{"class":172},[162,347,348],{"class":227},"encode",[162,350,231],{"class":176},[162,352,353],{"class":172},"'",[162,355,356],{"class":189},"{\"theme\":\"dark\"}",[162,358,353],{"class":172},[162,360,361],{"class":176},"))",[162,363,196],{"class":172},[162,365,367,369,372,374,376,378,380,383,385,387,389,391,393],{"class":164,"line":366},8,[162,368,210],{"class":209},[162,370,371],{"class":176}," bytes ",[162,373,216],{"class":172},[162,375,219],{"class":168},[162,377,319],{"class":176},[162,379,224],{"class":172},[162,381,382],{"class":227},"get",[162,384,231],{"class":176},[162,386,193],{"class":172},[162,388,331],{"class":189},[162,390,193],{"class":172},[162,392,247],{"class":176},[162,394,196],{"class":172},[162,396,398,400,403,405,407,410,412,415,417,419,422,425],{"class":164,"line":397},9,[162,399,210],{"class":209},[162,401,402],{"class":176}," json ",[162,404,216],{"class":172},[162,406,371],{"class":176},[162,408,409],{"class":172},"&&",[162,411,338],{"class":172},[162,413,414],{"class":227}," TextDecoder",[162,416,303],{"class":176},[162,418,224],{"class":172},[162,420,421],{"class":227},"decode",[162,423,424],{"class":176},"(bytes)",[162,426,196],{"class":172},[162,428,430],{"class":164,"line":429},10,[162,431,203],{"emptyLinePlaceholder":202},[162,433,435,437,439,441,444,446],{"class":164,"line":434},11,[162,436,316],{"class":168},[162,438,264],{"class":176},[162,440,224],{"class":172},[162,442,443],{"class":227},"unload",[162,445,303],{"class":176},[162,447,196],{"class":172},[449,450,452],"h2",{"id":451},"the-session-path-is-not-a-file","The session path is not a file",[122,454,455,456,459,460,463],{},"The first argument of ",[126,457,458],{},"KeyringSession.load(path, password)"," is ",[131,461,462],{},"not"," a path on disk, on any OS. It\nis a logical id: the plugin hashes it, together with the client, vault and record names, into the\naccount name of each OS keyring entry.",[465,466,467,480],"table",{},[468,469,470],"thead",{},[471,472,473,477],"tr",{},[474,475,476],"th",{},"You pass",[474,478,479],{},"Effect",[481,482,483,492,500],"tbody",{},[471,484,485,489],{},[486,487,488],"td",{},"The same string on every platform",[486,490,491],{},"The same namespace everywhere (the usual case).",[471,493,494,497],{},[486,495,496],{},"Different strings",[486,498,499],{},"Separate namespaces, e.g. one per user or per wallet.",[471,501,502,508],{},[486,503,504,505],{},"Something that looks like a path, e.g. ",[126,506,507],{},"\u002Fwallet\u002Fmain",[486,509,510],{},"Fine: it is only a label, no folder has to exist.",[122,512,513],{},"Use stable ASCII-like ids. Changing the id later makes the old entries unreachable through the API\n(they stay in the OS store).",[449,515,517],{"id":516},"the-password-is-not-checked","The password is not checked",[122,519,520,523,524,527,528,531,532,535,536,224],{},[126,521,522],{},"password"," exists for Stronghold compatibility. It is ",[131,525,526],{},"not verified",": any password opens any\nsession, and it encrypts nothing. Rust wipes it at once and never stores or compares it. Pass ",[126,529,530],{},"\"\"","\nunless you are migrating code that already passes one. Access control comes from the OS store and\nthe plugin ",[148,533,534],{"href":55},"permissions","; see ",[148,537,50],{"href":51},[449,539,541],{"id":540},"session-lifetime","Session lifetime",[543,544,545,556,562,574,580],"ul",{},[546,547,548,551,552,555],"li",{},[126,549,550],{},"KeyringSession.load"," (",[126,553,554],{},"initialize",") adds the path to an in-memory list of loaded sessions of this process.",[546,557,558,559,224],{},"Store, vault and procedure calls on a path that is not loaded fail with\n",[126,560,561],{},"session not initialized: \u003Cpath>",[546,563,564,551,567,570,571,573],{},[126,565,566],{},"session.unload()",[126,568,569],{},"destroy",") removes the path from the list. The entries are ",[131,572,462],{}," deleted.",[546,575,576,579],{},[126,577,578],{},"session.save()"," writes nothing (every write is already in the OS store) but fails like Stronghold\nwhen the session is not loaded.",[546,581,582,583,585],{},"The list is per process: after an app restart call ",[126,584,228],{}," again.",[449,587,588],{"id":137},"Clients",[122,590,591,594,595,598,599,602,603,594,606,609],{},[126,592,593],{},"session.createClient(name)"," and ",[126,596,597],{},"session.loadClient(name)"," do the same thing: check that the session\nis loaded and return a ",[126,600,601],{},"KeyringClient",". A client needs no creation in the OS store; both exist for\nStronghold parity. ",[126,604,605],{},"client.getStore()",[126,607,608],{},"client.getVault(name)"," make no IPC call.",[449,611,612],{"id":141},"Store",[465,614,615,625],{},[468,616,617],{},[471,618,619,622],{},[474,620,621],{},"Method",[474,623,624],{},"Does",[481,626,627,644,658],{},[471,628,629,634],{},[486,630,631],{},[126,632,633],{},"get(key)",[486,635,636,637,640,641,224],{},"Resolves to the bytes (",[126,638,639],{},"Uint8Array",") or ",[126,642,643],{},"null",[471,645,646,651],{},[486,647,648],{},[126,649,650],{},"insert(key, value, lifetime?)",[486,652,653,654,657],{},"Writes the record, replacing an existing one. ",[126,655,656],{},"lifetime"," is ignored: OS stores have no expiry.",[471,659,660,665],{},[486,661,662],{},[126,663,664],{},"remove(key)",[486,666,667,668,224],{},"Deletes the record and resolves to its previous bytes, or ",[126,669,643],{},[122,671,672,673,676,677,679,680,683],{},"Values are ",[126,674,675],{},"number[]"," or ",[126,678,639],{},". Store the text of JSON with ",[126,681,682],{},"TextEncoder"," as above.",[449,685,687],{"id":686},"text-or-byte-ids","Text or byte ids",[122,689,690,691,693,694,697,698,700,701,704,705,708,709,224],{},"Client, vault, record and store key names may be strings or bytes (",[126,692,639],{},", ",[126,695,696],{},"ArrayBuffer",",\n",[126,699,675],{},"). A byte id that equals the UTF-8 of a text id is the ",[131,702,703],{},"same"," id: ",[126,706,707],{},"store.get([107])","\nreads the record written with ",[126,710,711],{},"store.insert(\"k\", …)",[449,713,715],{"id":714},"how-names-become-entries","How names become entries",[122,717,718],{},"Every record is one OS keyring entry under your service name. Its account is built from the first\n8 bytes (16 hex characters) of the SHA-256 of each name:",[465,720,721,731],{},[468,722,723],{},[471,724,725,728],{},[474,726,727],{},"Kind",[474,729,730],{},"Account",[481,732,733,743],{},[471,734,735,738],{},[486,736,737],{},"Store record",[486,739,740],{},[126,741,742],{},"kp:v1:\u003Csession>:\u003Cclient>:st:\u003Ckey>",[471,744,745,748],{},[486,746,747],{},"Vault record",[486,749,750],{},[126,751,752],{},"kp:v1:\u003Csession>:\u003Cclient>:v:\u003Cvault>:\u003Crecord>",[122,754,755,756,759,760,764,765,224],{},"So names of any length fit OS limits, and the OS store shows only hashes. The ",[126,757,758],{},"kp:"," prefix is\nreserved: the ",[148,761,763],{"href":762},"\u002Fguides\u002Fpasswords#reserved-accounts","password commands"," refuse it so the webview cannot\nread vault keys through ",[126,766,767],{},"getPasswords",[122,769,770,771,774,775,224],{},"Values are stored as Base64 text. On Windows this limits a store record or vault secret to about\n",[131,772,773],{},"960 bytes",", see ",[148,776,97],{"href":98},[122,778,779],{},"The OS stores cannot list entries, so neither can the plugin: keep your own index of keys if you\nneed one.",[781,782,783],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":158,"searchDepth":199,"depth":206,"links":785},[786,787,788,789,790,791,792],{"id":451,"depth":199,"text":452},{"id":516,"depth":199,"text":517},{"id":540,"depth":199,"text":541},{"id":137,"depth":199,"text":588},{"id":141,"depth":199,"text":612},{"id":686,"depth":199,"text":687},{"id":714,"depth":199,"text":715},"KeyringSession, clients and the key-value byte store, and how their names map to OS keyring entries.","md",null,{},{"title":34,"description":793},"YTtF-i5Aikq2uTf0mxHq6qHITte-HtRWxzBafFUTxak",[800,802],{"title":23,"path":24,"stem":25,"description":801,"children":-1},"Build, lint and test the plugin, the JavaScript package, the example app and this site.",{"title":38,"path":39,"stem":40,"description":803,"children":-1},"Vault records, locations, and the SLIP10 \u002F BIP39 \u002F Ed25519 procedures that keep private keys in Rust.",1794215488497]