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

Polish Wasm bindings #1206

Merged
merged 13 commits into from
Jul 27, 2023
Merged
2 changes: 1 addition & 1 deletion bindings/wasm/examples/src/0_basic/5_create_vc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function createVC() {
const decoded_credential = new JwtCredentialValidator().validate(
credentialJwt,
issuerDocument,
new JwtCredentialValidationOptions({}),
new JwtCredentialValidationOptions(),
FailFast.FirstError,
);

Expand Down
2 changes: 1 addition & 1 deletion bindings/wasm/examples/src/0_basic/6_create_vp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export async function createVP() {
const res = new JwtCredentialValidator().validate(
credentialJwt,
issuerDocument,
new JwtCredentialValidationOptions({}),
new JwtCredentialValidationOptions(),
FailFast.FirstError,
);
console.log("credentialjwt validation", res.intoCredential());
Expand Down
6 changes: 3 additions & 3 deletions bindings/wasm/examples/src/0_basic/7_revoke_vc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export async function revokeVC() {
jwtCredentialValidator.validate(
credentialJwt,
issuerDocument,
new JwtCredentialValidationOptions({}),
new JwtCredentialValidationOptions(),
FailFast.FirstError,
);

Expand Down Expand Up @@ -162,7 +162,7 @@ export async function revokeVC() {
jwtCredentialValidator.validate(
credentialJwt,
issuerDocument,
new JwtCredentialValidationOptions({}),
new JwtCredentialValidationOptions(),
FailFast.FirstError,
);
console.log("Revocation Failed!");
Expand Down Expand Up @@ -203,7 +203,7 @@ export async function revokeVC() {
jwtCredentialValidator.validate(
credentialJwt,
resolvedIssuerDoc,
new JwtCredentialValidationOptions({}),
new JwtCredentialValidationOptions(),
FailFast.FirstError,
);

Expand Down
4 changes: 2 additions & 2 deletions bindings/wasm/examples/src/1_advanced/5_domain_linkage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export async function domainLinkage() {
issuerDocument,
fetchedConfigurationResource,
domainFoo,
JwtCredentialValidationOptions.default(),
new JwtCredentialValidationOptions(),
);

// =====================================================
Expand Down Expand Up @@ -163,7 +163,7 @@ export async function domainLinkage() {
didDocument,
fetchedConfigurationResource,
domains[0],
JwtCredentialValidationOptions.default(),
new JwtCredentialValidationOptions(),
);

console.log("Successfully validated Domain Linkage!");
Expand Down
1 change: 0 additions & 1 deletion bindings/wasm/examples/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export async function ensureAddressHasFunds(client: Client, addressBech32: strin

/** Returns the balance of the given Bech32-encoded address. */
async function getAddressBalance(client: Client, addressBech32: string): Promise<number> {
// TODO: use the `addresses/ed25519/<addressHex>` API to get the balance?
const outputIds = await client.basicOutputIds([
{ address: addressBech32 },
{ hasExpiration: false },
Expand Down
7 changes: 0 additions & 7 deletions bindings/wasm/src/account/mod.rs

This file was deleted.

56 changes: 0 additions & 56 deletions bindings/wasm/src/account/types/agreement_info.rs

This file was deleted.

40 changes: 0 additions & 40 deletions bindings/wasm/src/account/types/cek_algorithm.rs

This file was deleted.

50 changes: 0 additions & 50 deletions bindings/wasm/src/account/types/encrypted_data.rs

This file was deleted.

38 changes: 0 additions & 38 deletions bindings/wasm/src/account/types/encryption_algorithm.rs

This file was deleted.

16 changes: 8 additions & 8 deletions bindings/wasm/src/common/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ pub struct WasmTimestamp(pub(crate) Timestamp);

#[wasm_bindgen(js_class = Timestamp)]
impl WasmTimestamp {
/// Parses a `Timestamp` from the provided input string.
/// Parses a {@link Timestamp} from the provided input string.
#[wasm_bindgen]
pub fn parse(input: &str) -> Result<WasmTimestamp> {
Ok(Self(Timestamp::parse(input).wasm_result()?))
}

/// Creates a new `Timestamp` with the current date and time.
/// Creates a new {@link Timestamp} with the current date and time.
#[wasm_bindgen(js_name = nowUTC)]
pub fn now_utc() -> Self {
Self(Timestamp::now_utc())
}

/// Returns the `Timestamp` as an RFC 3339 `String`.
/// Returns the {@link Timestamp} as an RFC 3339 `String`.
#[wasm_bindgen(js_name = toRFC3339)]
#[allow(clippy::wrong_self_convention)]
pub fn to_rfc3339(&self) -> String {
Expand Down Expand Up @@ -69,30 +69,30 @@ pub struct WasmDuration(pub(crate) Duration);

#[wasm_bindgen(js_class = Duration)]
impl WasmDuration {
/// Create a new `Duration` with the given number of seconds.
/// Create a new {@link Duration} with the given number of seconds.
#[wasm_bindgen]
pub fn seconds(seconds: u32) -> WasmDuration {
Self(Duration::seconds(seconds))
}
/// Create a new `Duration` with the given number of minutes.
/// Create a new {@link Duration} with the given number of minutes.
#[wasm_bindgen]
pub fn minutes(minutes: u32) -> WasmDuration {
Self(Duration::minutes(minutes))
}

/// Create a new `Duration` with the given number of hours.
/// Create a new {@link Duration} with the given number of hours.
#[wasm_bindgen]
pub fn hours(hours: u32) -> WasmDuration {
Self(Duration::hours(hours))
}

/// Create a new `Duration` with the given number of days.
/// Create a new {@link Duration} with the given number of days.
#[wasm_bindgen]
pub fn days(days: u32) -> WasmDuration {
Self(Duration::days(days))
}

/// Create a new `Duration` with the given number of weeks.
/// Create a new {@link Duration} with the given number of weeks.
#[wasm_bindgen]
pub fn weeks(weeks: u32) -> WasmDuration {
Self(Duration::weeks(weeks))
Expand Down
Loading
Loading