You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
9.2 KiB
1 lines
9.2 KiB
var T=Object.defineProperty;var Z=(a,e,t)=>e in a?T(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var d=(a,e,t)=>Z(a,typeof e!="symbol"?e+"":e,t);import{r as h,aW as I,aU as b,aX as R,aY as k,aZ as N,a_ as U,a$ as C,b0 as S,b as f}from"./index-MyY_xqVN.js";import{r as M,V as B,f as j,e as w,A as J,C as E,_ as Y,g as y,h as V,i as W,j as s,k as p,p as A,w as O,l as H,t as D,F as G,x as m}from"./index-BLqts8WY.js";import{Q as $}from"./QuickNav-DgCyvgDx.js";import"./index-CsfPLOYu.js";var P=Object.defineProperty,Q=Object.getOwnPropertyDescriptor,X=(a,e,t,o)=>{for(var i=o>1?void 0:o?Q(e,t):e,r=a.length-1,l;r>=0;r--)(l=a[r])&&(i=(o?l(e,t,i):l(i))||i);return o&&i&&P(e,t,i),i};const g=M(),F={vc:{credentialSubject:{"@context":"https://schema.org","@type":"GiveAction",description:"pizza"}}};let v=class extends B{constructor(){super(...arguments);d(this,"$notify");d(this,"fileName");d(this,"credIdHex");d(this,"activeDid");d(this,"jwt");d(this,"peerSetup");d(this,"userName")}async mounted(){const e=await j();this.activeDid=e.activeDid||"",this.userName=e.firstName;const t=await h(this.activeDid);this.activeDid&&(t?this.credIdHex=t.passkeyCredIdHex:alert("No account found for DID "+this.activeDid))}async uploadFile(e){var o;g.value=(o=e.target)==null?void 0:o.files[0];const t=g.value;if(t!=null){const i=new FileReader;i.onload=async r=>{var u;const l=(u=r.target)==null?void 0:u.result;if(l){const c=new Blob([new Uint8Array(l)],{type:t.type}),n=await I(c);this.fileName=t.name,await w.temp.get(b)?await w.temp.update(b,{blobB64:n}):await w.temp.add({id:b,blobB64:n})}},i.readAsArrayBuffer(t)}}showFileNextStep(){return!!g.value}async register(){const e=J.APP_NAME+" Tester";if(!this.userName){this.$notify({group:"modal",type:"confirm",title:"No Name",text:"You should have a name to attach to this passkey. Would you like to enter your own name first?",onNo:async()=>{this.userName=e},onYes:async()=>{this.$router.push({name:"new-edit-account"})},noText:"try again and use "+e},-1);return}const t=await R(J.APP_NAME+" - "+this.userName);this.activeDid=t.did,this.credIdHex=t.passkeyCredIdHex}async createJwtSimplewebauthn(){const e=await h(this.activeDid||"");if(!k(e)){alert(`The DID ${this.activeDid} is not passkey-enabled.`);return}this.peerSetup=new N,this.jwt=await this.peerSetup.createJwtSimplewebauthn(this.activeDid,F,this.credIdHex),console.log("simple jwt4url",this.jwt)}async createJwtNavigator(){const e=await h(this.activeDid||"");if(!k(e)){alert(`The DID ${this.activeDid} is not passkey-enabled.`);return}this.peerSetup=new N,this.jwt=await this.peerSetup.createJwtNavigator(this.activeDid,F,this.credIdHex),console.log("lower jwt4url",this.jwt)}async verifyP256(){var t,o,i,r;const e=await U(this.credIdHex,this.activeDid,(t=this.peerSetup)==null?void 0:t.authenticatorData,(o=this.peerSetup)==null?void 0:o.challenge,(i=this.peerSetup)==null?void 0:i.clientDataJsonBase64Url,(r=this.peerSetup)==null?void 0:r.signature);console.log("decoded",e)}async verifySimplewebauthn(){var t,o,i,r;const e=await C(this.credIdHex,this.activeDid,(t=this.peerSetup)==null?void 0:t.authenticatorData,(o=this.peerSetup)==null?void 0:o.challenge,(i=this.peerSetup)==null?void 0:i.clientDataJsonBase64Url,(r=this.peerSetup)==null?void 0:r.signature);console.log("decoded",e)}async verifyWebCrypto(){var t,o,i,r;const e=await S(this.credIdHex,this.activeDid,(t=this.peerSetup)==null?void 0:t.authenticatorData,(o=this.peerSetup)==null?void 0:o.challenge,(i=this.peerSetup)==null?void 0:i.clientDataJsonBase64Url,(r=this.peerSetup)==null?void 0:r.signature);console.log("decoded",e)}async verifyMyJwt(){const e="did:peer:0zKMFjvUgYrM1hXwDciYHiA9MxXtJPXnRLJvqoMNAKoDLX9pKMWLb3VDsgua1p2zW1xXRsjZSTNsfvMnNyMS7dB4k7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UtvRExYOXBLTVdMYjNWRHNndWExcDJ6VzF4WFJzalpTVE5zZnZNbk55TVM3ZEI0azdOQWhGd0wzcFhCckJYZ3lZSjlyaSJ9.MEUCIQDJyCTbMPIFnuBoW3FYnlgtDEIHZ2OrkCEvqVnHU7kJDQIgVxjBjfW1TwQfcSOYwK8Z7AdCWGJlyxtLEsrnPif7caE".split("."),i=JSON.parse(f.Buffer.from(o[1],"base64").toString()),r=f.Buffer.from(i.AuthenticationDataB64URL,"base64"),l=f.Buffer.from(i.ClientDataJSONB64URL,"base64").toString(),c=JSON.parse(l).challenge,n=o[2],x=await S(this.credIdHex,e,r,c,i.ClientDataJSONB64URL,n);console.log("decoded",x)}};v=X([E({components:{QuickNav:$}})],v);const z={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},L={class:"mb-8"},K={class:"text-lg text-center font-light relative px-7"},q={class:"mt-8"},_={class:"mt-8"},ee={key:0},te={key:1};function se(a,e,t,o,i,r){const l=y("QuickNav"),u=y("fa"),c=y("router-link");return m(),V(G,null,[W(l),s("section",z,[s("div",L,[s("div",K,[s("h1",{class:"text-lg text-center px-2 py-1 absolute -left-2 -top-1",onClick:e[0]||(e[0]=n=>a.$router.back())},[W(u,{icon:"chevron-left",class:"fa-fw"})])]),e[13]||(e[13]=s("h1",{id:"ViewHeading",class:"text-4xl text-center font-light pt-4 mb-8"}," Test ",-1))]),s("div",null,[e[14]||(e[14]=s("h2",{class:"text-xl font-bold mb-4"},"Notiwind Alerts",-1)),s("button",{onClick:e[1]||(e[1]=n=>this.$notify({group:"alert",type:"info",title:"Information Alert",text:"Just wanted you to know."},-1)),class:"font-bold uppercase bg-slate-600 text-white px-3 py-2 rounded-md mr-2"}," Info "),s("button",{onClick:e[2]||(e[2]=n=>this.$notify({group:"alert",type:"success",title:"Success Alert",text:"Congratulations!"},-1)),class:"font-bold uppercase bg-emerald-600 text-white px-3 py-2 rounded-md mr-2"}," Success "),s("button",{onClick:e[3]||(e[3]=n=>this.$notify({group:"alert",type:"warning",title:"Warning Alert",text:"You might wanna look at this."},-1)),class:"font-bold uppercase bg-amber-600 text-white px-3 py-2 rounded-md mr-2"}," Warning "),s("button",{onClick:e[4]||(e[4]=n=>this.$notify({group:"alert",type:"danger",title:"Danger Alert",text:"Something terrible has happened!"},-1)),class:"font-bold uppercase bg-rose-600 text-white px-3 py-2 rounded-md mr-2"}," Danger ")]),s("div",q,[e[16]||(e[16]=s("h2",{class:"text-xl font-bold mb-4"},"Image Sharing",-1)),e[17]||(e[17]=p(' Populates the "shared-photo" view as if they used "share_target". ')),s("input",{type:"file","data-testId":"fileInput",onChange:e[5]||(e[5]=(...n)=>a.uploadFile&&a.uploadFile(...n))},null,32),a.showFileNextStep()?(m(),A(c,{key:0,to:{name:"shared-photo",query:{fileName:a.fileName}},class:"block w-full text-center text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md mb-2 mt-2","data-testId":"fileUploadButton"},{default:O(()=>e[15]||(e[15]=[p(" Go to Shared Page ")])),_:1},8,["to"])):H("",!0)]),s("div",_,[e[21]||(e[21]=s("h2",{class:"text-xl font-bold mb-4"},"Passkeys",-1)),e[22]||(e[22]=p(" See console for results. ")),e[23]||(e[23]=s("br",null,null,-1)),e[24]||(e[24]=p(" See existing passkeys in Chrome at: chrome://settings/passkeys ")),e[25]||(e[25]=s("br",null,null,-1)),p(" Active DID: "+D(a.activeDid||"nothing, which")+" "+D(a.credIdHex?"has a passkey ID":"has no passkey ID")+" ",1),s("div",null,[e[18]||(e[18]=p(" Register Passkey ")),s("button",{onClick:e[6]||(e[6]=n=>a.register()),class:"font-bold uppercase bg-slate-500 text-white px-3 py-2 rounded-md mr-2"}," Simplewebauthn ")]),s("div",null,[e[19]||(e[19]=p(" Create JWT ")),s("button",{onClick:e[7]||(e[7]=n=>a.createJwtSimplewebauthn()),class:"font-bold uppercase bg-slate-500 text-white px-3 py-2 rounded-md mr-2"}," Simplewebauthn "),s("button",{onClick:e[8]||(e[8]=n=>a.createJwtNavigator()),class:"font-bold uppercase bg-slate-500 text-white px-3 py-2 rounded-md mr-2"}," Navigator ")]),a.jwt?(m(),V("div",ee,[e[20]||(e[20]=p(" Verify New JWT ")),s("button",{onClick:e[9]||(e[9]=n=>a.verifySimplewebauthn()),class:"font-bold uppercase bg-slate-500 text-white px-3 py-2 rounded-md mr-2"}," Simplewebauthn "),s("button",{onClick:e[10]||(e[10]=n=>a.verifyWebCrypto()),class:"font-bold uppercase bg-slate-500 text-white px-3 py-2 rounded-md mr-2"}," WebCrypto "),s("button",{onClick:e[11]||(e[11]=n=>a.verifyP256()),class:"font-bold uppercase bg-slate-500 text-white px-3 py-2 rounded-md mr-2"}," p256 - broken ")])):(m(),V("div",te,"Verify New JWT -- requires creation first")),s("button",{onClick:e[12]||(e[12]=n=>a.verifyMyJwt()),class:"font-bold uppercase bg-slate-500 text-white px-3 py-2 rounded-md mr-2"}," Verify Hard-Coded JWT ")])])],64)}const le=Y(v,[["render",se]]);export{le as default};
|
|
|