Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build node wasm not bundled up #226

Merged
merged 4 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
"outputName": "junit.xml"
},
"dependencies": {
"@atala/apollo": "^1.2.16",
"@atala/apollo": "^1.3.4",
"@scure/bip32": "^1.3.0",
"@scure/bip39": "^1.1.1",
"@stablelib/base64": "^1.0.1",
Expand Down Expand Up @@ -210,4 +210,4 @@
"overrides": {
"crypto-js": "^4.2.0"
}
}
}
4 changes: 2 additions & 2 deletions rollup/rollup.node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ const nodePlugins = [
preventAssignment: true,
values: {
'didcomm_js_bg.wasm': "../node-wasm/didcomm.wasm",
'anoncreds_bg.wasm': "../node-wasm/anoncreds.wasm",
'anoncreds_wasm_bg.wasm': "../node-wasm/anoncreds.wasm",
}
}),
copy({
targets: [
{ src: "./externals/generated/anoncreds-wasm-node/anoncreds_bg.wasm", dest: "build/node-wasm", rename: "anoncreds.wasm" },
{ src: "./externals/generated/anoncreds-wasm-node/anoncreds_wasm_bg.wasm", dest: "build/node-wasm", rename: "anoncreds.wasm" },
{ src: "./externals/generated/didcomm-wasm-node/didcomm_js_bg.wasm", dest: "build/node-wasm", rename: 'didcomm.wasm' },
],
}),
Expand Down
2 changes: 1 addition & 1 deletion src/apollo/Apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { X25519PublicKey } from "./utils/X25519PublicKey";
import ApolloPKG from "@atala/apollo";
import { DerivationPath } from "./utils/derivation/DerivationPath";

const ApolloSDK = ApolloPKG.io.iohk.atala.prism.apollo;
const ApolloSDK = ApolloPKG.org.hyperledger.identus.apollo;
const Mnemonic = ApolloSDK.derivation.Mnemonic.Companion;
const HDKey = ApolloSDK.derivation.HDKey;
const BigIntegerWrapper = ApolloSDK.derivation.BigIntegerWrapper;
Expand Down
2 changes: 1 addition & 1 deletion src/apollo/utils/Ed25519KeyPair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class Ed25519KeyPair extends KeyPair {

static generateKeyPair() {
const keyPair =
ApolloBaseAsymmetricEncryption.io.iohk.atala.prism.apollo.utils.KMMEdKeyPair.Companion.generateKeyPair();
ApolloBaseAsymmetricEncryption.org.hyperledger.identus.apollo.utils.KMMEdKeyPair.Companion.generateKeyPair();

return new Ed25519KeyPair(
new Ed25519PrivateKey(keyPair.privateKey.raw),
Expand Down
4 changes: 2 additions & 2 deletions src/apollo/utils/Ed25519PrivateKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ export class Ed25519PrivateKey extends PrivateKey implements ExportableKey, Sign

private getInstance(
value?: Int8Array | Uint8Array
): ApolloPkg.io.iohk.atala.prism.apollo.utils.KMMEdPrivateKey {
): ApolloPkg.org.hyperledger.identus.apollo.utils.KMMEdPrivateKey {
// eslint-disable-next-line no-extra-boolean-cast
const bytes = !!value ? Buffer.from(value) : this.raw;
const instance =
new ApolloPkg.io.iohk.atala.prism.apollo.utils.KMMEdPrivateKey(
new ApolloPkg.org.hyperledger.identus.apollo.utils.KMMEdPrivateKey(
Int8Array.from(bytes)
);

Expand Down
4 changes: 2 additions & 2 deletions src/apollo/utils/Ed25519PublicKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ export class Ed25519PublicKey extends PublicKey implements ExportableKey, Storab

private getInstance(
value?: Int8Array | Uint8Array
): ApolloPkg.io.iohk.atala.prism.apollo.utils.KMMEdPublicKey {
): ApolloPkg.org.hyperledger.identus.apollo.utils.KMMEdPublicKey {
// eslint-disable-next-line no-extra-boolean-cast
const bytes = !!value ? Buffer.from(value) : this.raw;
const instance =
new ApolloPkg.io.iohk.atala.prism.apollo.utils.KMMEdPublicKey(
new ApolloPkg.org.hyperledger.identus.apollo.utils.KMMEdPublicKey(
Int8Array.from(bytes)
);

Expand Down
8 changes: 4 additions & 4 deletions src/apollo/utils/Secp256k1KeyPair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export class Secp256k1KeyPair extends KeyPair {

static generateKeyPair() {
const {
io: {
iohk: {
atala: {
prism: { apollo },
org: {
hyperledger: {
identus: {
apollo
},
},
},
Expand Down
5 changes: 2 additions & 3 deletions src/apollo/utils/Secp256k1PrivateKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
StorableKey,
} from "../../domain/models/keyManagement";

const Apollo = ApolloPkg.io.iohk.atala.prism.apollo;
const Apollo = ApolloPkg.org.hyperledger.identus.apollo;
const HDKey = Apollo.derivation.HDKey;
const BigIntegerWrapper = Apollo.derivation.BigIntegerWrapper;

Expand All @@ -23,8 +23,7 @@ const BigIntegerWrapper = Apollo.derivation.BigIntegerWrapper;
*/
export class Secp256k1PrivateKey
extends PrivateKey
implements DerivableKey, ExportableKey, SignableKey, StorableKey
{
implements DerivableKey, ExportableKey, SignableKey, StorableKey {
public readonly recoveryId = StorableKey.recoveryId("secp256k1", "priv");

public keySpecification: Map<string, string> = new Map();
Expand Down
6 changes: 3 additions & 3 deletions src/apollo/utils/Secp256k1PublicKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class Secp256k1PublicKey extends PublicKey implements StorableKey, Export
}

private get native() {
return ApolloPkg.io.iohk.atala.prism.apollo.utils.KMMECSecp256k1PublicKey.Companion.secp256k1FromBytes(
return ApolloPkg.org.hyperledger.identus.apollo.utils.KMMECSecp256k1PublicKey.Companion.secp256k1FromBytes(
Int8Array.from(this.raw)
);
}
Expand Down Expand Up @@ -143,7 +143,7 @@ export class Secp256k1PublicKey extends PublicKey implements StorableKey, Export
static secp256k1FromBytes(encoded: Uint8Array): Secp256k1PublicKey {
return new Secp256k1PublicKey(
Uint8Array.from(
ApolloPkg.io.iohk.atala.prism.apollo.utils.KMMECSecp256k1PublicKey.Companion.secp256k1FromBytes(
ApolloPkg.org.hyperledger.identus.apollo.utils.KMMECSecp256k1PublicKey.Companion.secp256k1FromBytes(
Int8Array.from(encoded)
).raw
)
Expand Down Expand Up @@ -178,7 +178,7 @@ export class Secp256k1PublicKey extends PublicKey implements StorableKey, Export
const xCoord = Buffer.from(x.toArray());
const yCoord = Buffer.from(y.toArray());
const publicKey =
ApolloPkg.io.iohk.atala.prism.apollo.utils.KMMECSecp256k1PublicKey.Companion.secp256k1FromByteCoordinates(
ApolloPkg.org.hyperledger.identus.apollo.utils.KMMECSecp256k1PublicKey.Companion.secp256k1FromByteCoordinates(
Int8Array.from(xCoord),
Int8Array.from(yCoord)
);
Expand Down
2 changes: 1 addition & 1 deletion src/apollo/utils/X25519KeyPair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class X25519KeyPair extends KeyPair {

static generateKeyPair() {
const keyPair =
ApolloBaseAsymmetricEncryption.io.iohk.atala.prism.apollo.utils.KMMX25519KeyPair.Companion.generateKeyPair();
ApolloBaseAsymmetricEncryption.org.hyperledger.identus.apollo.utils.KMMX25519KeyPair.Companion.generateKeyPair();

return new X25519KeyPair(
new X25519PrivateKey(keyPair.privateKey.raw),
Expand Down
2 changes: 1 addition & 1 deletion src/apollo/utils/X25519PrivateKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class X25519PrivateKey extends PrivateKey implements ExportableKey, Stora
// eslint-disable-next-line no-extra-boolean-cast
const bytes = !!value ? Buffer.from(value) : this.raw;
const instance =
new ApolloPkg.io.iohk.atala.prism.apollo.utils.KMMX25519PrivateKey(
new ApolloPkg.org.hyperledger.identus.apollo.utils.KMMX25519PrivateKey(
Int8Array.from(bytes)
);

Expand Down
2 changes: 1 addition & 1 deletion src/apollo/utils/X25519PublicKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class X25519PublicKey extends PublicKey implements ExportableKey, Storabl
// eslint-disable-next-line no-extra-boolean-cast
const bytes = !!value ? Buffer.from(value) : this.raw;
const instance =
new ApolloPkg.io.iohk.atala.prism.apollo.utils.KMMX25519PublicKey(
new ApolloPkg.org.hyperledger.identus.apollo.utils.KMMX25519PublicKey(
Int8Array.from(bytes)
);

Expand Down
8 changes: 4 additions & 4 deletions src/castor/Castor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ export default class Castor implements CastorInterface {
);

const didCreationData =
new Protos.io.iohk.atala.prism.protos.CreateDIDOperation.DIDCreationData({
new Protos.org.hyperledger.identus.protos.CreateDIDOperation.DIDCreationData({
public_keys: [authenticateKey.toProto(), publicKey.toProto()],
services: services?.map((service) => {
return new Protos.io.iohk.atala.prism.protos.Service({
return new Protos.org.hyperledger.identus.protos.Service({
service_endpoint: [service.serviceEndpoint.uri],
id: service.id,
type: service.type.at(0),
Expand All @@ -153,11 +153,11 @@ export default class Castor implements CastorInterface {
});

const didOperation =
new Protos.io.iohk.atala.prism.protos.CreateDIDOperation({
new Protos.org.hyperledger.identus.protos.CreateDIDOperation({
did_data: didCreationData,
});

const operation = new Protos.io.iohk.atala.prism.protos.AtalaOperation({
const operation = new Protos.org.hyperledger.identus.protos.AtalaOperation({
create_did: didOperation,
});

Expand Down
34 changes: 17 additions & 17 deletions src/castor/did/prismDID/PrismDIDPublicKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ export enum Usage {

export function getProtosUsage(
usage: Usage
): Protos.io.iohk.atala.prism.protos.KeyUsage {
): Protos.org.hyperledger.identus.protos.KeyUsage {
switch (usage) {
case Usage.UNKNOWN_KEY:
return Protos.io.iohk.atala.prism.protos.KeyUsage.UNKNOWN_KEY;
return Protos.org.hyperledger.identus.protos.KeyUsage.UNKNOWN_KEY;
case Usage.MASTER_KEY:
return Protos.io.iohk.atala.prism.protos.KeyUsage.MASTER_KEY;
return Protos.org.hyperledger.identus.protos.KeyUsage.MASTER_KEY;
case Usage.ISSUING_KEY:
return Protos.io.iohk.atala.prism.protos.KeyUsage.ISSUING_KEY;
return Protos.org.hyperledger.identus.protos.KeyUsage.ISSUING_KEY;
case Usage.KEY_AGREEMENT_KEY:
return Protos.io.iohk.atala.prism.protos.KeyUsage.KEY_AGREEMENT_KEY;
return Protos.org.hyperledger.identus.protos.KeyUsage.KEY_AGREEMENT_KEY;
case Usage.AUTHENTICATION_KEY:
return Protos.io.iohk.atala.prism.protos.KeyUsage.AUTHENTICATION_KEY;
return Protos.org.hyperledger.identus.protos.KeyUsage.AUTHENTICATION_KEY;
case Usage.REVOCATION_KEY:
return Protos.io.iohk.atala.prism.protos.KeyUsage.REVOCATION_KEY;
return Protos.org.hyperledger.identus.protos.KeyUsage.REVOCATION_KEY;
case Usage.CAPABILITY_INVOCATION_KEY:
return Protos.io.iohk.atala.prism.protos.KeyUsage
return Protos.org.hyperledger.identus.protos.KeyUsage
.CAPABILITY_INVOCATION_KEY;
case Usage.CAPABILITY_DELEGATION_KEY:
return Protos.io.iohk.atala.prism.protos.KeyUsage
return Protos.org.hyperledger.identus.protos.KeyUsage
.CAPABILITY_DELEGATION_KEY;
default:
return Protos.io.iohk.atala.prism.protos.KeyUsage.UNKNOWN_KEY;
return Protos.org.hyperledger.identus.protos.KeyUsage.UNKNOWN_KEY;
}
}

Expand All @@ -66,7 +66,7 @@ export function getUsageId(index: Usage): string {
}

export function getUsage(
protosUsage: Protos.io.iohk.atala.prism.protos.KeyUsage
protosUsage: Protos.org.hyperledger.identus.protos.KeyUsage
): Usage {
let usage: Usage;
switch (protosUsage) {
Expand Down Expand Up @@ -114,7 +114,7 @@ export class PrismDIDPublicKey {

static fromProto(
apollo: Apollo,
proto: Protos.io.iohk.atala.prism.protos.PublicKey
proto: Protos.org.hyperledger.identus.protos.PublicKey
): PrismDIDPublicKey {
const id = proto.id;
const usage = proto.usage;
Expand All @@ -124,7 +124,7 @@ export class PrismDIDPublicKey {
case "compressed_ec_key_data":
keyData = new Secp256k1PublicKey(
Uint8Array.from(
ApolloPKG.io.iohk.atala.prism.apollo.utils.KMMECSecp256k1PublicKey.Companion.secp256k1FromBytes(
ApolloPKG.org.hyperledger.identus.apollo.utils.KMMECSecp256k1PublicKey.Companion.secp256k1FromBytes(
Int8Array.from(proto.compressed_ec_key_data.data)
).raw
)
Expand All @@ -133,7 +133,7 @@ export class PrismDIDPublicKey {
case "ec_key_data":
keyData = new Secp256k1PublicKey(
Uint8Array.from(
ApolloPKG.io.iohk.atala.prism.apollo.utils.KMMECSecp256k1PublicKey.Companion.secp256k1FromByteCoordinates(
ApolloPKG.org.hyperledger.identus.apollo.utils.KMMECSecp256k1PublicKey.Companion.secp256k1FromByteCoordinates(
Int8Array.from(proto.ec_key_data.x),
Int8Array.from(proto.ec_key_data.y)
).raw
Expand All @@ -147,20 +147,20 @@ export class PrismDIDPublicKey {
return new PrismDIDPublicKey(id, getUsage(usage), keyData);
}

toProto(): Protos.io.iohk.atala.prism.protos.PublicKey {
toProto(): Protos.org.hyperledger.identus.protos.PublicKey {
const encoded = this.keyData.getEncoded();
const xBytes = encoded.slice(1, 1 + ECConfig.PRIVATE_KEY_BYTE_SIZE);
const yBytes = encoded.slice(
1 + ECConfig.PRIVATE_KEY_BYTE_SIZE,
encoded.length
);
const ecKeyData = new Protos.io.iohk.atala.prism.protos.ECKeyData({
const ecKeyData = new Protos.org.hyperledger.identus.protos.ECKeyData({
curve: Curve.SECP256K1.toLocaleLowerCase(),
x: xBytes,
y: yBytes,
});
const usage = getProtosUsage(this.usage);
const publicKey = new Protos.io.iohk.atala.prism.protos.PublicKey({
const publicKey = new Protos.org.hyperledger.identus.protos.PublicKey({
id: this.id,
usage: usage,
ec_key_data: ecKeyData,
Expand Down
4 changes: 2 additions & 2 deletions src/castor/protos/common_models.proto
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
syntax = "proto3";

option java_multiple_files = true;
option java_package = "io.iohk.atala.prism.protos";
option java_package = "org.hyperledger.identus.protos";

package io.iohk.atala.prism.protos;
package org.hyperledger.identus.protos;

import "google/protobuf/timestamp.proto";

Expand Down
2 changes: 1 addition & 1 deletion src/castor/protos/common_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./google/protobuf/timestamp";
import * as pb_1 from "google-protobuf";
export namespace io.iohk.atala.prism.protos {
export namespace org.hyperledger.identus.protos {
export enum SortByDirection {
SORT_BY_DIRECTION_UNKNOWN = 0,
SORT_BY_DIRECTION_ASCENDING = 1,
Expand Down
2 changes: 1 addition & 1 deletion src/castor/protos/common_models_pb.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// package: io.iohk.atala.prism.protos
// package: org.hyperledger.identus.protos
// file: common_models.proto

import * as jspb from "google-protobuf";
Expand Down
4 changes: 2 additions & 2 deletions src/castor/protos/node_models.proto
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
syntax = "proto3";

option java_multiple_files = true;
option java_package = "io.iohk.atala.prism.protos";
option java_package = "org.hyperledger.identus.protos";

package io.iohk.atala.prism.protos;
package org.hyperledger.identus.protos;

import "common_models.proto";
import "google/protobuf/timestamp.proto";
Expand Down
Loading
Loading