<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi there,&nbsp;<div><br></div><div>an initial commit of a simple property list based store has been merged. It can be used using the regular store interface just passing a PLIST type during creation.</div><div><br></div><div>A simple example storing e.g. an otp secret</div><div><br></div><div><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC1" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="c1" style="color: rgb(153, 153, 136); font-style: italic; ">// initalize plist store (if the file does not exist it will be created)</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC2" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="n">AGDataManager</span><span class="o" style="font-weight: bold; ">*</span> <span class="n">manager</span> <span class="o" style="font-weight: bold; ">=</span> <span class="p">[</span><span class="n">AGDataManager</span> <span class="n">manager</span><span class="p">];</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC3" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="kt" style="color: rgb(68, 85, 136); font-weight: bold; ">id</span><span class="o" style="font-weight: bold; ">&lt;</span><span class="n">AGStore</span><span class="o" style="font-weight: bold; ">&gt;</span> <span class="n">plistStore</span> <span class="o" style="font-weight: bold; ">=</span> <span class="p">[</span><span class="n">manager</span> <span class="nl">store:</span><span class="o" style="font-weight: bold; ">^</span><span class="p">(</span><span class="kt" style="color: rgb(68, 85, 136); font-weight: bold; ">id</span><span class="o" style="font-weight: bold; ">&lt;</span><span class="n">AGStoreConfig</span><span class="o" style="font-weight: bold; ">&gt;</span> <span class="n">config</span><span class="p">)</span> <span class="p">{</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC4" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">        <span class="p">[</span><span class="n">config</span> <span class="nl">setName:</span><span class="s" style="color: rgb(221, 17, 68); ">@"secrets"</span><span class="p">];</span> <span class="c1" style="color: rgb(153, 153, 136); font-style: italic; ">// will be used as the filename for the plist</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC5" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">        <span class="p">[</span><span class="n">config</span> <span class="nl">setType:</span><span class="s" style="color: rgb(221, 17, 68); ">@"PLIST"</span><span class="p">];</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC6" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="p">}];</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC7" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">&nbsp;</div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC8" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="c1" style="color: rgb(153, 153, 136); font-style: italic; ">// the object to save</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC9" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="n">NSDictionary</span> <span class="o" style="font-weight: bold; ">*</span><span class="n">otp</span> <span class="o" style="font-weight: bold; ">=</span> <span class="p">[</span><span class="n">NSDictionary</span> <span class="nl">dictionaryWithObjectsAndKeys:</span><span class="s" style="color: rgb(221, 17, 68); ">@"19a01df0281afcdbe"</span><span class="p">,</span> <span class="s" style="color: rgb(221, 17, 68); ">@"otp"</span><span class="p">,</span> <span class="s" style="color: rgb(221, 17, 68); ">@"1"</span><span class="p">,</span> <span class="s" style="color: rgb(221, 17, 68); ">@"id"</span><span class="p">,</span> <span class="nb" style="color: rgb(0, 134, 179); ">nil</span><span class="p">];</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC10" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="c1" style="color: rgb(153, 153, 136); font-style: italic; ">// save it</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC11" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="p">[</span><span class="n">plistStore</span> <span class="nl">save:</span><span class="n">otp</span> <span class="nl">success:</span><span class="o" style="font-weight: bold; ">^</span><span class="p">(</span><span class="kt" style="color: rgb(68, 85, 136); font-weight: bold; ">id</span> <span class="n">object</span><span class="p">)</span> <span class="p">{</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC12" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">      <span class="n">STAssertNotNil</span><span class="p">(</span><span class="n">object</span><span class="p">,</span> <span class="s" style="color: rgb(221, 17, 68); ">@"object should not be nil"</span><span class="p">);</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC13" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">  <span class="p">}</span> <span class="nl">failure:</span><span class="o" style="font-weight: bold; ">^</span><span class="p">(</span><span class="n">NSError</span> <span class="o" style="font-weight: bold; ">*</span><span class="n">error</span><span class="p">)</span> <span class="p">{</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC14" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">      <span class="n">NSLog</span><span class="p">(</span><span class="s" style="color: rgb(221, 17, 68); ">@"error: %@"</span><span class="p">,</span> <span class="n">error</span><span class="p">);</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC15" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="p">}];</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC16" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">&nbsp;</div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC17" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="c1" style="color: rgb(153, 153, 136); font-style: italic; ">//... at some later time </span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC18" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="c1" style="color: rgb(153, 153, 136); font-style: italic; ">// initialize store from file</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC19" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="kt" style="color: rgb(68, 85, 136); font-weight: bold; ">id</span><span class="o" style="font-weight: bold; ">&lt;</span><span class="n">AGStore</span><span class="o" style="font-weight: bold; ">&gt;</span> <span class="n">plistStore</span> <span class="o" style="font-weight: bold; ">=</span> <span class="p">[</span><span class="n">manager</span> <span class="nl">store:</span><span class="o" style="font-weight: bold; ">^</span><span class="p">(</span><span class="kt" style="color: rgb(68, 85, 136); font-weight: bold; ">id</span><span class="o" style="font-weight: bold; ">&lt;</span><span class="n">AGStoreConfig</span><span class="o" style="font-weight: bold; ">&gt;</span> <span class="n">config</span><span class="p">)</span> <span class="p">{</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); position: static; z-index: auto; "><div class="line" id="file-gistfile1-m-LC20" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">        <span class="p">[</span><span class="n">config</span> <span class="nl">setName:</span><span class="s" style="color: rgb(221, 17, 68); ">@"secrets"</span><span class="p">];</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC21" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">        <span class="p">[</span><span class="n">config</span> <span class="nl">setType:</span><span class="s" style="color: rgb(221, 17, 68); ">@"PLIST"</span><span class="p">];</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC22" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="p">}];</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC23" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">&nbsp;</div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC24" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="c1" style="color: rgb(153, 153, 136); font-style: italic; ">// read the otp</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC25" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="p">[</span><span class="n">plistStore</span> <span class="nl">read:</span><span class="s" style="color: rgb(221, 17, 68); ">@"1"</span> <span class="nl">success:</span><span class="o" style="font-weight: bold; ">^</span><span class="p">(</span><span class="kt" style="color: rgb(68, 85, 136); font-weight: bold; ">id</span> <span class="n">object</span><span class="p">)</span> <span class="p">{</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC26" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">        <span class="n">NSLog</span><span class="p">(</span><span class="s" style="color: rgb(221, 17, 68); ">@"otp secret is: %@"</span><span class="p">,</span> <span class="p">[</span><span class="n">object</span> <span class="nl">objectForKey:</span><span class="s" style="color: rgb(221, 17, 68); ">@"otp"</span><span class="p">);</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC27" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">    <span class="p">}</span> <span class="nl">failure:</span><span class="o" style="font-weight: bold; ">^</span><span class="p">(</span><span class="n">NSError</span> <span class="o" style="font-weight: bold; ">*</span><span class="n">error</span><span class="p">)</span> <span class="p">{</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); "><div class="line" id="file-gistfile1-m-LC28" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; ">        <span class="n">NSLog</span><span class="p">(</span><span class="s" style="color: rgb(221, 17, 68); ">@"error: %@"</span><span class="p">,</span> <span class="n">error</span><span class="p">);</span></div></pre><pre style="font-size: 12px; line-height: 1.4; font-family: Consolas, 'Liberation Mono', Courier, monospace; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; background-color: rgb(255, 255, 255); position: static; z-index: auto; "><div class="line" id="file-gistfile1-m-LC29" style="padding-top: 0px; padding-bottom: 0px; padding-left: 1em; "><span class="p">}];</span></div><div><span class="p"><br></span></div></pre></div><div><div>Let me know if you have comments/suggestions</div><div><br></div><div>Thanks</div><div>Christos</div><div><br></div><div><br></div><div>On Jan 8, 2013, at 4:38 PM, Christos Vasilakis &lt;<a href="mailto:cvasilak@gmail.com">cvasilak@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi team,<br><br>fyi,<br>in order to have some long-term storage of data (for example storing the OTP secret), I am writing a simple PropertyList based implementation of AGStore. It will provide the same interface as the AGStore that is save, read and remove of data and internally will use the Property List mechanism for iOS. &nbsp;As with all other implementations, a configuration object will be used to passed &nbsp;in the parameters (e.g. filename of the archive etc.) . A ticket has been opened to track this [1].<br><br>More info as I progress.<br><br>Thanks,<br>Christos<br><br>[1] <a href="https://issues.jboss.org/browse/AEROGEAR-783">https://issues.jboss.org/browse/AEROGEAR-783</a><br><br><br><br></blockquote></div><br></body></html>