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.
2 lines
9.2 KiB
2 lines
9.2 KiB
4 weeks ago
|
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:0zKMFjvUgYrM1hXwDciYHiA9MxXtJPXnRLJvqoMNAKoDLX9pKMWLb3VDsgua1p2zW1xXRsjZSTNsfvMnNyMS7dB4k7NAhFwL3pXBrBXgyYJ9ri",o="eyJ0eXAiOiJKV0FOVCIsImFsZyI6IkVTMjU2In0.eyJBdXRoZW50aWNhdGlvbkRhdGFCNjRVUkwiOiJTWllONVlnT2pHaDBOQmNQWkhaZ1c0X2tycm1paGpMSG1Wenp1b01kbDJNRkFBQUFBQSIsIkNsaWVudERhdGFKU09OQjY0VVJMIjoiZXlKMGVYQmxJam9pZDJWaVlYVjBhRzR1WjJWMElpd2lZMmhoYkd4bGJtZGxJam9pWlhsS01sbDVTVFpsZVVwcVkyMVdhMXBYTlRCaFYwWnpWVE5XYVdGdFZtcGtRMGsyWlhsS1FWa3lPWFZrUjFZMFp
|