Skip to content

Commit

Permalink
Bump prelease version + appease fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Hjort committed Aug 9, 2023
1 parent d79921e commit bf59404
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 46 deletions.
4 changes: 2 additions & 2 deletions packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@concordium/common-sdk",
"version": "9.1.0-alpha",
"version": "9.1.0-alpha.1",
"license": "Apache-2.0",
"engines": {
"node": ">=14.16.0"
Expand Down Expand Up @@ -51,7 +51,7 @@
"build-dev": "tsc"
},
"dependencies": {
"@concordium/rust-bindings": "1.2.0-alpha",
"@concordium/rust-bindings": "1.2.0-alpha.1",
"@grpc/grpc-js": "^1.3.4",
"@noble/ed25519": "^1.7.1",
"@protobuf-ts/runtime-rpc": "^2.8.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/rust-bindings/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@concordium/rust-bindings",
"version": "1.2.0-alpha",
"version": "1.2.0-alpha.1",
"license": "Apache-2.0",
"engines": {
"node": ">=14.16.0"
Expand Down
71 changes: 40 additions & 31 deletions packages/rust-bindings/src/aux_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use crate::{helpers::*, types::*};
use anyhow::{anyhow, bail, ensure, Context, Result};
use concordium_base::{
base::{BakerAggregationSignKey, BakerElectionSignKey, BakerKeyPairs, BakerSignatureSignKey},
cis4_types::IssuerKey,
common::{
types::{KeyIndex, KeyPair, TransactionTime},
*,
},
contracts_common::{
from_bytes,
schema::{ModuleV0, Type, VersionedModuleSchema},
ContractAddress,
Cursor,
ContractAddress, Cursor,
},
id::{
account_holder::{
Expand All @@ -20,21 +20,23 @@ use concordium_base::{
constants,
constants::{ArCurve, AttributeKind},
dodis_yampolskiy_prf as prf,
id_proof_types::{Proof, Statement, StatementWithContext, ProofVersion},
id_proof_types::{Proof, ProofVersion, Statement, StatementWithContext},
pedersen_commitment::{
CommitmentKey as PedersenKey, Randomness as PedersenRandomness, Value as PedersenValue,
Value,
},
secret_sharing::Threshold,
types::*,
},
cis4_types::IssuerKey,
web3id::{Request, Web3IdAttribute, OwnedCommitmentInputs, Web3IdSigner, SignedCommitments, CredentialHolderId },
transactions::{ConfigureBakerKeysPayload, Payload},
web3id::{
CredentialHolderId, OwnedCommitmentInputs, Request, SignedCommitments, Web3IdAttribute,
Web3IdSigner,
},
};
use either::Either::Left;
use hex;
use key_derivation::{ConcordiumHdWallet, Net, CredentialContext};
use key_derivation::{ConcordiumHdWallet, CredentialContext, Net};
use rand::thread_rng;
use serde::{Deserialize as SerdeDeserialize, Serialize as SerdeSerialize};
use serde_json::{from_str, to_string, Value as SerdeValue};
Expand Down Expand Up @@ -386,7 +388,7 @@ pub fn create_credential_v1_aux(input: CredentialInput) -> Result<JsonString> {
wallet,
identity_provider_index: identity_provider_index.into(),
identity_index: input.identity_index,
credential_index: u8::from(input.cred_number),
credential_index: input.cred_number,
};

let (cdi, _) = create_credential(
Expand Down Expand Up @@ -794,7 +796,7 @@ pub fn create_id_proof_aux(input: IdProofInput) -> Result<JsonString> {
let credential_context = CredentialContext {
wallet,
identity_provider_index: input.identity_provider_index.into(),
credential_index: u8::from(input.cred_number),
credential_index: input.cred_number,
identity_index: input.identity_index,
};

Expand Down Expand Up @@ -829,28 +831,28 @@ pub fn create_id_proof_aux(input: IdProofInput) -> Result<JsonString> {
}

#[derive(SerdeDeserialize)]
struct Web3SecretKey (
#[serde(deserialize_with = "base16_decode")]
ed25519_dalek::SecretKey
);
struct Web3SecretKey(#[serde(deserialize_with = "base16_decode")] ed25519_dalek::SecretKey);

impl Web3IdSigner for Web3SecretKey {
fn id(&self) -> ed25519_dalek::PublicKey { self.0.id() }
fn sign(&self, msg: &impl AsRef<[u8]>) -> ed25519_dalek::Signature {
self.0.sign(msg)
}

fn sign(&self, msg: &impl AsRef<[u8]>) -> ed25519_dalek::Signature { self.0.sign(msg) }
}

#[derive(SerdeDeserialize)]
#[serde(rename_all = "camelCase")]
pub struct Web3IdProofInput {
request: Request<constants::ArCurve, Web3IdAttribute>,
global_context: GlobalContext<constants::ArCurve>,
commitment_inputs: Vec<OwnedCommitmentInputs<constants::ArCurve, Web3IdAttribute, Web3SecretKey>>,
request: Request<constants::ArCurve, Web3IdAttribute>,
global_context: GlobalContext<constants::ArCurve>,
commitment_inputs:
Vec<OwnedCommitmentInputs<constants::ArCurve, Web3IdAttribute, Web3SecretKey>>,
}

pub fn create_web3_id_proof_aux(input: Web3IdProofInput) -> Result<JsonString> {
let presentation = input.request.prove(&input.global_context, input.commitment_inputs.iter().map(Into::into));
let presentation = input.request.prove(
&input.global_context,
input.commitment_inputs.iter().map(Into::into),
);
Ok(json!(presentation.unwrap()).to_string())
}

Expand Down Expand Up @@ -977,20 +979,19 @@ pub fn generate_baker_keys(sender: AccountAddress) -> Result<JsonString> {
#[derive(SerdeDeserialize)]
#[serde(rename_all = "camelCase")]
pub struct VerifyWeb3IdCredentialSignatureInput {
global_context: GlobalContext<constants::ArCurve>,
values: BTreeMap<String, Web3IdAttribute>,
randomness: BTreeMap<String, PedersenRandomness<constants::ArCurve>>,
#[serde(
serialize_with = "base16_encode",
deserialize_with = "base16_decode"
)]
signature: ed25519_dalek::Signature,
holder: CredentialHolderId,
global_context: GlobalContext<constants::ArCurve>,
values: BTreeMap<String, Web3IdAttribute>,
randomness: BTreeMap<String, PedersenRandomness<constants::ArCurve>>,
#[serde(serialize_with = "base16_encode", deserialize_with = "base16_decode")]
signature: ed25519_dalek::Signature,
holder: CredentialHolderId,
issuer_public_key: IssuerKey,
issuer_contract: ContractAddress,
issuer_contract: ContractAddress,
}

pub fn verify_web3_id_credential_signature_aux(input: VerifyWeb3IdCredentialSignatureInput) -> Result<bool> {
pub fn verify_web3_id_credential_signature_aux(
input: VerifyWeb3IdCredentialSignatureInput,
) -> Result<bool> {
let cmm_key = &input.global_context.on_chain_commitment_key;
let mut commitments = BTreeMap::new();
for ((vi, value), (ri, randomness)) in input.values.iter().zip(input.randomness.iter()) {
Expand All @@ -1005,5 +1006,13 @@ pub fn verify_web3_id_credential_signature_aux(input: VerifyWeb3IdCredentialSign
),
);
}
Ok(SignedCommitments{ signature: input.signature, commitments}.verify_signature(&input.holder,&input.issuer_public_key,input.issuer_contract))
Ok(SignedCommitments {
signature: input.signature,
commitments,
}
.verify_signature(
&input.holder,
&input.issuer_public_key,
input.issuer_contract,
))
}
20 changes: 16 additions & 4 deletions packages/rust-bindings/src/external_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,14 @@ pub fn get_verifiable_credential_signing_key_ext(
issuer_subindex: u64,
verifiable_credential_index: u32,
) -> JsResult<HexString> {
get_verifiable_credential_signing_key_aux(seed_as_hex, raw_net, issuer_index, issuer_subindex, verifiable_credential_index)
.map_err(to_js_error)
get_verifiable_credential_signing_key_aux(
seed_as_hex,
raw_net,
issuer_index,
issuer_subindex,
verifiable_credential_index,
)
.map_err(to_js_error)
}

#[wasm_bindgen(js_name = getVerifiableCredentialPublicKey)]
Expand All @@ -357,8 +363,14 @@ pub fn get_verifiable_credential_public_key_ext(
issuer_subindex: u64,
verifiable_credential_index: u32,
) -> JsResult<HexString> {
get_verifiable_credential_public_key_aux(seed_as_hex, raw_net, issuer_index, issuer_subindex, verifiable_credential_index)
.map_err(to_js_error)
get_verifiable_credential_public_key_aux(
seed_as_hex,
raw_net,
issuer_index,
issuer_subindex,
verifiable_credential_index,
)
.map_err(to_js_error)
}

#[wasm_bindgen(js_name = serializeCredentialDeploymentPayload)]
Expand Down
6 changes: 3 additions & 3 deletions packages/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@concordium/web-sdk",
"version": "6.1.0-alpha",
"version": "6.1.0-alpha.1",
"license": "Apache-2.0",
"browser": "lib/concordium.min.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -48,8 +48,8 @@
"webpack-cli": "^4.9.2"
},
"dependencies": {
"@concordium/common-sdk": "9.1.0-alpha",
"@concordium/rust-bindings": "1.2.0-alpha",
"@concordium/common-sdk": "9.1.0-alpha.1",
"@concordium/rust-bindings": "1.2.0-alpha.1",
"@grpc/grpc-js": "^1.3.4",
"@protobuf-ts/grpcweb-transport": "^2.8.2",
"buffer": "^6.0.3",
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1312,11 +1312,11 @@ __metadata:
languageName: node
linkType: hard

"@concordium/[email protected], @concordium/common-sdk@workspace:packages/common":
"@concordium/[email protected].1, @concordium/common-sdk@workspace:packages/common":
version: 0.0.0-use.local
resolution: "@concordium/common-sdk@workspace:packages/common"
dependencies:
"@concordium/rust-bindings": 1.2.0-alpha
"@concordium/rust-bindings": 1.2.0-alpha.1
"@grpc/grpc-js": ^1.3.4
"@noble/ed25519": ^1.7.1
"@protobuf-ts/plugin": 2.8.1
Expand Down Expand Up @@ -1424,7 +1424,7 @@ __metadata:
languageName: unknown
linkType: soft

"@concordium/[email protected], @concordium/rust-bindings@workspace:packages/rust-bindings":
"@concordium/[email protected].1, @concordium/rust-bindings@workspace:packages/rust-bindings":
version: 0.0.0-use.local
resolution: "@concordium/rust-bindings@workspace:packages/rust-bindings"
languageName: unknown
Expand All @@ -1441,8 +1441,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "@concordium/web-sdk@workspace:packages/web"
dependencies:
"@concordium/common-sdk": 9.1.0-alpha
"@concordium/rust-bindings": 1.2.0-alpha
"@concordium/common-sdk": 9.1.0-alpha.1
"@concordium/rust-bindings": 1.2.0-alpha.1
"@grpc/grpc-js": ^1.3.4
"@protobuf-ts/grpcweb-transport": ^2.8.2
"@typescript-eslint/eslint-plugin": ^4.28.1
Expand Down

0 comments on commit bf59404

Please sign in to comment.