The type of activation receivers.
* @@ -9,8 +7,8 @@ * (AdobeAdeptActivationReceiverType) */ -public interface AdobeAdeptActivationReceiverType -{ +public interface AdobeAdeptActivationReceiverType { + /** * Receive the number of activations, if any. * @@ -36,7 +34,7 @@ void onActivation( final AdobeDeviceID device_id, final String user_name, final AdobeUserID user_id, - final @Nullable String expires); + final String expires); /** * Receive activation errors, if any. diff --git a/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptAssets.kt b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptAssets.kt new file mode 100644 index 0000000..d40f8b5 --- /dev/null +++ b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptAssets.kt @@ -0,0 +1,81 @@ +package org.nypl.drm.core + +import org.readium.r2.shared.util.Url +import org.readium.r2.shared.util.asset.ContainerAsset +import org.readium.r2.shared.util.data.CompositeContainer +import org.readium.r2.shared.util.file.FileResource +import org.readium.r2.shared.util.format.AdeptSpecification +import org.readium.r2.shared.util.format.Format +import org.readium.r2.shared.util.format.FormatSpecification +import org.readium.r2.shared.util.format.Specification +import org.readium.r2.shared.util.resource.SingleResourceContainer +import java.io.File + +/** + * Functions to open Adobe-encrypted EPUB files in a form the Readium2 DRM can handle. + */ + +object AdobeAdeptAssets { + + /** + * The path at which the rights file is "mounted" within the container. + */ + + const val RIGHTS_PATH = "META-INF/rights.xml" + + /** + * The path at which the encryption descriptor can be found. + */ + + const val ENCRYPTION_PATH = "META-INF/encryption.xml" + + /** + * Open an encrypted EPUB as an asset. + */ + + @JvmStatic + fun openAsset( + epubAsset: ContainerAsset, + rightsFile: File + ): ContainerAsset { + /* + * We need to make the separate rights file appear as if it were an entry in the EPUB file. + * We can do this by creating a "composite container" that conceptually merges the rights + * file and the original EPUB file. + */ + + val rightsResource = + FileResource(rightsFile) + val rightsContainer = + SingleResourceContainer( + entryUrl = Url(RIGHTS_PATH)!!, + resource = rightsResource + ) + + val mainContainer = + CompositeContainer(epubAsset.container, rightsContainer) + + /* + * We need to add Adobe Adept as a specification to the existing format. + */ + + val specifications = mutableSetOfThe type of net providers.
*/ -public interface AdobeAdeptNetProviderType -{ +public interface AdobeAdeptNetProviderType { /** *Open a new stream to url, using method, delivering * data to client. Optional data to be sent to the destination may be @@ -24,18 +21,17 @@ public interface AdobeAdeptNetProviderType * @param client The stream client * @param post_data_content_type The post data type, if any * @param post_data The post data, if any - * * @return A new stream, or null if the stream cannot be opened for * any reason. Implementations are encouraged to notify the stream client of * specific errors. */ - @Nullable AdobeAdeptStreamType newStream( + AdobeAdeptStreamType newStream( String method, String url, - @Nullable AdobeAdeptStreamClientType client, - @Nullable String post_data_content_type, - @Nullable byte[] post_data); + AdobeAdeptStreamClientType client, + String post_data_content_type, + byte[] post_data); /** * Cancel the currently running download. diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptProcedureType.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptProcedureType.java similarity index 100% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptProcedureType.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptProcedureType.java diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptResourceProvider.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptResourceProvider.java similarity index 93% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptResourceProvider.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptResourceProvider.java index c21836c..6bbdc65 100644 --- a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptResourceProvider.java +++ b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptResourceProvider.java @@ -1,7 +1,6 @@ package org.nypl.drm.core; import java.util.Objects; -import com.io7m.jnull.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,7 +38,7 @@ public static AdobeAdeptResourceProviderType get(final byte[] in_certificate) return new AdobeAdeptResourceProvider(in_certificate); } - @Override public @Nullable byte[] getResourceAsBytes( + @Override public byte[] getResourceAsBytes( final String name) { AdobeAdeptResourceProvider.LOG.debug("getResource: {}", name); diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptResourceProviderType.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptResourceProviderType.java similarity index 82% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptResourceProviderType.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptResourceProviderType.java index 158cad2..1e47b88 100644 --- a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptResourceProviderType.java +++ b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptResourceProviderType.java @@ -1,7 +1,5 @@ package org.nypl.drm.core; -import com.io7m.jnull.Nullable; - /** * The type of functions that map resources to byte arrays. */ @@ -15,6 +13,6 @@ public interface AdobeAdeptResourceProviderType * null if the resource does not exist. */ - @Nullable byte[] getResourceAsBytes( + byte[] getResourceAsBytes( String name); } diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptStreamClientType.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptStreamClientType.java similarity index 100% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptStreamClientType.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptStreamClientType.java diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptStreamType.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptStreamType.java similarity index 88% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptStreamType.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptStreamType.java index cad3f9f..db6005a 100644 --- a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptStreamType.java +++ b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeAdeptStreamType.java @@ -1,15 +1,12 @@ package org.nypl.drm.core; -import com.io7m.jnull.Nullable; - /** *
The type of streams.
When used as part of the Adobe Adept * Connector, the streams are almost always HTTP(s) connections, used to * authorize devices and download books.
*/ -public interface AdobeAdeptStreamType -{ +public interface AdobeAdeptStreamType { /** * Called when information about the stream should be requested. For example, * a stream that represents an HTTP connection would open the connection here @@ -51,5 +48,5 @@ void onError( * @param c A new stream client */ - void onSetStreamClient(@Nullable AdobeAdeptStreamClientType c); + void onSetStreamClient(AdobeAdeptStreamClientType c); } diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeDeviceID.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeDeviceID.java similarity index 100% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeDeviceID.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeDeviceID.java diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeLoanID.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeLoanID.java similarity index 100% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeLoanID.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeLoanID.java diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeUserID.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeUserID.java similarity index 100% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeUserID.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeUserID.java diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeVendorID.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeVendorID.java similarity index 100% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AdobeVendorID.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AdobeVendorID.java diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/Assertions.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/Assertions.java similarity index 100% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/Assertions.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/Assertions.java diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AxisNowFulfillment.kt b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AxisNowFulfillment.kt similarity index 54% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AxisNowFulfillment.kt rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AxisNowFulfillment.kt index ecd6445..f5c9f6e 100644 --- a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AxisNowFulfillment.kt +++ b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AxisNowFulfillment.kt @@ -3,7 +3,7 @@ package org.nypl.drm.core import java.io.File data class AxisNowFulfillment( - val book: File, - val license: File, - val userKey: File -) \ No newline at end of file + val book: File, + val license: File, + val userKey: File, +) diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AxisNowFulfillmentException.kt b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AxisNowFulfillmentException.kt similarity index 63% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AxisNowFulfillmentException.kt rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AxisNowFulfillmentException.kt index a33f6d2..2d5aace 100644 --- a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AxisNowFulfillmentException.kt +++ b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AxisNowFulfillmentException.kt @@ -1,4 +1,4 @@ package org.nypl.drm.core -class AxisNowFulfillmentException(message: String? = null, cause: Throwable? = null) - : Exception(message, cause) \ No newline at end of file +class AxisNowFulfillmentException(message: String? = null, cause: Throwable? = null) : + Exception(message, cause) diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AxisNowServiceFactoryType.kt b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AxisNowServiceFactoryType.kt similarity index 64% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AxisNowServiceFactoryType.kt rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AxisNowServiceFactoryType.kt index 8ac3252..771b929 100644 --- a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AxisNowServiceFactoryType.kt +++ b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AxisNowServiceFactoryType.kt @@ -4,5 +4,5 @@ import org.librarysimplified.http.api.LSHTTPClientType interface AxisNowServiceFactoryType { - fun create(httpClient: LSHTTPClientType): AxisNowServiceType -} \ No newline at end of file + fun create(httpClient: LSHTTPClientType): AxisNowServiceType +} diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AxisNowServiceType.kt b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AxisNowServiceType.kt similarity index 50% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AxisNowServiceType.kt rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AxisNowServiceType.kt index fc22f7d..5bf3cf2 100644 --- a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/AxisNowServiceType.kt +++ b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/AxisNowServiceType.kt @@ -4,5 +4,5 @@ import java.io.File interface AxisNowServiceType { - fun fulfill(token: ByteArray, tempFactory: () -> File): AxisNowFulfillment -} \ No newline at end of file + fun fulfill(token: ByteArray, tempFactory: () -> File): AxisNowFulfillment +} diff --git a/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/ContentProtectionProvider.kt b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/ContentProtectionProvider.kt new file mode 100644 index 0000000..955bc90 --- /dev/null +++ b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/ContentProtectionProvider.kt @@ -0,0 +1,9 @@ +package org.nypl.drm.core + +import android.app.Application +import org.readium.r2.shared.publication.protection.ContentProtection + +interface ContentProtectionProvider { + + fun create(context: Application): ContentProtection? +} diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/DRMDecryptionException.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/DRMDecryptionException.java similarity index 100% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/DRMDecryptionException.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/DRMDecryptionException.java diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/DRMException.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/DRMException.java similarity index 100% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/DRMException.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/DRMException.java diff --git a/org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/DRMUnsupportedException.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/DRMUnsupportedException.java similarity index 100% rename from org.librarysimplified.drm.core/src/main/java/org/nypl/drm/core/DRMUnsupportedException.java rename to org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/DRMUnsupportedException.java diff --git a/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/package-info.java b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/package-info.java new file mode 100644 index 0000000..a2890e7 --- /dev/null +++ b/org.thepalaceproject.drm.core/src/main/java/org/nypl/drm/core/package-info.java @@ -0,0 +1,6 @@ +/** + * Core DRM types and interfaces. + */ + +package org.nypl.drm.core; + diff --git a/org.librarysimplified.drm.core/src/main/resources/org/nypl/drm/core/AdobeAdeptJoinAccountsInjected.js b/org.thepalaceproject.drm.core/src/main/resources/org/nypl/drm/core/AdobeAdeptJoinAccountsInjected.js similarity index 100% rename from org.librarysimplified.drm.core/src/main/resources/org/nypl/drm/core/AdobeAdeptJoinAccountsInjected.js rename to org.thepalaceproject.drm.core/src/main/resources/org/nypl/drm/core/AdobeAdeptJoinAccountsInjected.js diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index f4583d6..0000000 --- a/settings.gradle +++ /dev/null @@ -1,12 +0,0 @@ -enableFeaturePreview('VERSION_CATALOGS') - -dependencyResolutionManagement { - versionCatalogs { - libs { - from(files("org.thepalaceproject.android.platform/build_libraries.toml")) - } - } -} - -include ":org.librarysimplified.drm.core" -include ":org.librarysimplified.drm.core.tests" diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..9d0d3d3 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,44 @@ +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + google() + } +} + +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("$rootDir/org.thepalaceproject.android.platform/build_libraries.toml")) + } + } + + /* + * The set of repositories used to resolve library dependencies. The order is significant! + */ + + repositories { + mavenLocal() + mavenCentral() + google() + + /* + * Allow access to the Sonatype snapshots repository. + */ + + maven { + url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") + } + + /* + * Allow access to Jitpack. This is used by, for example, Readium. + */ + + maven { + url = uri("https://jitpack.io") + } + } +} + +include(":org.thepalaceproject.drm.core") +include(":org.thepalaceproject.drm.core.tests")