Skip to content

Commit

Permalink
Merge branch 'main' into c2pa-upd
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan770 authored Aug 30, 2024
2 parents 636c886 + 9daa71d commit dbc62a8
Show file tree
Hide file tree
Showing 10 changed files with 257 additions and 116 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2"

[workspace.package]
version = "0.17.1"
version = "0.17.2"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/vaultie/teddybear"
Expand Down
3 changes: 2 additions & 1 deletion crates/teddybear-crypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use did_web::DIDWeb;
use rand::rngs::OsRng;
use serde::{Deserialize, Serialize};
use ssi_dids_core::{
document::{verification_method::ValueOrReference, DIDVerificationMethod, ResourceRef},
document::{DIDVerificationMethod, ResourceRef},
DIDURLReference, DIDURLReferenceBuf, InvalidDIDURL, VerificationMethodDIDResolver,
};
use ssi_jwk::{Algorithm, Params};
Expand All @@ -25,6 +25,7 @@ use teddybear_high_assurance::DnsError;
use crate::okp_encoder::OKPEncoder;

pub use ssi_dids_core::{
document::verification_method::ValueOrReference,
ssi_json_ld::{
iref::{Uri, UriBuf},
Iri, IriBuf,
Expand Down
17 changes: 10 additions & 7 deletions crates/teddybear-js/module.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* ```ts
* import {
* ContextLoader,
* DID,
* DIDURL,
* Document,
* PrivateEd25519,
* verifyJWS
Expand All @@ -33,7 +35,7 @@
*
* // You can convert private Ed25519 keys to public Ed25519 keys
* // by providing the related DID document identifier and controller.
* const publicKey = privateKey.toPublicKey("did:web:example.com", "did:web:example.com");
* const publicKey = privateKey.toPublicKey(new DIDURL("did:web:example.com#key-1"), new DID("did:web:example.com"));
*
* // It is possible to convert a private Ed25519 key into a private
* // X25519 key.
Expand All @@ -45,7 +47,7 @@
* // ...issue verifiable credentials, ...
* const contextLoader = new ContextLoader();
* const verifiableCredential = await key.issueVC(
* "did:web:example.com#key-1",
* new DIDURL("did:web:example.com#key-1"),
* {
* "@context": ["https://www.w3.org/ns/credentials/v2"],
* type: ["VerifiableCredential"],
Expand All @@ -59,7 +61,7 @@
*
* // ...present them, ...
* const vp = await key.presentVP(
* "did:web:example.com#key-1",
* new DIDURL("did:web:example.com#key-1"),
* {
* "@context": ["https://www.w3.org/ns/credentials/v2"],
* type: ["VerifiablePresentation"],
Expand Down Expand Up @@ -96,12 +98,12 @@
*
* // Resolve a DID document. This is essentially an entrypoint
* // to almost all Teddybear operations.
* const document = await Document.resolve("did:web:example.com");
* const document = await Document.resolve(new DID("did:web:example.com"));
*
* // Resolved DID document may contain multiple keys with different
* // algorithms within it, so usually you would select one based on
* // key types, operation requirements, etc.
* const vm = document.verificationMethods().authentication?.[0]!;
* const vm = document.verificationMethods().authentication[0]!;
* const resolvedKey = document.getEd25519VerificationMethod(vm);
*
* // Public Ed25519 keys can be used to verify JWS signatures
Expand All @@ -112,13 +114,14 @@
*
* ```ts
* import {
* DID,
* Document,
* encryptAES
* } from "@vaultie/teddybear";
*
* const document = await Document.resolve("did:web:example.com");
* const document = await Document.resolve(new DID("did:web:example.com"));
*
* const vm = document.verificationMethods().keyAgreement?.[0]!;
* const vm = document.verificationMethods().keyAgreement[0]!;
* const resolvedKey = document.getX25519VerificationMethod(vm);
*
* // X25519 public keys can be used to encrypt data for multiple recipients
Expand Down
Loading

0 comments on commit dbc62a8

Please sign in to comment.