@learncard/simple-signing-plugin 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./simple-signing-plugin.cjs.production.min.js');
4
+ module.exports = require('./simple-signing-plugin.cjs.production.min.cjs');
5
5
  } else {
6
- module.exports = require('./simple-signing-plugin.cjs.development.js');
6
+ module.exports = require('./simple-signing-plugin.cjs.development.cjs');
7
7
  }
@@ -4611,4 +4611,4 @@ var getSimpleSigningPlugin = /* @__PURE__ */ __name(async (initialLearnCard, url
4611
4611
  }, "getSimpleSigningPlugin");
4612
4612
  /* istanbul ignore if -- @preserve */
4613
4613
  /* istanbul ignore next -- @preserve */
4614
- //# sourceMappingURL=simple-signing-plugin.cjs.development.js.map
4614
+ //# sourceMappingURL=simple-signing-plugin.cjs.development.cjs.map
@@ -2,4 +2,4 @@
2
2
  `);if(o.length===1)n+=o[0];else if(o.length>1){e(n+o[0]);for(let u=1;u<o.length-1;u++)e(o[u]);n=o[o.length-1]}},"onChunk");"getReader"in r?await Lr(r,s):await Mr(r,s),e(n)}c(Dr,"readLines");function Mr(r,e){return new Promise(t=>{r.on("data",e),r.on("end",t)})}c(Mr,"readNodeChunks");async function Lr(r,e){let t=r.getReader(),n=await t.read();for(;!n.done;)e(n.value),n=await t.read()}c(Lr,"readStandardChunks");var $r=c((r,e)=>{let t=r.AbortController?new r.AbortController:null,n=Ye({...r,contentTypeHeader:"application/json",batchModeHeader:"stream",getUrl:Te,getBody:Je},t),s=c(()=>t?.abort(),"cancel"),a=n.then(async i=>{if(!i.body)throw new Error("Received response without body");let o={response:i};return Ir({readableStream:i.body,onSingle:e,parse:u=>({json:JSON.parse(u),meta:o}),signal:t?.signal,textDecoder:r.textDecoder})});return{cancel:s,promise:a}},"streamingJsonHttpRequester"),Vr=c(r=>{let e=jr(r.opts.textDecoder);return(t,n)=>{let s=t.map(u=>u.path).join(","),a=t.map(u=>u.input),{cancel:i,promise:o}=$r({...r,textDecoder:e,path:s,inputs:a,headers(){return r.opts.headers?typeof r.opts.headers=="function"?r.opts.headers({opList:t}):r.opts.headers:{}}},(u,l)=>{n(u,l)});return{promise:o.then(()=>[]),cancel:i}}},"streamRequester"),ns=Ge(Vr),zr=c(r=>{if("input"in r){if(!(r.input instanceof FormData))throw new Error("Input is not FormData");return r.input}},"getBody"),Ur=c(r=>{if(r.type!=="mutation")throw new Error("We only handle mutations with formdata");return Fe({...r,getUrl(){return`${r.url}/${r.path}`},getBody:zr})},"formDataRequester"),ss=Le({requester:Ur});var qr=Object.defineProperty,Ve=c((r,e)=>qr(r,"name",{value:e,configurable:!0}),"__name"),Br=Ve(r=>()=>({next:e,op:t})=>$(n=>{let s=null,a=0,i=!1,o=Ve(()=>{a+=1,s?.unsubscribe(),s=e(t).subscribe({error:async u=>{if(a>5||u.data?.httpStatus!==401)return n.error(u);await r(),o()},next:u=>n.next(u),complete:()=>{i&&n.complete()}})},"attempt");return o(),()=>{i=!0,s?.unsubscribe()}}),"callbackLink"),_t=Ve(async(r,e)=>{let t=[],n=Xe({links:[Me({url:r,headers:{Authorization:`Bearer ${await e()}`}})]}),s=Ve(async(i=95+Math.round((Math.random()-.5)*5))=>n.utilities.getChallenges.query({amount:i}),"getChallenges");return s().then(i=>t=i),Xe({links:[Br(async()=>{t=await s()}),Me({url:r,headers:async()=>(t.length===0&&t.push(...await s()),{Authorization:`Bearer ${await e(t.pop())}`})})]})},"getClient");var vt=c(async(r,e)=>_t(r,async t=>{let n=await e.invoke.getDidAuthVp({proofFormat:"jwt",challenge:t});if(typeof n!="string")throw new Error("Error getting DID-Auth-JWT!");return n}),"getNewClient"),Zr=c(async(r,e)=>{let t=r,n=t.id.did(),s=await vt(e,t),a=c(async o=>{let u=o.id.did();n!==u&&(s=await vt(e,o),n=u),t=o},"updateLearnCard"),i=t.invoke.getProfile().then(async o=>{o&&await a(t)});return{name:"Simple Signing Authority",displayName:"Simple Signing Authority Plugin",description:"Lets you create and use Signing Authorities",methods:{createSigningAuthority:async(o,u)=>(await i,await a(o),s.signingAuthority.createSigningAuthority.mutate({name:u})),getSigningAuthorities:async o=>(await i,await a(o),s.signingAuthority.signingAuthorities.query()),authorizeSigningAuthority:async(o,u,l)=>(await i,await a(o),s.signingAuthority.authorizeSigningAuthority.mutate({name:u,authorization:l}))}}},"getSimpleSigningPlugin");
3
3
  /* istanbul ignore if -- @preserve */
4
4
  /* istanbul ignore next -- @preserve */
5
- //# sourceMappingURL=simple-signing-plugin.cjs.production.min.js.map
5
+ //# sourceMappingURL=simple-signing-plugin.cjs.production.min.cjs.map
package/package.json CHANGED
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "@learncard/simple-signing-plugin",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "",
5
- "main": "./dist/index.js",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
6
7
  "module": "./dist/simple-signing-plugin.esm.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/simple-signing-plugin.esm.js",
11
+ "require": "./dist/index.cjs"
12
+ }
13
+ },
7
14
  "files": [
8
15
  "dist"
9
16
  ],
@@ -33,10 +40,10 @@
33
40
  "dependencies": {
34
41
  "isomorphic-webcrypto": "^2.3.8",
35
42
  "zod": "^3.21.4",
36
- "@learncard/simple-signing-client": "1.0.11"
43
+ "@learncard/simple-signing-client": "1.0.12"
37
44
  },
38
45
  "scripts": {
39
- "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && tsc --p tsconfig.json",
46
+ "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.cjs && tsc --p tsconfig.json",
40
47
  "test": "jest --passWithNoTests",
41
48
  "test:watch": "jest --watch",
42
49
  "test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\""