mol_crypto_lib 0.0.450 → 0.0.453

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mol_crypto_lib",
3
- "version": "0.0.450",
3
+ "version": "0.0.453",
4
4
  "main": "node.js",
5
5
  "module": "node.esm.js",
6
6
  "browser": "web.js",
package/web.d.ts CHANGED
@@ -79,8 +79,8 @@ declare namespace $ {
79
79
  constructor(native: CryptoKey & {
80
80
  type: 'public';
81
81
  });
82
- static from(serial: BufferSource): Promise<$mol_crypto_auditor_public>;
83
- serial(): Promise<ArrayBuffer>;
82
+ static from(serial: string): Promise<$mol_crypto_auditor_public>;
83
+ serial(): Promise<string>;
84
84
  verify(data: BufferSource, sign: BufferSource): Promise<boolean>;
85
85
  }
86
86
  class $mol_crypto_auditor_private extends Object {
@@ -91,11 +91,13 @@ declare namespace $ {
91
91
  constructor(native: CryptoKey & {
92
92
  type: 'private';
93
93
  });
94
- static from(serial: BufferSource): Promise<$mol_crypto_auditor_private>;
95
- serial(): Promise<ArrayBuffer>;
94
+ static from(serial: string): Promise<$mol_crypto_auditor_private>;
95
+ serial(): Promise<string>;
96
96
  sign(data: BufferSource): Promise<ArrayBuffer>;
97
+ public(): Promise<$mol_crypto_auditor_public>;
97
98
  }
98
99
  const $mol_crypto_auditor_sign_size = 64;
100
+ function $mol_crypto_auditor_private_to_public(serial: string): string;
99
101
  }
100
102
 
101
103
  declare namespace $ {
package/web.deps.json CHANGED
@@ -1 +1 @@
1
- {"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/crypto/README.md","mol/crypto/native/native.web.ts","mol/crypto/secret/secret.ts","mol/crypto/cipher/cipher.ts","mol/crypto/auditor/auditor.ts","mol/crypto/hash/hash.ts","mol/crypto/salt/salt.ts","mol/crypto/lib/lib.meta.tree"],"mods":{},"deps_in":{"mol/crypto":{"mol/crypto/lib":-9007199254740991,"mol/crypto/secret":-9007199254740991,"mol/crypto/native":-9007199254740991,"mol/crypto/cipher":-9007199254740991,"mol/crypto/auditor":-9007199254740991,"mol/crypto/hash":-9007199254740991,"mol/crypto/salt":-9007199254740991},"mol":{"mol/crypto":-9007199254740991},"":{"mol":-9007199254740991},"mol/crypto/secret":{"mol/crypto/lib":-9000},"mol/crypto/native":{"mol/crypto/secret":-3,"mol/crypto/cipher":-2,"mol/crypto/auditor":-2,"mol/crypto/salt":-2},"mol/crypto/cipher":{"mol/crypto/lib":-9000},"mol/crypto/auditor":{"mol/crypto/lib":-9000},"mol/crypto/hash":{"mol/crypto/lib":-9000},"mol/crypto/salt":{"mol/crypto/lib":-9000}},"deps_out":{"mol/crypto/lib":{"mol/crypto":-9007199254740991,"mol/crypto/secret":-9000,"mol/crypto/cipher":-9000,"mol/crypto/auditor":-9000,"mol/crypto/hash":-9000,"mol/crypto/salt":-9000},"mol/crypto":{"mol":-9007199254740991},"mol":{"":-9007199254740991},"mol/crypto/secret":{"mol/crypto":-9007199254740991,"mol/crypto/native":-3},"mol/crypto/native":{"mol/crypto":-9007199254740991},"mol/crypto/cipher":{"mol/crypto":-9007199254740991,"mol/crypto/native":-2},"mol/crypto/auditor":{"mol/crypto":-9007199254740991,"mol/crypto/native":-2},"mol/crypto/hash":{"mol/crypto":-9007199254740991},"mol/crypto/salt":{"mol/crypto":-9007199254740991,"mol/crypto/native":-2}},"sloc":{"LICENSE":113,"md":533,"tree":36,"js":9,"ts":350,"json":85,"lock":1010,"CNAME":1,"html":1},"deps":{"mol/crypto/lib":{"..":-9007199254740991,"/mol/crypto/secret":-9000,"/mol/crypto/cipher":-9000,"/mol/crypto/auditor":-9000,"/mol/crypto/hash":-9000,"/mol/crypto/salt":-9000},"mol/crypto":{"..":-9007199254740991},"mol":{"..":-9007199254740991},"":{},"mol/crypto/secret":{"..":-9007199254740991,"/mol/crypto/secret":-1,"/mol/crypto/native/subtle/generate/key":-4,"/mol/crypto/native/subtle/import/key":-4,"/mol/crypto/native/subtle/export/key":-3,"/mol/crypto/native/subtle/encrypt":-3,"/mol/crypto/native/subtle/decrypt":-3},"mol/crypto/native":{"..":-9007199254740991,"./native.ts":0,"/mol/crypto/native":-1},"mol/crypto/cipher":{"..":-9007199254740991,"/mol/crypto/cipher/pair":-1,"/mol/crypto/native/subtle/generate/key":-2,"/mol/crypto/cipher/public":-1,"/mol/crypto/cipher/private":-1,"/mol/crypto/native/subtle/import/key":-4,"/mol/crypto/native/subtle/export/key":-3,"/mol/crypto/native/subtle/encrypt":-3,"/mol/crypto/native/subtle/decrypt":-3,"/mol/crypto/cipher/ecrypted/size":-1},"mol/crypto/auditor":{"..":-9007199254740991,"/mol/crypto/auditor/pair":-1,"/mol/crypto/native/subtle/generate/key":-2,"/mol/crypto/auditor/public":-1,"/mol/crypto/auditor/private":-1,"/mol/crypto/native/subtle/import/key":-4,"/mol/crypto/native/subtle/export/key":-3,"/mol/crypto/native/subtle/verify":-3,"/mol/crypto/native/subtle/sign":-3,"/mol/crypto/auditor/sign/size":-1},"mol/crypto/hash":{"..":-9007199254740991,"/mol/crypto/hash":-1},"mol/crypto/salt":{"..":-9007199254740991,"/mol/crypto/salt":-1,"/mol/crypto/native/get/random/values":-2}}}
1
+ {"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/crypto/README.md","mol/crypto/native/native.web.ts","mol/crypto/secret/secret.ts","mol/crypto/cipher/cipher.ts","mol/crypto/auditor/auditor.ts","mol/crypto/hash/hash.ts","mol/crypto/salt/salt.ts","mol/crypto/lib/lib.meta.tree"],"mods":{},"deps_in":{"mol/crypto":{"mol/crypto/lib":-9007199254740991,"mol/crypto/secret":-9007199254740991,"mol/crypto/native":-9007199254740991,"mol/crypto/cipher":-9007199254740991,"mol/crypto/auditor":-9007199254740991,"mol/crypto/hash":-9007199254740991,"mol/crypto/salt":-9007199254740991},"mol":{"mol/crypto":-9007199254740991},"":{"mol":-9007199254740991},"mol/crypto/secret":{"mol/crypto/lib":-9000},"mol/crypto/native":{"mol/crypto/secret":-3,"mol/crypto/cipher":-2,"mol/crypto/auditor":-2,"mol/crypto/salt":-2},"mol/crypto/cipher":{"mol/crypto/lib":-9000},"mol/crypto/auditor":{"mol/crypto/lib":-9000},"mol/crypto/hash":{"mol/crypto/lib":-9000},"mol/crypto/salt":{"mol/crypto/lib":-9000}},"deps_out":{"mol/crypto/lib":{"mol/crypto":-9007199254740991,"mol/crypto/secret":-9000,"mol/crypto/cipher":-9000,"mol/crypto/auditor":-9000,"mol/crypto/hash":-9000,"mol/crypto/salt":-9000},"mol/crypto":{"mol":-9007199254740991},"mol":{"":-9007199254740991},"mol/crypto/secret":{"mol/crypto":-9007199254740991,"mol/crypto/native":-3},"mol/crypto/native":{"mol/crypto":-9007199254740991},"mol/crypto/cipher":{"mol/crypto":-9007199254740991,"mol/crypto/native":-2},"mol/crypto/auditor":{"mol/crypto":-9007199254740991,"mol/crypto/native":-2},"mol/crypto/hash":{"mol/crypto":-9007199254740991},"mol/crypto/salt":{"mol/crypto":-9007199254740991,"mol/crypto/native":-2}},"sloc":{"LICENSE":113,"md":533,"tree":36,"js":9,"ts":376,"json":85,"lock":1010,"CNAME":1,"html":1},"deps":{"mol/crypto/lib":{"..":-9007199254740991,"/mol/crypto/secret":-9000,"/mol/crypto/cipher":-9000,"/mol/crypto/auditor":-9000,"/mol/crypto/hash":-9000,"/mol/crypto/salt":-9000},"mol/crypto":{"..":-9007199254740991},"mol":{"..":-9007199254740991},"":{},"mol/crypto/secret":{"..":-9007199254740991,"/mol/crypto/secret":-1,"/mol/crypto/native/subtle/generate/key":-4,"/mol/crypto/native/subtle/import/key":-4,"/mol/crypto/native/subtle/export/key":-3,"/mol/crypto/native/subtle/encrypt":-3,"/mol/crypto/native/subtle/decrypt":-3},"mol/crypto/native":{"..":-9007199254740991,"./native.ts":0,"/mol/crypto/native":-1},"mol/crypto/cipher":{"..":-9007199254740991,"/mol/crypto/cipher/pair":-1,"/mol/crypto/native/subtle/generate/key":-2,"/mol/crypto/cipher/public":-1,"/mol/crypto/cipher/private":-1,"/mol/crypto/native/subtle/import/key":-4,"/mol/crypto/native/subtle/export/key":-3,"/mol/crypto/native/subtle/encrypt":-3,"/mol/crypto/native/subtle/decrypt":-3,"/mol/crypto/cipher/ecrypted/size":-1},"mol/crypto/auditor":{"..":-9007199254740991,"/mol/crypto/auditor/pair":-1,"/mol/crypto/native/subtle/generate/key":-2,"/mol/crypto/auditor/public":-1,"/mol/crypto/auditor/private":-1,"/mol/crypto/native/subtle/import/key":-4,"/mol/crypto/native/subtle/export/key":-3,"/mol/crypto/native/subtle/verify":-3,"/mol/crypto/native/subtle/sign":-3,"/mol/crypto/auditor/public/from":-3,"/mol/crypto/auditor/private/to/public":-1,"/mol/crypto/auditor/sign/size":-1},"mol/crypto/hash":{"..":-9007199254740991,"/mol/crypto/hash":-1},"mol/crypto/salt":{"..":-9007199254740991,"/mol/crypto/salt":-1,"/mol/crypto/native/get/random/values":-2}}}
package/web.esm.js CHANGED
@@ -151,16 +151,24 @@ var $;
151
151
  $.$mol_crypto_auditor_pair = $mol_crypto_auditor_pair;
152
152
  class $mol_crypto_auditor_public extends Object {
153
153
  native;
154
- static size = 91;
154
+ static size = 86;
155
155
  constructor(native) {
156
156
  super();
157
157
  this.native = native;
158
158
  }
159
159
  static async from(serial) {
160
- return new this(await $mol_crypto_native.subtle.importKey('spki', serial, algorithm, true, ['verify']));
160
+ return new this(await $mol_crypto_native.subtle.importKey('jwk', {
161
+ crv: "P-256",
162
+ ext: true,
163
+ key_ops: ['verify'],
164
+ kty: "EC",
165
+ x: serial.slice(0, 43),
166
+ y: serial.slice(43, 86),
167
+ }, algorithm, true, ['verify']));
161
168
  }
162
169
  async serial() {
163
- return await $mol_crypto_native.subtle.exportKey('spki', this.native);
170
+ const { x, y } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
171
+ return x + y;
164
172
  }
165
173
  async verify(data, sign) {
166
174
  return await $mol_crypto_native.subtle.verify(algorithm, this.native, sign, data);
@@ -169,23 +177,39 @@ var $;
169
177
  $.$mol_crypto_auditor_public = $mol_crypto_auditor_public;
170
178
  class $mol_crypto_auditor_private extends Object {
171
179
  native;
172
- static size = 200;
180
+ static size = 129;
173
181
  constructor(native) {
174
182
  super();
175
183
  this.native = native;
176
184
  }
177
185
  static async from(serial) {
178
- return new this(await $mol_crypto_native.subtle.importKey('pkcs8', serial, algorithm, true, ['sign']));
186
+ return new this(await $mol_crypto_native.subtle.importKey('jwk', {
187
+ crv: "P-256",
188
+ ext: true,
189
+ key_ops: ['sign'],
190
+ kty: "EC",
191
+ x: serial.slice(0, 43),
192
+ y: serial.slice(43, 86),
193
+ d: serial.slice(86, 129),
194
+ }, algorithm, true, ['sign']));
179
195
  }
180
196
  async serial() {
181
- return await $mol_crypto_native.subtle.exportKey('pkcs8', this.native);
197
+ const { x, y, d } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
198
+ return x + y + d;
182
199
  }
183
200
  async sign(data) {
184
201
  return await $mol_crypto_native.subtle.sign(algorithm, this.native, data);
185
202
  }
203
+ async public() {
204
+ return await $mol_crypto_auditor_public.from($mol_crypto_auditor_private_to_public(await this.serial()));
205
+ }
186
206
  }
187
207
  $.$mol_crypto_auditor_private = $mol_crypto_auditor_private;
188
208
  $.$mol_crypto_auditor_sign_size = 64;
209
+ function $mol_crypto_auditor_private_to_public(serial) {
210
+ return serial.slice(0, 86);
211
+ }
212
+ $.$mol_crypto_auditor_private_to_public = $mol_crypto_auditor_private_to_public;
189
213
  })($ || ($ = {}));
190
214
  //mol/crypto/auditor/auditor.ts
191
215
  ;
package/web.esm.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../native/mol/crypto/native/native.web.ts","../../secret/mol/crypto/secret/secret.ts","../../cipher/mol/crypto/cipher/cipher.ts","../../auditor/mol/crypto/auditor/auditor.ts","../../hash/mol/crypto/hash/hash.ts","../../salt/mol/crypto/salt/salt.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;AEFA,IAAU,CAAC,CAEV;AAFD,WAAU,CAAC;IACC,oBAAkB,GAAG,MAAM,CAAA;AACvC,CAAC,EAFS,CAAC,KAAD,CAAC,QAEV;;;;ACFD,IAAU,CAAC,CA8EV;AA9ED,WAAU,CAAC;IAEV,MAAM,SAAS,GAAG;QACjB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,EAAE;KACb,CAAA;IAGD,MAAa,kBAAmB,SAAQ,MAAM;QASnC;QANV,MAAM,CAAC,IAAI,GAAG,EAAE,CAAA;QAGhB,MAAM,CAAC,KAAK,GAAG,CAAC,CAAA;QAEhB,YACU,MAAuC;YAEhD,KAAK,EAAE,CAAA;YAFE,WAAM,GAAN,MAAM,CAAiC;QAGjD,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,QAAQ;YACpB,OAAO,IAAI,IAAI,CACd,MAAM,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAC1C,SAAS,EACT,IAAI,EACJ,CAAE,SAAS,EAAE,SAAS,CAAE,CACW,CACpC,CAAA;QACF,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C,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAG;YAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YACpB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC,GAAG,QAAQ,GAAG,IAAI,KAAK,CAAC,GAAG,MAAM,GAAG,IAAI,KAAK,EAAE,GAAG,IAAI,CAAA;SACtF;QAED,OAAO,IAAI,UAAU,CAAE,IAAI,CAAC,MAAM,CAAE,CAAA;IACrC,CAAC;IA3Fe,kBAAgB,mBA2F/B,CAAA;AAEF,CAAC,EAlGS,CAAC,KAAD,CAAC,QAkGV;;;;AClGD,IAAU,CAAC,CASV;AATD,WAAU,CAAC;IAGV,SAAgB,gBAAgB;QAC/B,OAAO,kBAAkB,CAAC,eAAe,CACxC,IAAI,UAAU,CAAE,EAAE,CAAE,CACpB,CAAA;IACF,CAAC;IAJe,kBAAgB,mBAI/B,CAAA;AAEF,CAAC,EATS,CAAC,KAAD,CAAC,QASV;;;APTD","file":"web.esm.js","sourcesContent":[null,null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\texport var $mol_crypto_native = crypto\n}\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'AES-GCM',\n\t\tlength: 128,\n\t\ttagLength: 32,\n\t}\n\t\n\t/** Symmetric cipher with shortest payload */\n\texport class $mol_crypto_secret extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 16\n\t\t\n\t\t/** Extra size in bytes to encrypted data. */\n\t\tstatic extra = 4\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async generate() {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.generateKey(\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'raw',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 16 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'raw',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\n\t\t/** 4 bytes + data length */\n\t\tasync encrypt( open: BufferSource, salt: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.encrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\topen\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( closed: BufferSource, salt : BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.decrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\tclosed\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n}\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'RSA-OAEP',\n\t\tmodulusLength: 1024,\n\t\tpublicExponent: new Uint8Array([ 1, 0, 1 ]),\n\t\thash: 'SHA-256',\n\t}\n\t\n\t/** Asymmetric cipher pair with shortest payload */\n\texport async function $mol_crypto_cipher_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $mol_crypto_native.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_cipher_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_cipher_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher public key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_public extends Object {\n\t\t\n\t\t/** Public key size in bytes. */\n\t\tstatic size = 162\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 162 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** max 86 bytes input, 128 bytes output */\n\t\tasync encrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.encrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher private key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_private extends Object {\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** ~640 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.decrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Encrypted size in bytes. */\n\texport const $mol_crypto_cipher_ecrypted_size = 128\n\n}\n","namespace $ {\n\n\t/** @FIXME Need polyfill for Safari and Node (https://github.com/microsoft/MSR-JavaScript-Crypto/) */\n\tconst algorithm = {\n\t\tname: 'ECDSA',\n\t\thash: 'SHA-256',\n\t\tnamedCurve: \"P-256\",\n\t}\n\t\n\t/** Asymmetric signing pair with shortest payload */\n\texport async function $mol_crypto_auditor_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $mol_crypto_native.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'sign', 'verify' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_auditor_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_auditor_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing public key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_public extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 91\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'verify' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 62 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync verify( data: BufferSource, sign: BufferSource ) {\n\t\t\treturn await $mol_crypto_native.subtle.verify(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tsign,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing private key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_private extends Object {\n\t\t\n\t\t/** Max key size in bytes. */\n\t\tstatic size = 200\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'sign' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 190-200 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 32 bytes */\n\t\tasync sign( data: BufferSource ) {\n\t\t\t\n\t\t\treturn await $mol_crypto_native.subtle.sign(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata\n\t\t\t)\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Sign size in bytes. */\n\texport const $mol_crypto_auditor_sign_size = 64\n\t\n}\n","namespace $ {\n\t\n\tlet sponge = new Uint32Array(80)\n\t\n\t/** Fast small sync SHA-1 */\n\texport function $mol_crypto_hash( data: Uint8Array ) {\n\t\t\n\t\tconst bits = data.byteLength << 3\n\t\tconst kbits = bits >> 5\n\t\tconst kword = 0x80 << ( 24 - bits & 0b11111 )\n\t\t\n\t\tconst bytes = 16 + ( bits + 64 >>> 9 << 4 )\n\t\tconst klens = bytes - 1\n\t\tconst words = new Int32Array( data.buffer, data.byteOffset, data.byteLength >> 2 )\n\t\t\n\t\tlet tail = 0\n\t\tfor( let i = words.length * 4; i < data.length; ++i ) {\n\t\t\ttail |= data[i] << ( i << 3 & 0b11000 )\n\t\t}\n\t\t\n\t\t// Initial\n\t\tconst hash = new Int32Array([ 1732584193, -271733879, -1732584194, 271733878, -1009589776 ])\n\t\t\n\t\t// Digest\n\t\tfor( let i = 0; i < bytes; i += 16 ) {\n\t\t\t\n\t\t\tlet h0 = hash[0]\n\t\t\tlet h1 = hash[1]\n\t\t\tlet h2 = hash[2]\n\t\t\tlet h3 = hash[3]\n\t\t\tlet h4 = hash[4]\n\n\t\t\tfor( let j = 0; j < 80; ++j ) {\n\t\t\t\t\n\t\t\t\tlet turn\n\t\t\t\t\n\t\t\t\tif( j < 16 ) {\n\t\t\t\t\t\n\t\t\t\t\tconst k = i + j\n\t\t\t\t\tif( k === klens ) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tsponge[j] = bits\n\t\t\t\t\t\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet word =\n\t\t\t\t\t\t\tk === words.length ? tail :\n\t\t\t\t\t\t\tk > words.length ? 0 :\n\t\t\t\t\t\t\twords[k]\n\t\t\t\t\t\t\n\t\t\t\t\t\tword = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF // LE -> BE\n\t\t\t\t\t\tif( k === kbits ) word |= kword\n\t\t\t\t\t\t\n\t\t\t\t\t\tsponge[j] = word\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tturn = ( h1 & h2 | ~h1 & h3 ) + 1518500249\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tconst shuffle = sponge[j-3] ^ sponge[j-8] ^ sponge[j-14] ^ sponge[j-16]\n\t\t\t\t\tsponge[j] = shuffle << 1 | shuffle >>> 31\n\t\t\t\t\t\n\t\t\t\t\tturn =\n\t\t\t\t\t\tj < 20 ? ( h1 & h2 | ~h1 & h3 ) + 1518500249 :\n\t\t\t\t\t\tj < 40 ? ( h1 ^ h2 ^ h3 ) + 1859775393 :\n\t\t\t\t\t\tj < 60 ? ( h1 & h2 | h1 & h3 | h2 & h3 ) - 1894007588 :\n\t\t\t\t\t\t( h1 ^ h2 ^ h3 ) - 899497514\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconst next = turn + h4 + ( sponge[j] >>> 0 ) + (( h0 << 5 )|( h0 >>> 27 ))\n\n\t\t\t\th4 = h3\n\t\t\t\th3 = h2\n\t\t\t\th2 = ( h1 << 30 )|( h1 >>> 2 )\n\t\t\t\th1 = h0\n\t\t\t\th0 = next\n\t\t\t\t\n\t\t\t}\n\n\t\t\thash[0] += h0\n\t\t\thash[1] += h1\n\t\t\thash[2] += h2\n\t\t\thash[3] += h3\n\t\t\thash[4] += h4\n\t\t\t\n\t\t}\n\t\t\n\t\tfor( let i = 0; i < 20; ++i ) {\n\t\t\tconst word = hash[i]\n\t\t\thash[i] = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF // BE -> LE\n\t\t}\n\n\t\treturn new Uint8Array( hash.buffer )\n\t}\n\t\n}\n","namespace $ {\n\t\n\t/** 8 byte */\n\texport function $mol_crypto_salt() {\n\t\treturn $mol_crypto_native.getRandomValues(\n\t\t\tnew Uint8Array( 12 )\n\t\t)\n\t}\n\t\n}\n"]}
1
+ {"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../native/mol/crypto/native/native.web.ts","../../secret/mol/crypto/secret/secret.ts","../../cipher/mol/crypto/cipher/cipher.ts","../../auditor/mol/crypto/auditor/auditor.ts","../../hash/mol/crypto/hash/hash.ts","../../salt/mol/crypto/salt/salt.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;AEFA,IAAU,CAAC,CAEV;AAFD,WAAU,CAAC;IACC,oBAAkB,GAAG,MAAM,CAAA;AACvC,CAAC,EAFS,CAAC,KAAD,CAAC,QAEV;;;;ACFD,IAAU,CAAC,CA8EV;AA9ED,WAAU,CAAC;IAEV,MAAM,SAAS,GAAG;QACjB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,EAAE;KACb,CAAA;IAGD,MAAa,kBAAmB,SAAQ,MAAM;QASnC;QANV,MAAM,CAAC,IAAI,GAAG,EAAE,CAAA;QAGhB,MAAM,CAAC,KAAK,GAAG,CAAC,CAAA;QAEhB,YACU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SAEb;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAG;YAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YACpB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC,GAAG,QAAQ,GAAG,IAAI,KAAK,CAAC,GAAG,MAAM,GAAG,IAAI,KAAK,EAAE,GAAG,IAAI,CAAA;SACtF;QAED,OAAO,IAAI,UAAU,CAAE,IAAI,CAAC,MAAM,CAAE,CAAA;IACrC,CAAC;IA3Fe,kBAAgB,mBA2F/B,CAAA;AAEF,CAAC,EAlGS,CAAC,KAAD,CAAC,QAkGV;;;;AClGD,IAAU,CAAC,CASV;AATD,WAAU,CAAC;IAGV,SAAgB,gBAAgB;QAC/B,OAAO,kBAAkB,CAAC,eAAe,CACxC,IAAI,UAAU,CAAE,EAAE,CAAE,CACpB,CAAA;IACF,CAAC;IAJe,kBAAgB,mBAI/B,CAAA;AAEF,CAAC,EATS,CAAC,KAAD,CAAC,QASV;;;APTD","file":"web.esm.js","sourcesContent":[null,null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\texport var $mol_crypto_native = crypto\n}\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'AES-GCM',\n\t\tlength: 128,\n\t\ttagLength: 32,\n\t}\n\t\n\t/** Symmetric cipher with shortest payload */\n\texport class $mol_crypto_secret extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 16\n\t\t\n\t\t/** Extra size in bytes to encrypted data. */\n\t\tstatic extra = 4\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async generate() {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.generateKey(\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'raw',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 16 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'raw',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\n\t\t/** 4 bytes + data length */\n\t\tasync encrypt( open: BufferSource, salt: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.encrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\topen\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( closed: BufferSource, salt : BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.decrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\tclosed\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n}\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'RSA-OAEP',\n\t\tmodulusLength: 1024,\n\t\tpublicExponent: new Uint8Array([ 1, 0, 1 ]),\n\t\thash: 'SHA-256',\n\t}\n\t\n\t/** Asymmetric cipher pair with shortest payload */\n\texport async function $mol_crypto_cipher_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $mol_crypto_native.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_cipher_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_cipher_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher public key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_public extends Object {\n\t\t\n\t\t/** Public key size in bytes. */\n\t\tstatic size = 162\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 162 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** max 86 bytes input, 128 bytes output */\n\t\tasync encrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.encrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher private key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_private extends Object {\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** ~640 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.decrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Encrypted size in bytes. */\n\texport const $mol_crypto_cipher_ecrypted_size = 128\n\n}\n","namespace $ {\n\n\t/** @FIXME Need polyfill for Safari and Node (https://github.com/microsoft/MSR-JavaScript-Crypto/) */\n\tconst algorithm = {\n\t\tname: 'ECDSA',\n\t\thash: 'SHA-256',\n\t\tnamedCurve: \"P-256\",\n\t}\n\t\n\t/** Asymmetric signing pair with shortest payload */\n\texport async function $mol_crypto_auditor_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $mol_crypto_native.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'sign', 'verify' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_auditor_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_auditor_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing public key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_public extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 86\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: string ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'jwk',\n\t\t\t\t\t{\n\t\t\t\t\t\tcrv: \"P-256\",\n\t\t\t\t\t\text: true,\n\t\t\t\t\t\tkey_ops: ['verify'],\n\t\t\t\t\t\tkty: \"EC\",\n\t\t\t\t\t\tx: serial.slice( 0, 43 ),\n\t\t\t\t\t\ty: serial.slice( 43, 86 ),\n\t\t\t\t\t},\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'verify' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 62 bytes */\n\t\tasync serial(): Promise< string > {\n\t\t\tconst { x, y } = await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'jwk',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t\treturn x! + y!\n\t\t}\n\t\t\n\t\tasync verify( data: BufferSource, sign: BufferSource ) {\n\t\t\treturn await $mol_crypto_native.subtle.verify(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tsign,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing private key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_private extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 129\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\n\t\tstatic async from( serial: string ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'jwk',\n\t\t\t\t\t{\n\t\t\t\t\t\tcrv: \"P-256\",\n\t\t\t\t\t\text: true,\n\t\t\t\t\t\tkey_ops: ['sign'],\n\t\t\t\t\t\tkty: \"EC\",\n\t\t\t\t\t\tx: serial.slice( 0, 43 ),\n\t\t\t\t\t\ty: serial.slice( 43, 86 ),\n\t\t\t\t\t\td: serial.slice( 86, 129 ),\n\t\t\t\t\t},\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'sign' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 129 bytes */\n\t\tasync serial(): Promise< string > {\n\t\t\tconst { x, y, d } = await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'jwk',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t\treturn x! + y! + d!\n\t\t}\n\t\t\n\t\t/** 64 bytes */\n\t\tasync sign( data: BufferSource ) {\n\t\t\t\n\t\t\treturn await $mol_crypto_native.subtle.sign(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata\n\t\t\t)\n\t\t\t\n\t\t}\n\t\t\n\t\t/** Makes public key from private */\n\t\tasync public() {\n\t\t\treturn await $mol_crypto_auditor_public.from(\n\t\t\t\t$mol_crypto_auditor_private_to_public( await this.serial() )\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Sign size in bytes. */\n\texport const $mol_crypto_auditor_sign_size = 64\n\t\n\texport function $mol_crypto_auditor_private_to_public( serial: string ) {\n\t\treturn serial.slice( 0, 86 )\n\t}\n\t\n}\n","namespace $ {\n\t\n\tlet sponge = new Uint32Array(80)\n\t\n\t/** Fast small sync SHA-1 */\n\texport function $mol_crypto_hash( data: Uint8Array ) {\n\t\t\n\t\tconst bits = data.byteLength << 3\n\t\tconst kbits = bits >> 5\n\t\tconst kword = 0x80 << ( 24 - bits & 0b11111 )\n\t\t\n\t\tconst bytes = 16 + ( bits + 64 >>> 9 << 4 )\n\t\tconst klens = bytes - 1\n\t\tconst words = new Int32Array( data.buffer, data.byteOffset, data.byteLength >> 2 )\n\t\t\n\t\tlet tail = 0\n\t\tfor( let i = words.length * 4; i < data.length; ++i ) {\n\t\t\ttail |= data[i] << ( i << 3 & 0b11000 )\n\t\t}\n\t\t\n\t\t// Initial\n\t\tconst hash = new Int32Array([ 1732584193, -271733879, -1732584194, 271733878, -1009589776 ])\n\t\t\n\t\t// Digest\n\t\tfor( let i = 0; i < bytes; i += 16 ) {\n\t\t\t\n\t\t\tlet h0 = hash[0]\n\t\t\tlet h1 = hash[1]\n\t\t\tlet h2 = hash[2]\n\t\t\tlet h3 = hash[3]\n\t\t\tlet h4 = hash[4]\n\n\t\t\tfor( let j = 0; j < 80; ++j ) {\n\t\t\t\t\n\t\t\t\tlet turn\n\t\t\t\t\n\t\t\t\tif( j < 16 ) {\n\t\t\t\t\t\n\t\t\t\t\tconst k = i + j\n\t\t\t\t\tif( k === klens ) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tsponge[j] = bits\n\t\t\t\t\t\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet word =\n\t\t\t\t\t\t\tk === words.length ? tail :\n\t\t\t\t\t\t\tk > words.length ? 0 :\n\t\t\t\t\t\t\twords[k]\n\t\t\t\t\t\t\n\t\t\t\t\t\tword = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF // LE -> BE\n\t\t\t\t\t\tif( k === kbits ) word |= kword\n\t\t\t\t\t\t\n\t\t\t\t\t\tsponge[j] = word\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tturn = ( h1 & h2 | ~h1 & h3 ) + 1518500249\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tconst shuffle = sponge[j-3] ^ sponge[j-8] ^ sponge[j-14] ^ sponge[j-16]\n\t\t\t\t\tsponge[j] = shuffle << 1 | shuffle >>> 31\n\t\t\t\t\t\n\t\t\t\t\tturn =\n\t\t\t\t\t\tj < 20 ? ( h1 & h2 | ~h1 & h3 ) + 1518500249 :\n\t\t\t\t\t\tj < 40 ? ( h1 ^ h2 ^ h3 ) + 1859775393 :\n\t\t\t\t\t\tj < 60 ? ( h1 & h2 | h1 & h3 | h2 & h3 ) - 1894007588 :\n\t\t\t\t\t\t( h1 ^ h2 ^ h3 ) - 899497514\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconst next = turn + h4 + ( sponge[j] >>> 0 ) + (( h0 << 5 )|( h0 >>> 27 ))\n\n\t\t\t\th4 = h3\n\t\t\t\th3 = h2\n\t\t\t\th2 = ( h1 << 30 )|( h1 >>> 2 )\n\t\t\t\th1 = h0\n\t\t\t\th0 = next\n\t\t\t\t\n\t\t\t}\n\n\t\t\thash[0] += h0\n\t\t\thash[1] += h1\n\t\t\thash[2] += h2\n\t\t\thash[3] += h3\n\t\t\thash[4] += h4\n\t\t\t\n\t\t}\n\t\t\n\t\tfor( let i = 0; i < 20; ++i ) {\n\t\t\tconst word = hash[i]\n\t\t\thash[i] = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF // BE -> LE\n\t\t}\n\n\t\treturn new Uint8Array( hash.buffer )\n\t}\n\t\n}\n","namespace $ {\n\t\n\t/** 8 byte */\n\texport function $mol_crypto_salt() {\n\t\treturn $mol_crypto_native.getRandomValues(\n\t\t\tnew Uint8Array( 12 )\n\t\t)\n\t}\n\t\n}\n"]}
package/web.js CHANGED
@@ -151,16 +151,24 @@ var $;
151
151
  $.$mol_crypto_auditor_pair = $mol_crypto_auditor_pair;
152
152
  class $mol_crypto_auditor_public extends Object {
153
153
  native;
154
- static size = 91;
154
+ static size = 86;
155
155
  constructor(native) {
156
156
  super();
157
157
  this.native = native;
158
158
  }
159
159
  static async from(serial) {
160
- return new this(await $mol_crypto_native.subtle.importKey('spki', serial, algorithm, true, ['verify']));
160
+ return new this(await $mol_crypto_native.subtle.importKey('jwk', {
161
+ crv: "P-256",
162
+ ext: true,
163
+ key_ops: ['verify'],
164
+ kty: "EC",
165
+ x: serial.slice(0, 43),
166
+ y: serial.slice(43, 86),
167
+ }, algorithm, true, ['verify']));
161
168
  }
162
169
  async serial() {
163
- return await $mol_crypto_native.subtle.exportKey('spki', this.native);
170
+ const { x, y } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
171
+ return x + y;
164
172
  }
165
173
  async verify(data, sign) {
166
174
  return await $mol_crypto_native.subtle.verify(algorithm, this.native, sign, data);
@@ -169,23 +177,39 @@ var $;
169
177
  $.$mol_crypto_auditor_public = $mol_crypto_auditor_public;
170
178
  class $mol_crypto_auditor_private extends Object {
171
179
  native;
172
- static size = 200;
180
+ static size = 129;
173
181
  constructor(native) {
174
182
  super();
175
183
  this.native = native;
176
184
  }
177
185
  static async from(serial) {
178
- return new this(await $mol_crypto_native.subtle.importKey('pkcs8', serial, algorithm, true, ['sign']));
186
+ return new this(await $mol_crypto_native.subtle.importKey('jwk', {
187
+ crv: "P-256",
188
+ ext: true,
189
+ key_ops: ['sign'],
190
+ kty: "EC",
191
+ x: serial.slice(0, 43),
192
+ y: serial.slice(43, 86),
193
+ d: serial.slice(86, 129),
194
+ }, algorithm, true, ['sign']));
179
195
  }
180
196
  async serial() {
181
- return await $mol_crypto_native.subtle.exportKey('pkcs8', this.native);
197
+ const { x, y, d } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
198
+ return x + y + d;
182
199
  }
183
200
  async sign(data) {
184
201
  return await $mol_crypto_native.subtle.sign(algorithm, this.native, data);
185
202
  }
203
+ async public() {
204
+ return await $mol_crypto_auditor_public.from($mol_crypto_auditor_private_to_public(await this.serial()));
205
+ }
186
206
  }
187
207
  $.$mol_crypto_auditor_private = $mol_crypto_auditor_private;
188
208
  $.$mol_crypto_auditor_sign_size = 64;
209
+ function $mol_crypto_auditor_private_to_public(serial) {
210
+ return serial.slice(0, 86);
211
+ }
212
+ $.$mol_crypto_auditor_private_to_public = $mol_crypto_auditor_private_to_public;
189
213
  })($ || ($ = {}));
190
214
  //mol/crypto/auditor/auditor.ts
191
215
  ;
package/web.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../native/mol/crypto/native/native.web.ts","../../secret/mol/crypto/secret/secret.ts","../../cipher/mol/crypto/cipher/cipher.ts","../../auditor/mol/crypto/auditor/auditor.ts","../../hash/mol/crypto/hash/hash.ts","../../salt/mol/crypto/salt/salt.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;AEFA,IAAU,CAAC,CAEV;AAFD,WAAU,CAAC;IACC,oBAAkB,GAAG,MAAM,CAAA;AACvC,CAAC,EAFS,CAAC,KAAD,CAAC,QAEV;;;;ACFD,IAAU,CAAC,CA8EV;AA9ED,WAAU,CAAC;IAEV,MAAM,SAAS,GAAG;QACjB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,EAAE;KACb,CAAA;IAGD,MAAa,kBAAmB,SAAQ,MAAM;QASnC;QANV,MAAM,CAAC,IAAI,GAAG,EAAE,CAAA;QAGhB,MAAM,CAAC,KAAK,GAAG,CAAC,CAAA;QAEhB,YACU,MAAuC;YAEhD,KAAK,EAAE,CAAA;YAFE,WAAM,GAAN,MAAM,CAAiC;QAGjD,CAAC;QAED,MAAM,CAA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I,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;YACb,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;YACb,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;SAEb;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAG;YAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YACpB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC,GAAG,QAAQ,GAAG,IAAI,KAAK,CAAC,GAAG,MAAM,GAAG,IAAI,KAAK,EAAE,GAAG,IAAI,CAAA;SACtF;QAED,OAAO,IAAI,UAAU,CAAE,IAAI,CAAC,MAAM,CAAE,CAAA;IACrC,CAAC;IA3Fe,kBAAgB,mBA2F/B,CAAA;AAEF,CAAC,EAlGS,CAAC,KAAD,CAAC,QAkGV;;;;AClGD,IAAU,CAAC,CASV;AATD,WAAU,CAAC;IAGV,SAAgB,gBAAgB;QAC/B,OAAO,kBAAkB,CAAC,eAAe,CACxC,IAAI,UAAU,CAAE,EAAE,CAAE,CACpB,CAAA;IACF,CAAC;IAJe,kBAAgB,mBAI/B,CAAA;AAEF,CAAC,EATS,CAAC,KAAD,CAAC,QASV;;","file":"web.js","sourcesContent":[null,null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\texport var $mol_crypto_native = crypto\n}\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'AES-GCM',\n\t\tlength: 128,\n\t\ttagLength: 32,\n\t}\n\t\n\t/** Symmetric cipher with shortest payload */\n\texport class $mol_crypto_secret extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 16\n\t\t\n\t\t/** Extra size in bytes to encrypted data. */\n\t\tstatic extra = 4\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async generate() {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.generateKey(\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'raw',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 16 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'raw',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\n\t\t/** 4 bytes + data length */\n\t\tasync encrypt( open: BufferSource, salt: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.encrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\topen\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( closed: BufferSource, salt : BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.decrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\tclosed\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n}\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'RSA-OAEP',\n\t\tmodulusLength: 1024,\n\t\tpublicExponent: new Uint8Array([ 1, 0, 1 ]),\n\t\thash: 'SHA-256',\n\t}\n\t\n\t/** Asymmetric cipher pair with shortest payload */\n\texport async function $mol_crypto_cipher_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $mol_crypto_native.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_cipher_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_cipher_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher public key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_public extends Object {\n\t\t\n\t\t/** Public key size in bytes. */\n\t\tstatic size = 162\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 162 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** max 86 bytes input, 128 bytes output */\n\t\tasync encrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.encrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher private key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_private extends Object {\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** ~640 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.decrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Encrypted size in bytes. */\n\texport const $mol_crypto_cipher_ecrypted_size = 128\n\n}\n","namespace $ {\n\n\t/** @FIXME Need polyfill for Safari and Node (https://github.com/microsoft/MSR-JavaScript-Crypto/) */\n\tconst algorithm = {\n\t\tname: 'ECDSA',\n\t\thash: 'SHA-256',\n\t\tnamedCurve: \"P-256\",\n\t}\n\t\n\t/** Asymmetric signing pair with shortest payload */\n\texport async function $mol_crypto_auditor_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $mol_crypto_native.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'sign', 'verify' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_auditor_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_auditor_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing public key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_public extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 91\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'verify' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 62 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync verify( data: BufferSource, sign: BufferSource ) {\n\t\t\treturn await $mol_crypto_native.subtle.verify(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tsign,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing private key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_private extends Object {\n\t\t\n\t\t/** Max key size in bytes. */\n\t\tstatic size = 200\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'sign' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 190-200 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 32 bytes */\n\t\tasync sign( data: BufferSource ) {\n\t\t\t\n\t\t\treturn await $mol_crypto_native.subtle.sign(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata\n\t\t\t)\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Sign size in bytes. */\n\texport const $mol_crypto_auditor_sign_size = 64\n\t\n}\n","namespace $ {\n\t\n\tlet sponge = new Uint32Array(80)\n\t\n\t/** Fast small sync SHA-1 */\n\texport function $mol_crypto_hash( data: Uint8Array ) {\n\t\t\n\t\tconst bits = data.byteLength << 3\n\t\tconst kbits = bits >> 5\n\t\tconst kword = 0x80 << ( 24 - bits & 0b11111 )\n\t\t\n\t\tconst bytes = 16 + ( bits + 64 >>> 9 << 4 )\n\t\tconst klens = bytes - 1\n\t\tconst words = new Int32Array( data.buffer, data.byteOffset, data.byteLength >> 2 )\n\t\t\n\t\tlet tail = 0\n\t\tfor( let i = words.length * 4; i < data.length; ++i ) {\n\t\t\ttail |= data[i] << ( i << 3 & 0b11000 )\n\t\t}\n\t\t\n\t\t// Initial\n\t\tconst hash = new Int32Array([ 1732584193, -271733879, -1732584194, 271733878, -1009589776 ])\n\t\t\n\t\t// Digest\n\t\tfor( let i = 0; i < bytes; i += 16 ) {\n\t\t\t\n\t\t\tlet h0 = hash[0]\n\t\t\tlet h1 = hash[1]\n\t\t\tlet h2 = hash[2]\n\t\t\tlet h3 = hash[3]\n\t\t\tlet h4 = hash[4]\n\n\t\t\tfor( let j = 0; j < 80; ++j ) {\n\t\t\t\t\n\t\t\t\tlet turn\n\t\t\t\t\n\t\t\t\tif( j < 16 ) {\n\t\t\t\t\t\n\t\t\t\t\tconst k = i + j\n\t\t\t\t\tif( k === klens ) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tsponge[j] = bits\n\t\t\t\t\t\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet word =\n\t\t\t\t\t\t\tk === words.length ? tail :\n\t\t\t\t\t\t\tk > words.length ? 0 :\n\t\t\t\t\t\t\twords[k]\n\t\t\t\t\t\t\n\t\t\t\t\t\tword = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF // LE -> BE\n\t\t\t\t\t\tif( k === kbits ) word |= kword\n\t\t\t\t\t\t\n\t\t\t\t\t\tsponge[j] = word\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tturn = ( h1 & h2 | ~h1 & h3 ) + 1518500249\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tconst shuffle = sponge[j-3] ^ sponge[j-8] ^ sponge[j-14] ^ sponge[j-16]\n\t\t\t\t\tsponge[j] = shuffle << 1 | shuffle >>> 31\n\t\t\t\t\t\n\t\t\t\t\tturn =\n\t\t\t\t\t\tj < 20 ? ( h1 & h2 | ~h1 & h3 ) + 1518500249 :\n\t\t\t\t\t\tj < 40 ? ( h1 ^ h2 ^ h3 ) + 1859775393 :\n\t\t\t\t\t\tj < 60 ? ( h1 & h2 | h1 & h3 | h2 & h3 ) - 1894007588 :\n\t\t\t\t\t\t( h1 ^ h2 ^ h3 ) - 899497514\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconst next = turn + h4 + ( sponge[j] >>> 0 ) + (( h0 << 5 )|( h0 >>> 27 ))\n\n\t\t\t\th4 = h3\n\t\t\t\th3 = h2\n\t\t\t\th2 = ( h1 << 30 )|( h1 >>> 2 )\n\t\t\t\th1 = h0\n\t\t\t\th0 = next\n\t\t\t\t\n\t\t\t}\n\n\t\t\thash[0] += h0\n\t\t\thash[1] += h1\n\t\t\thash[2] += h2\n\t\t\thash[3] += h3\n\t\t\thash[4] += h4\n\t\t\t\n\t\t}\n\t\t\n\t\tfor( let i = 0; i < 20; ++i ) {\n\t\t\tconst word = hash[i]\n\t\t\thash[i] = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF // BE -> LE\n\t\t}\n\n\t\treturn new Uint8Array( hash.buffer )\n\t}\n\t\n}\n","namespace $ {\n\t\n\t/** 8 byte */\n\texport function $mol_crypto_salt() {\n\t\treturn $mol_crypto_native.getRandomValues(\n\t\t\tnew Uint8Array( 12 )\n\t\t)\n\t}\n\t\n}\n"]}
1
+ {"version":3,"sources":["../../../../mam.jam.js","-","../../../../mam.ts","../../native/mol/crypto/native/native.web.ts","../../secret/mol/crypto/secret/secret.ts","../../cipher/mol/crypto/cipher/cipher.ts","../../auditor/mol/crypto/auditor/auditor.ts","../../hash/mol/crypto/hash/hash.ts","../../salt/mol/crypto/salt/salt.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;AEFA,IAAU,CAAC,CAEV;AAFD,WAAU,CAAC;IACC,oBAAkB,GAAG,MAAM,CAAA;AACvC,CAAC,EAFS,CAAC,KAAD,CAAC,QAEV;;;;ACFD,IAAU,CAAC,CA8EV;AA9ED,WAAU,CAAC;IAEV,MAAM,SAAS,GAAG;QACjB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,GAAG;QACX,S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AC,IAAI,EAAE,CAAA;YACb,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;YACb,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;YACb,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;SAEb;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAG;YAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YACpB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC,GAAG,QAAQ,GAAG,IAAI,KAAK,CAAC,GAAG,MAAM,GAAG,IAAI,KAAK,EAAE,GAAG,IAAI,CAAA;SACtF;QAED,OAAO,IAAI,UAAU,CAAE,IAAI,CAAC,MAAM,CAAE,CAAA;IACrC,CAAC;IA3Fe,kBAAgB,mBA2F/B,CAAA;AAEF,CAAC,EAlGS,CAAC,KAAD,CAAC,QAkGV;;;;AClGD,IAAU,CAAC,CASV;AATD,WAAU,CAAC;IAGV,SAAgB,gBAAgB;QAC/B,OAAO,kBAAkB,CAAC,eAAe,CACxC,IAAI,UAAU,CAAE,EAAE,CAAE,CACpB,CAAA;IACF,CAAC;IAJe,kBAAgB,mBAI/B,CAAA;AAEF,CAAC,EATS,CAAC,KAAD,CAAC,QASV;;","file":"web.js","sourcesContent":[null,null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\texport var $mol_crypto_native = crypto\n}\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'AES-GCM',\n\t\tlength: 128,\n\t\ttagLength: 32,\n\t}\n\t\n\t/** Symmetric cipher with shortest payload */\n\texport class $mol_crypto_secret extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 16\n\t\t\n\t\t/** Extra size in bytes to encrypted data. */\n\t\tstatic extra = 4\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async generate() {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.generateKey(\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'raw',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt', 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 16 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'raw',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\n\t\t/** 4 bytes + data length */\n\t\tasync encrypt( open: BufferSource, salt: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.encrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\topen\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( closed: BufferSource, salt : BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.decrypt(\n\t\t\t\t{\n\t\t\t\t\t... algorithm,\n\t\t\t\t\tiv: salt,\n\t\t\t\t},\n\t\t\t\tthis.native,\n\t\t\t\tclosed\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n}\n","namespace $ {\n\t\n\tconst algorithm = {\n\t\tname: 'RSA-OAEP',\n\t\tmodulusLength: 1024,\n\t\tpublicExponent: new Uint8Array([ 1, 0, 1 ]),\n\t\thash: 'SHA-256',\n\t}\n\t\n\t/** Asymmetric cipher pair with shortest payload */\n\texport async function $mol_crypto_cipher_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $mol_crypto_native.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'encrypt', 'decrypt' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_cipher_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_cipher_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher public key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_public extends Object {\n\t\t\n\t\t/** Public key size in bytes. */\n\t\tstatic size = 162\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'spki',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'encrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 162 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'spki',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** max 86 bytes input, 128 bytes output */\n\t\tasync encrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.encrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\n\t/** Asymmetric cipher private key wrapper with shortest payload */\n\texport class $mol_crypto_cipher_private extends Object {\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: BufferSource ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'pkcs8',\n\t\t\t\t\tserial,\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'decrypt' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** ~640 bytes */\n\t\tasync serial() {\n\t\t\treturn await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'pkcs8',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t}\n\t\t\n\t\tasync decrypt( data: BufferSource ): Promise< ArrayBuffer > {\n\t\t\treturn await $mol_crypto_native.subtle.decrypt(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Encrypted size in bytes. */\n\texport const $mol_crypto_cipher_ecrypted_size = 128\n\n}\n","namespace $ {\n\n\t/** @FIXME Need polyfill for Safari and Node (https://github.com/microsoft/MSR-JavaScript-Crypto/) */\n\tconst algorithm = {\n\t\tname: 'ECDSA',\n\t\thash: 'SHA-256',\n\t\tnamedCurve: \"P-256\",\n\t}\n\t\n\t/** Asymmetric signing pair with shortest payload */\n\texport async function $mol_crypto_auditor_pair( this: $ ) {\n\t\t\n\t\tconst pair = await $mol_crypto_native.subtle.generateKey(\n\t\t\talgorithm,\n\t\t\ttrue,\n\t\t\t[ 'sign', 'verify' ]\n\t\t)\n\t\t\n\t\treturn {\n\t\t\t\n\t\t\tpublic: new $mol_crypto_auditor_public(\n\t\t\t\tpair.publicKey as CryptoKey & { type: 'public' }\n\t\t\t),\n\t\t\t\n\t\t\tprivate: new $mol_crypto_auditor_private(\n\t\t\t\tpair.privateKey as CryptoKey & { type: 'private' }\n\t\t\t),\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing public key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_public extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 86\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'public' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\t\n\t\tstatic async from( serial: string ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'jwk',\n\t\t\t\t\t{\n\t\t\t\t\t\tcrv: \"P-256\",\n\t\t\t\t\t\text: true,\n\t\t\t\t\t\tkey_ops: ['verify'],\n\t\t\t\t\t\tkty: \"EC\",\n\t\t\t\t\t\tx: serial.slice( 0, 43 ),\n\t\t\t\t\t\ty: serial.slice( 43, 86 ),\n\t\t\t\t\t},\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'verify' ],\n\t\t\t\t) as CryptoKey & { type: 'public' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 62 bytes */\n\t\tasync serial(): Promise< string > {\n\t\t\tconst { x, y } = await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'jwk',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t\treturn x! + y!\n\t\t}\n\t\t\n\t\tasync verify( data: BufferSource, sign: BufferSource ) {\n\t\t\treturn await $mol_crypto_native.subtle.verify(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tsign,\n\t\t\t\tdata,\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Asymmetric signing private key wrapper with shortest payload */\n\texport class $mol_crypto_auditor_private extends Object {\n\t\t\n\t\t/** Key size in bytes. */\n\t\tstatic size = 129\n\t\t\n\t\tconstructor(\n\t\t\treadonly native: CryptoKey & { type: 'private' }\n\t\t) {\n\t\t\tsuper()\n\t\t}\n\t\n\t\tstatic async from( serial: string ) {\n\t\t\treturn new this(\n\t\t\t\tawait $mol_crypto_native.subtle.importKey(\n\t\t\t\t\t'jwk',\n\t\t\t\t\t{\n\t\t\t\t\t\tcrv: \"P-256\",\n\t\t\t\t\t\text: true,\n\t\t\t\t\t\tkey_ops: ['sign'],\n\t\t\t\t\t\tkty: \"EC\",\n\t\t\t\t\t\tx: serial.slice( 0, 43 ),\n\t\t\t\t\t\ty: serial.slice( 43, 86 ),\n\t\t\t\t\t\td: serial.slice( 86, 129 ),\n\t\t\t\t\t},\n\t\t\t\t\talgorithm,\n\t\t\t\t\ttrue,\n\t\t\t\t\t[ 'sign' ],\n\t\t\t\t) as CryptoKey & { type: 'private' }\n\t\t\t)\n\t\t}\n\t\t\n\t\t/** 129 bytes */\n\t\tasync serial(): Promise< string > {\n\t\t\tconst { x, y, d } = await $mol_crypto_native.subtle.exportKey(\n\t\t\t\t'jwk',\n\t\t\t\tthis.native,\n\t\t\t)\n\t\t\treturn x! + y! + d!\n\t\t}\n\t\t\n\t\t/** 64 bytes */\n\t\tasync sign( data: BufferSource ) {\n\t\t\t\n\t\t\treturn await $mol_crypto_native.subtle.sign(\n\t\t\t\talgorithm,\n\t\t\t\tthis.native,\n\t\t\t\tdata\n\t\t\t)\n\t\t\t\n\t\t}\n\t\t\n\t\t/** Makes public key from private */\n\t\tasync public() {\n\t\t\treturn await $mol_crypto_auditor_public.from(\n\t\t\t\t$mol_crypto_auditor_private_to_public( await this.serial() )\n\t\t\t)\n\t\t}\n\t\t\n\t}\n\t\n\t/** Sign size in bytes. */\n\texport const $mol_crypto_auditor_sign_size = 64\n\t\n\texport function $mol_crypto_auditor_private_to_public( serial: string ) {\n\t\treturn serial.slice( 0, 86 )\n\t}\n\t\n}\n","namespace $ {\n\t\n\tlet sponge = new Uint32Array(80)\n\t\n\t/** Fast small sync SHA-1 */\n\texport function $mol_crypto_hash( data: Uint8Array ) {\n\t\t\n\t\tconst bits = data.byteLength << 3\n\t\tconst kbits = bits >> 5\n\t\tconst kword = 0x80 << ( 24 - bits & 0b11111 )\n\t\t\n\t\tconst bytes = 16 + ( bits + 64 >>> 9 << 4 )\n\t\tconst klens = bytes - 1\n\t\tconst words = new Int32Array( data.buffer, data.byteOffset, data.byteLength >> 2 )\n\t\t\n\t\tlet tail = 0\n\t\tfor( let i = words.length * 4; i < data.length; ++i ) {\n\t\t\ttail |= data[i] << ( i << 3 & 0b11000 )\n\t\t}\n\t\t\n\t\t// Initial\n\t\tconst hash = new Int32Array([ 1732584193, -271733879, -1732584194, 271733878, -1009589776 ])\n\t\t\n\t\t// Digest\n\t\tfor( let i = 0; i < bytes; i += 16 ) {\n\t\t\t\n\t\t\tlet h0 = hash[0]\n\t\t\tlet h1 = hash[1]\n\t\t\tlet h2 = hash[2]\n\t\t\tlet h3 = hash[3]\n\t\t\tlet h4 = hash[4]\n\n\t\t\tfor( let j = 0; j < 80; ++j ) {\n\t\t\t\t\n\t\t\t\tlet turn\n\t\t\t\t\n\t\t\t\tif( j < 16 ) {\n\t\t\t\t\t\n\t\t\t\t\tconst k = i + j\n\t\t\t\t\tif( k === klens ) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tsponge[j] = bits\n\t\t\t\t\t\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet word =\n\t\t\t\t\t\t\tk === words.length ? tail :\n\t\t\t\t\t\t\tk > words.length ? 0 :\n\t\t\t\t\t\t\twords[k]\n\t\t\t\t\t\t\n\t\t\t\t\t\tword = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF // LE -> BE\n\t\t\t\t\t\tif( k === kbits ) word |= kword\n\t\t\t\t\t\t\n\t\t\t\t\t\tsponge[j] = word\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tturn = ( h1 & h2 | ~h1 & h3 ) + 1518500249\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tconst shuffle = sponge[j-3] ^ sponge[j-8] ^ sponge[j-14] ^ sponge[j-16]\n\t\t\t\t\tsponge[j] = shuffle << 1 | shuffle >>> 31\n\t\t\t\t\t\n\t\t\t\t\tturn =\n\t\t\t\t\t\tj < 20 ? ( h1 & h2 | ~h1 & h3 ) + 1518500249 :\n\t\t\t\t\t\tj < 40 ? ( h1 ^ h2 ^ h3 ) + 1859775393 :\n\t\t\t\t\t\tj < 60 ? ( h1 & h2 | h1 & h3 | h2 & h3 ) - 1894007588 :\n\t\t\t\t\t\t( h1 ^ h2 ^ h3 ) - 899497514\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconst next = turn + h4 + ( sponge[j] >>> 0 ) + (( h0 << 5 )|( h0 >>> 27 ))\n\n\t\t\t\th4 = h3\n\t\t\t\th3 = h2\n\t\t\t\th2 = ( h1 << 30 )|( h1 >>> 2 )\n\t\t\t\th1 = h0\n\t\t\t\th0 = next\n\t\t\t\t\n\t\t\t}\n\n\t\t\thash[0] += h0\n\t\t\thash[1] += h1\n\t\t\thash[2] += h2\n\t\t\thash[3] += h3\n\t\t\thash[4] += h4\n\t\t\t\n\t\t}\n\t\t\n\t\tfor( let i = 0; i < 20; ++i ) {\n\t\t\tconst word = hash[i]\n\t\t\thash[i] = word << 24 | word << 8 & 0xFF0000 | word >>> 8 & 0xFF00 | word >>> 24 & 0xFF // BE -> LE\n\t\t}\n\n\t\treturn new Uint8Array( hash.buffer )\n\t}\n\t\n}\n","namespace $ {\n\t\n\t/** 8 byte */\n\texport function $mol_crypto_salt() {\n\t\treturn $mol_crypto_native.getRandomValues(\n\t\t\tnew Uint8Array( 12 )\n\t\t)\n\t}\n\t\n}\n"]}
package/web.test.js CHANGED
@@ -964,9 +964,9 @@ var $;
964
964
  async 'sizes'() {
965
965
  const pair = await $$.$mol_crypto_auditor_pair();
966
966
  const key_public = await pair.public.serial();
967
- $mol_assert_equal(key_public.byteLength, $mol_crypto_auditor_public.size);
967
+ $mol_assert_equal(key_public.length, $mol_crypto_auditor_public.size);
968
968
  const key_private = await pair.private.serial();
969
- $mol_assert_ok(key_private.byteLength < $mol_crypto_auditor_private.size);
969
+ $mol_assert_equal(key_private.length, $mol_crypto_auditor_private.size);
970
970
  const data = new Uint8Array([1, 2, 3]);
971
971
  const sign = await pair.private.sign(data);
972
972
  $mol_assert_equal(sign.byteLength, $mol_crypto_auditor_sign_size);
@@ -985,6 +985,16 @@ var $;
985
985
  const Bob = await $mol_crypto_auditor_public.from(await pair.public.serial());
986
986
  $mol_assert_ok(await Bob.verify(data, sign));
987
987
  },
988
+ async 'take public key from private'() {
989
+ const pair = await $$.$mol_crypto_auditor_pair();
990
+ const data = new Uint8Array([1, 2, 3]);
991
+ const Alice = pair.private;
992
+ const sign = await Alice.sign(data);
993
+ const Bob = await pair.private.public();
994
+ const Carol = await $mol_crypto_auditor_public.from(await pair.private.serial());
995
+ $mol_assert_ok(await Bob.verify(data, sign));
996
+ $mol_assert_ok(await Carol.verify(data, sign));
997
+ },
988
998
  });
989
999
  })($ || ($ = {}));
990
1000
  //mol/crypto/auditor/auditor.web.test.ts